Skip to content

Instantly share code, notes, and snippets.

@woodie
Created October 21, 2009 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodie/215090 to your computer and use it in GitHub Desktop.
Save woodie/215090 to your computer and use it in GitHub Desktop.
#!/bin/bash
# requires Rubygems 1.3.5, using JRuby 1.4.0
jruby -S gem bundle
cd .gems
jar -cf ../WEB-INF/lib/gems.jar bundler_gems
cd ..
# bundle everything into .gems (won't be uploaded)
disable_rubygems
bundle_path '.gems/bundler_gems'
gem "rack", "1.0.0"
gem "dm-appengine"
gem "sinatra"
gem "haml"
. . .
# load gems from the jar file
require 'bundler_gems/environment'
require 'sinatra'
require 'dm-core'
require 'haml'
configure do
DataMapper.setup(:default, "appengine://auto")
end
. . .
In the Gemfile, I set the bundle_path to ".gems/bundler_gems",
then I require "bundler_gems/environment" from inside my app.
This way my app only loads the environment.rb from my jar file.
When I jar it all up, I skip the ".gems" dir, starting one dir lower.
When people say disable_rubygems, we can assume they want
us to toss the rubygems jar. I have no idea how we keep people
from messing with the defaults. Maybe we generate a Gemfile,
with some instructions, and a terse explainaton on the system
config.ru
guestbook.rb
bundle.sh # will be replaced by appcfg.rb gem
Gemfile
.gems # skipped during upload process
WEB-INF
|-- web.xml
|-- appengine-web.xml
`--lib
|-- appengine-jruby-0.0.5.jar
|-- jruby-rack-0.9.5.jar
|-- gems.jar
`-- appengine-api-1.0-sdk-1.2.6.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment