[macruby-changes] [3280] MacRuby/trunk/misc/xcode-templates/Project Templates/Application
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 15 04:59:16 PST 2010
Revision: 3280
http://trac.macosforge.org/projects/ruby/changeset/3280
Author: eloy.de.enige at gmail.com
Date: 2010-01-15 04:59:15 -0800 (Fri, 15 Jan 2010)
Log Message:
-----------
Don't load rb_main.rb twice in a MacRuby generated app.
Modified Paths:
--------------
MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Application/rb_main.rb
MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Core Data Application/rb_main.rb
MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Document-based Application/rb_main.rb
Modified: MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Application/rb_main.rb
===================================================================
--- MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Application/rb_main.rb 2010-01-15 00:53:26 UTC (rev 3279)
+++ MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Application/rb_main.rb 2010-01-15 12:59:15 UTC (rev 3280)
@@ -10,12 +10,13 @@
# do that here too.
framework 'Cocoa'
+main = File.basename(__FILE__, File.extname(__FILE__))
+resources = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
+
# Loading all the Ruby project files.
-dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
-Dir.glob(dir_path + '/*.{rb,rbo}').map { |x| File.basename(x, File.extname(x)) }.uniq.each do |path|
- if path != File.basename(__FILE__)
- require(path)
- end
+Dir.glob(File.join(resources, '*.{rb,rbo}')).each do |file|
+ file = File.basename(file, File.extname(file))
+ require file unless file == main
end
# Starting the Cocoa main loop.
Modified: MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Core Data Application/rb_main.rb
===================================================================
--- MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Core Data Application/rb_main.rb 2010-01-15 00:53:26 UTC (rev 3279)
+++ MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Core Data Application/rb_main.rb 2010-01-15 12:59:15 UTC (rev 3280)
@@ -11,12 +11,13 @@
framework 'Cocoa'
framework 'CoreData'
+main = File.basename(__FILE__, File.extname(__FILE__))
+resources = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
+
# Loading all the Ruby project files.
-dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
-Dir.glob(dir_path + '/*.{rb,rbo}').map { |x| File.basename(x, File.extname(x)) }.uniq.each do |path|
- if path != File.basename(__FILE__)
- require(path)
- end
+Dir.glob(File.join(resources, '*.{rb,rbo}')).each do |file|
+ file = File.basename(file, File.extname(file))
+ require file unless file == main
end
# Starting the Cocoa main loop.
Modified: MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Document-based Application/rb_main.rb
===================================================================
--- MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Document-based Application/rb_main.rb 2010-01-15 00:53:26 UTC (rev 3279)
+++ MacRuby/trunk/misc/xcode-templates/Project Templates/Application/MacRuby Document-based Application/rb_main.rb 2010-01-15 12:59:15 UTC (rev 3280)
@@ -10,12 +10,13 @@
# do that here too.
framework 'Cocoa'
+main = File.basename(__FILE__, File.extname(__FILE__))
+resources = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
+
# Loading all the Ruby project files.
-dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
-Dir.glob(dir_path + '/*.{rb,rbo}').map { |x| File.basename(x, File.extname(x)) }.uniq.each do |path|
- if path != File.basename(__FILE__)
- require(path)
- end
+Dir.glob(File.join(resources, '*.{rb,rbo}')).each do |file|
+ file = File.basename(file, File.extname(file))
+ require file unless file == main
end
# Starting the Cocoa main loop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100115/5e44aa54/attachment-0001.html>
More information about the macruby-changes
mailing list