Do not use rvm (or install and run from JRuby). The google-appengine gem must install into your system MRI. The appengine-sdk gem includes a complete Java app server. We bootstrap Java from MRI, then your app runs inside a servlet container (with access to all the APIs) using the version of JRuby installed into each app.
We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.x calls to rubygems, and now we have it working. Rails 2.3.x currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.
See the TInyDS version also: gist.github.com/gists/269075
One meta-gem provides the development environment
sudo gem install google-appengine
Install some gems you’ll need
sudo gem install rails -v "2.3.11" sudo gem install rails_dm_datastore sudo gem install activerecord-nulldb-adapter
Create a folder for your app
mkdir rails_app; cd rails_app
Download and run the setup script
curl -O http://appengine-jruby.googlecode.com/hg/demos/rails2/rails2311_appengine.rb ruby rails2311_appengine.rb
Start development server
./script/server.sh
Open local console
./script/console.sh
Publish to production
./script/publish.sh
We disable rubygems in the development environment, and the generators from Rails 2 perform various Gem dependency checks that are too difficult to patch, so we run the generators from the MRI. We also use Josh Moore’s rails_dm_datastore integration plugin.
Generate a restful controller and add it to config/routes.rb
./script/generate scaffold contact title:string summary:text \ birthday:date url:string address:string phone:string -f --skip-migration
Generate a model for DataMapper
./script/generate dd_model contact title:string summary:text \ birthday:date url:link address:postal_address phone:phone_number -f
You’ve created a RESTful controller, and a DataMapper model
Hi Woodie, thanks for the good work. A couple of observations, I don't see why the appengine-sdk gem must be installed into the system ruby, I managed to get it working with RVM. Another thing, apparently with the latest version of the SDK (1.4.2) there's an error somewhere and I was getting the following error "illegal access on 'hasMoreElements': Reflection is not allowed on public boolean", I fixed it by removing the appengine-sdk-1.4.2 and installing appengine-sdk-1.4.0
I might try to wrap everything up into a gem at some point...