Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Actually run the Ruby code inside a RubyMotion app to be sure it's OK.

Thanks for noticing that @mattgreen
  • Loading branch information...
commit d88b68ef7635d9abbbe68a63d2173092f421163b 1 parent 8e29c0d
@jaimeiniesta authored
View
5 02_RandomPossessions/.gitignore
@@ -0,0 +1,5 @@
+.repl_history
+build
+resources/*.nib
+resources/*.momd
+resources/*.storyboardc
View
7 02_RandomPossessions/README.md
@@ -1,3 +1,8 @@
# Random Possessions
-Chapter 2 is about Objective-C syntax, so for this exercise I've only done its Ruby equivalent.
+Chapter 2 is about Objective-C syntax, so for this exercise I've only done its
+Ruby equivalent.
+
+Just to be sure the code runs on RubyMotion, I've created a bare application
+and put the code inside app_delegate.rb -- when you run the project, you'll see
+an empty iPhone app but check the console for the messages.
View
7 02_RandomPossessions/Rakefile
@@ -0,0 +1,7 @@
+$:.unshift("/Library/RubyMotion/lib")
+require 'motion/project'
+
+Motion::Project::App.setup do |app|
+ # Use `rake config' to see complete project settings.
+ app.name = 'RandomPossessions'
+end
View
6 02_RandomPossessions/app/app_delegate.rb
@@ -0,0 +1,6 @@
+class AppDelegate
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
+ items = 10.times.collect { Item.randomItem }
+ items.each { |item| NSLog item.to_s }
+ end
+end
View
0  02_RandomPossessions/item.rb → 02_RandomPossessions/app/item.rb
File renamed without changes
View
4 02_RandomPossessions/main.rb
@@ -1,4 +0,0 @@
-require_relative 'item'
-
-items = 10.times.collect { Item.randomItem }
-items.each { |item| puts item }
View
9 02_RandomPossessions/spec/main_spec.rb
@@ -0,0 +1,9 @@
+describe "Application 'RandomPossessions'" do
+ before do
+ @app = UIApplication.sharedApplication
+ end
+
+ it "has one window" do
+ @app.windows.size.should == 1
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.