[macruby-changes] [439] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 14 14:27:19 PDT 2008
Revision: 439
http://trac.macosforge.org/projects/ruby/changeset/439
Author: rich at infoether.com
Date: 2008-08-14 14:27:19 -0700 (Thu, 14 Aug 2008)
Log Message:
-----------
template files for hotcocoa
Added Paths:
-----------
MacRuby/trunk/data/
MacRuby/trunk/data/hotcocoa_template/
MacRuby/trunk/data/hotcocoa_template/Rakefile
MacRuby/trunk/data/hotcocoa_template/config/
MacRuby/trunk/data/hotcocoa_template/config/build.yml
MacRuby/trunk/data/hotcocoa_template/lib/
MacRuby/trunk/data/hotcocoa_template/lib/application.rb
MacRuby/trunk/data/hotcocoa_template/lib/menu.rb
Added: MacRuby/trunk/data/hotcocoa_template/Rakefile
===================================================================
--- MacRuby/trunk/data/hotcocoa_template/Rakefile (rev 0)
+++ MacRuby/trunk/data/hotcocoa_template/Rakefile 2008-08-14 21:27:19 UTC (rev 439)
@@ -0,0 +1,18 @@
+task :default => [:run]
+
+task :build do
+ require 'hotcocoa/application_builder'
+ ApplicationBuilder.build :file => "config/build.yml"
+end
+
+task :run => [:build] do
+ require 'yaml'
+ app_name = YAML.load(File.read("config/build.yml"))[:name]
+ `open "#{app_name}.app"`
+end
+
+task :clean do
+ require 'yaml'
+ app_name = YAML.load(File.read("config/build.yml"))[:name]
+ `rm -rf "#{app_name}.app"`
+end
Added: MacRuby/trunk/data/hotcocoa_template/config/build.yml
===================================================================
--- MacRuby/trunk/data/hotcocoa_template/config/build.yml (rev 0)
+++ MacRuby/trunk/data/hotcocoa_template/config/build.yml 2008-08-14 21:27:19 UTC (rev 439)
@@ -0,0 +1,4 @@
+:name: __APPLICATION_NAME__
+:load: lib/application.rb
+:sources:
+ - lib/**/*.rb
Added: MacRuby/trunk/data/hotcocoa_template/lib/application.rb
===================================================================
--- MacRuby/trunk/data/hotcocoa_template/lib/application.rb (rev 0)
+++ MacRuby/trunk/data/hotcocoa_template/lib/application.rb 2008-08-14 21:27:19 UTC (rev 439)
@@ -0,0 +1,12 @@
+require 'hotcocoa'
+
+include HotCocoa
+
+# Replace the following code with your own hotcocoa code
+
+application :name => "__APPLICATION_NAME__" do |app|
+ window :frame => [100, 100, 500, 500], :title => "__APPLICATION_NAME__" do |win|
+ win << label(:text => "Hello from HotCocoa", :layout => {:start => false})
+ win.will_close { exit }
+ end
+end
\ No newline at end of file
Added: MacRuby/trunk/data/hotcocoa_template/lib/menu.rb
===================================================================
--- MacRuby/trunk/data/hotcocoa_template/lib/menu.rb (rev 0)
+++ MacRuby/trunk/data/hotcocoa_template/lib/menu.rb 2008-08-14 21:27:19 UTC (rev 439)
@@ -0,0 +1,32 @@
+module HotCocoa
+ def application_menu(app)
+ menu :main do |main|
+ main.submenu :apple do |apple|
+ apple.item :about, :title => "About #{app.name}", :target => app, :action => "orderFrontStandardAboutPanel:"
+ apple.separator
+ apple.item :preferences, :key => ","
+ apple.separator
+ apple.submenu :services
+ apple.separator
+ apple.item :hide, :title => "Hide #{app.name}", :key => "h", :target => app, :action => "hide:"
+ apple.item :hide_others, :title => "Hide Others", :key => "h", :modifiers => [:command, :alt], :target => app, :action => "hideOtherApplications:"
+ apple.item :show_all, :title => "Show All", :target => app, :action => "unhideAllApplications:"
+ apple.separator
+ apple.item :quit, :title => "Quit #{app.name}", :key => "q", :target => app, :action => "terminate:"
+ end
+ main.submenu :file do |file|
+ file.item :new, :key => "n"
+ file.item :open, :key => "o"
+ end
+ main.submenu :window do |win|
+ win.item :minimize, :key => "m"
+ win.item :zoom
+ win.separator
+ win.item :bring_all_to_front, :title => "Bring All to Front", :key => "o"
+ end
+ main.submenu :help do |help|
+ help.item :help, :title => "#{app.name} Help"
+ end
+ end
+ end
+end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080814/d3cf9f2d/attachment.html
More information about the macruby-changes
mailing list