Some weeks a go some colleagues of mine and me were attending the eurucamp 2013 at the lovely Mggelsee in Berlin. Besides the nice location, the European Ruby Camp did not only provide tasty coffee but also a whole bunch of interesting talks and workshops. This article will summarize the most interesting parts.
The first course Ive attended has been the Ember.js workshop. Also this has been the first contact with the eurucamp wifi
To be polite: It wasnt super optimal ;-) So while listening to the speaker (Balint Erdi) I spent about 2 hours downloading Rails 4 :-/ In the end it turned out, that using my mobile phones hotspot was a better option.
As it was quite hard to actually follow Balints workshop without running the code he was explaining, I will just reference his notes of the talk.
The second workshop was about RubyMotion. First, Marin Usalj provided a temporary RubyMotion executable for every attendee. That way it was a pleasure to participate in the workshop, without getting into any hassles related to downloads. Once everyone installed the package, Marin create a first simple application:
motion create test
Create test
Create test/.gitignore
Create test/Rakefile
Create test/app
Create test/app/app_delegate.rb
Create test/resources
Create test/resources/[email protected]
Create test/spec
Create test/spec/main_spec.rb
Its now possible to launch that application just by firing this:
cd test
rake
This will basically compile the RubyMotion application and open it in the simulator. You should see an iPhone with a black screen now.
We went on by adding a root controller, which gets loaded in the
applications main entry point: The file
app/app_delegate.rb
{.prettyprint}:
# app/app_delegate.rb
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = RootViewController.new
@window.makeKeyAndVisible
true
end
end
# app/controllers/root_controller.rb
class RootViewController < UIViewController
def loadView
self.view = UIView.alloc.initWithFrame(UIScreen.mainScreen.bounds)
self.view.backgroundColor = UIColor.whiteColor
add_buttons
end
def add_buttons
# button = UIButton.alloc.initWithFrame([[100, 100], [200, 40]]))
button = UIButton.alloc.initWithFrame(CGRectMake(100, 100, 200, 40))
button.setBackgroundColor UIColor.grayColor
button.setTitle "press me!", forState: UIControlStateNormal
self.view.addSubview(button)
end
end
Once saved and ran (via rake
{.prettyprint}), this code spawned the
most impressive and most beautiful application of all time Feel free to
take a look at the following git repository to get in touch with more
advanced examples :)