Dubious for App Engine¶ ↑
See the published demo: dubious-demo.appspot.com
Introducing Dubious¶ ↑
This is a web framework written in Mirah geared towards running on App Engine. Dubious provide a way to build apps in Mirah, with conventions familiar to Rails developers. Mirah has no runtime dependencies, everything is compiled ahead-of-time. So, Mirah apps have none of the initialization costs associated with JRuby. Dubious supports ERb and uses a simple datastore adapter that uses a syntax similar to DataMapper.
Introducing Mirah¶ ↑
Mirah is a new language with Ruby-inspired syntax that compiles to JVM bytecode. Mirah is statically typed, with local type inference, and a simple macro system. The goal is to make Mirah as expressive as Ruby without introducing any runtime library and while maintaining Java’s level of performance. Just write code that looks like Ruby, but reference the Java docs to find out what method calls to make. Mirah uses the Java type system. Join the mirah mailing list to get involved: groups.google.com/group/mirah
Getting Started¶ ↑
Install Dubious(Note: Dubious requires JRuby).
gem install dubious
This will add a ‘dubious` command that you can create new apps, generate controllers and models etc with.
Once dubious is installed, you can generate an app skeleton.
dubious new my-app cd my-app
Directory Layout¶ ↑
The layout is based on Rails’ with some Java WAR directories, and files geared towards deploying on AppEngine.
-
WEB-INF/app.yaml
contains handlers for different routes, as well as filters and settings for serving static files.
code.google.com/appengine/docs/java/configyaml/appconfig_yaml.html
Hacking on Dubious¶ ↑
Setup the Mirah development environment ¶ ↑
-
Install JRuby. You can find good instructions on the JRuby website jruby.org/
-
Install the prerelease appengine-sdk gem from code.google.com/p/appengine-jruby/
-
Now git clone bitescript, mirah and dubious to your drive
mkdir -p ~/mystuff; cd ~/mystuff git clone http://github.com/headius/bitescript.git git clone http://github.com/mirah/mirah.git git clone http://github.com/mirah/mirah_model.git git clone http://github.com/mirah/dubious.git
-
Then build and install the gems for Mirah, Bitescript and Dubious
cd bitescript gem build bitescript.gemspec gem install bitescript-* cd - cd mirah rake jar:bootstrap gem build mirah.gemspec gem install mirah-* cd - cd dubious rake gem gem install pkg/dubious-* cd -
To build the gem (requires RubyGems ~> 1.5.0 to build)
rake package
Developing your App¶ ↑
Install the gem
jgem install dubious
Generate your app
dubious new my-app cd my-app
There are two ways to develop the app. The first way is to run the build script each time you make a change. The new way is to use the Rakefile. If you are using jruby’s rake, the task will watch for source file changes and update the running class files. Otherwise, you need to restart the server when you have changes.
Use the New Rakefile¶ ↑
Run the app locally
jruby -S rake server
Edit the app-id in app.yaml, then publish to appspot.com
jruby -S rake publish