Skip to content

Instantly share code, notes, and snippets.

View woodie's full-sized avatar

John Woodell woodie

View GitHub Profile
@woodie
woodie / .README
Created March 22, 2011 00:43
override servlet listener and filer in app.yaml
With jruby-rack 1.0.7, a hello rack app function,
as long as the config.ru file is inside WEB-INF.
Our BusyContextListener does not seem to have any affect.
The config.ru in WEB-INF is found first.
$ mirah -e ' puts ["foo", "bar"] '
[foo, bar]
$ mirah -e ' puts %w{foo bar} '
Inference Error:
DashE:3: Cannot find static method w(block) on DashE
$ mirah -e ' puts %w(foo bar) '
Inference Error:
DashE:3: Cannot find static method bar() on DashE
@woodie
woodie / string.mirah
Created February 26, 2011 01:28
working with stings
# mirah
args = "some.token.here
color=%23668CD9
mode=AGENDA
ctz=America/Los_Angeles
showCalendars=0
showTitle=0
showPrint=0
showTabs=0
hl=en".replaceAll("[\\s]+","&")
application: hybrid-app
version: 1
runtime: java
public_root: /public
inbound_services:
- mail
listeners:
- com.google.appengine.jruby.LazyContextListener
@woodie
woodie / gist:828001
Created February 15, 2011 18:56
mirahdatastore issue
$ gem -v
1.3.6
$ jruby -S gem -v
1.5.0
$ jruby -v
jruby 1.6.0.RC2 (ruby 1.8.7 patchlevel 330) (2011-02-09 5434c72) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java]
$ mirah -v

Rails 2.3.11 on App Engine (DataMapper)

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

Install the Development Environment

@woodie
woodie / ERROR
Created February 12, 2011 01:17
Issues with jruby-rack 1.0.6
trace-1
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `call' for nil:NilClass
at Rack::Handler::Servlet.call(file:/Users/woodie/mycode/rails_depot/WEB-INF/lib/jruby-rack-1.0.6.jar!/rack/handler/servlet.rb:19)
trace-2
java.security.AccessControlException: access denied (java.io.FilePermission /Users/woodie/mycode/rails_depot.html read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
@woodie
woodie / Test.java
Created January 20, 2011 18:28
Hello Mirah
// Generated from test.mirah
public class Test extends java.lang.Object {
public static void main(java.lang.String[] argv) {
int __xform_tmp_1 = 0;
int __xform_tmp_2 = 0;
int i = 0;
__xform_tmp_1 = 1;
__xform_tmp_2 = 5;
label1:
while ((__xform_tmp_1 <= __xform_tmp_2)) {
$ mkdir fffffff; cd fffffff/
$ curl -O http://appengine-jruby.googlecode.com/hg/demos/rails2/rails2310_appengine.rb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3066 100 3066 0 0 14154 0 --:--:-- --:--:-- --:--:-- 196k
$ ruby rails2310_appengine.rb
=> Bundling gems
Calculating dependencies...
# DO NOT MODIFY THIS FILE
module Bundler
file = File.expand_path(__FILE__)
dir = File.dirname(file)
ENV["GEM_HOME"] = dir
ENV["GEM_PATH"] = dir
# handle 1.9 where system gems are always on the load path
if defined?(::Gem)