I like PhoneGap, but I am not really sure why you would do this with RubyMotion when for most PhoneGap apps, you really don't need to go much outside of what there are already plugins for. In my experience, getting a plugin working in Obj-C is not terrible.
There is no build system in PhoneGap, just instructions on how to get it build with Xcode. Using the RubyMotion build tools will allow you to work around this, all you'd really need is the Rakefile in this case, no extra Ruby files.
It's agreed, that most may not need to write (or alter) Plugins for PhoneGap, but if you did, and if you'd prefer to write in Ruby, this article may be helpful!
> when for most PhoneGap apps, you really don't need to go much outside of what there are already plugins for
The operative word here being "most." You're right that for apps that meet those constraints, this is not especially compelling; the target here is for apps that are exceptions. We have produced cross-platform apps that require additional capabilities beyond what Phonegap includes, and have ended up writing a cross-platform UI, plus some native ObjC and Java glue for iOS and Android, respectively, to provide that capacity. The combination presented here would mean that at least on iOS, you could have a slightly more-pleasant glue-writing experience, particularly since anecdotally, ObjC is the hardest of the pieces of that kind of project for non-experts to get started with.
But RubyMotion still requires you to at least read Objective-C. Surely the little bit of glue code would look pretty much the same in Ruby as in ObjC, especially when it's mostly calling classes in the iOS and PhoneGap APIs anyway.
I haven't seen many articles mention Titanium (appcelerator) as an alternative to RubyMotion; you could skip the ruby step and just start in Javascript. Also, their documentation and tutorial videos are substantial and well done.
Titanium is a noble effort but you're still beholden to Appcelerator in terms of what API functionality is exposed, unless you want to write your own plugins.
Sorry, Ruby fans. There is absolutely nothing special about this. It's a basic iOS app that just bootstraps Cordova.
There are no Ruby idioms in use that save code over the Objective-C implementation. There are no blocks, map, inject, hash or array literals, etc.. Sure, you don't have to write a .h file.
The Ruby code here could be translated line-for-line into Objective-C and built with the standard toolchain, without another $200 toolchain. And guess what? You still need to know the Objective-C API to write the app delegate and view controllers.
There was no attempt made to use Ruby idioms in the article. I think you're missing the point. It was merely an example how one can use alternate build tools, while extending their JavaScript or Cordova based app using Ruby over Objective-C. Not everyone is a fan of Xcode nor Obj-C. Lots of education about the tools was included to help one get on their way; the intention was not to be craft a reason as to why Ruby idioms can make a developer more productive.
RubyMotion does make sense here, if your goals are as described in the article.
I really thought this was something like writing everything in JS instead of Ruby and/or Objective-C. The title is kind of misleading. This is just Cordova but with RubyMotion. Bummer.
11 comments
[ 3.2 ms ] story [ 30.1 ms ] threadThere is no build system in PhoneGap, just instructions on how to get it build with Xcode. Using the RubyMotion build tools will allow you to work around this, all you'd really need is the Rakefile in this case, no extra Ruby files.
It's agreed, that most may not need to write (or alter) Plugins for PhoneGap, but if you did, and if you'd prefer to write in Ruby, this article may be helpful!
Or maybe you just want to tinker around.
The operative word here being "most." You're right that for apps that meet those constraints, this is not especially compelling; the target here is for apps that are exceptions. We have produced cross-platform apps that require additional capabilities beyond what Phonegap includes, and have ended up writing a cross-platform UI, plus some native ObjC and Java glue for iOS and Android, respectively, to provide that capacity. The combination presented here would mean that at least on iOS, you could have a slightly more-pleasant glue-writing experience, particularly since anecdotally, ObjC is the hardest of the pieces of that kind of project for non-experts to get started with.
There are no Ruby idioms in use that save code over the Objective-C implementation. There are no blocks, map, inject, hash or array literals, etc.. Sure, you don't have to write a .h file.
The Ruby code here could be translated line-for-line into Objective-C and built with the standard toolchain, without another $200 toolchain. And guess what? You still need to know the Objective-C API to write the app delegate and view controllers.
RubyMotion makes no sense here.
RubyMotion does make sense here, if your goals are as described in the article.