Permalink
Browse files

Moved split-jruby.sh into a Rakefile to make it (hopefully) more reli…

…able. Changed the rackup file so that the tweak to sinatra.rb is no longer required.
  • Loading branch information...
1 parent 7f062d0 commit eeb36056014a402241e6b1b1277ef3d65e06d9f4 @spraints spraints committed Apr 22, 2009
Showing with 35 additions and 38 deletions.
  1. +32 −0 Rakefile
  2. +2 −8 config.ru
  3. +0 −23 lib/split-jruby.sh
  4. +1 −7 readme
View
@@ -0,0 +1,32 @@
+require 'fileutils'
+require 'pathname'
+
+directory 'lib'
+
+desc 'Extracts the required parts of jruby-complete.jar (needs JRUBY_COMPLETE env).'
+task :jrubyjars => ['lib'] do
+ raise 'JRUBY_COMPLETE environment variable must be defined!' if ENV['JRUBY_COMPLETE'].nil?
+ jruby_complete = Pathname.new(ENV['JRUBY_COMPLETE'])
+ raise 'JRUBY_COMPLETE environment variable must be a file!' unless jruby_complete.file?
+ jruby_complete = jruby_complete.realpath
+
+ Dir.chdir 'lib' do
+ make_empty_dir 'ruby-stdlib'
+ make_empty_dir 'jruby-core'
+ Dir.chdir 'ruby-stdlib' do
+ sh 'jar', 'xf', jruby_complete
+ FileUtils.mv %W(org com jline jay jruby), '../jruby-core'
+ sh 'jar', 'cf', '../ruby-stdlib.jar', '.'
+ end
+ Dir.chdir 'jruby-core' do
+ sh 'jar', 'cf', '../jruby-core.jar', '.'
+ end
+ FileUtils.rm_rf('ruby-stdlib', :secure => true)
+ FileUtils.rm_rf('jruby-core', :secure => true)
+ end
+end
+
+def make_empty_dir(dirname)
+ FileUtils.rm_rf(dirname, :secure => true) if File.exist? dirname
+ Dir.mkdir dirname
+end
View
@@ -1,13 +1,7 @@
require 'rubygems'
-require 'sinatra'
-
-root_dir = File.dirname(__FILE__)
+require 'app'
set :environment, :production
-set :root, root_dir
-set :app_file, File.join(root_dir, 'app.rb')
-disable :run
-
-require 'app'
+set :run, false
run Sinatra::Application
View
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-rm -rf jruby-core.jar
-rm -rf ruby-stdlib.jar
-rm -rf tmp_unpack
-mkdir tmp_unpack
-cd tmp_unpack
-jar xf ../jruby-complete.jar
-cd ..
-mkdir jruby-core
-mv tmp_unpack/org jruby-core/
-mv tmp_unpack/com jruby-core/
-mv tmp_unpack/jline jruby-core/
-mv tmp_unpack/jay jruby-core/
-mv tmp_unpack/jruby jruby-core/
-cd jruby-core
-jar cf ../jruby-core.jar .
-cd ../tmp_unpack
-jar cf ../ruby-stdlib.jar .
-cd ..
-rm -rf jruby-core
-rm -rf tmp_unpack
-rm -rf jruby-complete.jar
View
8 readme
@@ -21,17 +21,11 @@ cd ..
# create sinatra app
git clone git://github.com/seven1m/sinatra-appengine-example.git myapp
cd !$
+jruby -S rake jrubyjars JRUBY_COMPLETE=/usr/local/jruby/lib/jruby-complete.jar
cp -r ../jruby-rack/target/jruby-rack-*.jar lib
-cp /usr/local/jruby/lib/jruby-complete.jar lib
-cd lib
-./split-jruby.sh
-cd ..
cp ../appengine-java-sdk-1.2.0/lib/user/appengine-api-1.0-sdk-1.2.0.jar lib/
jruby -S warble
-# now comment out tmp/war/WEB-INF/gems/gems/sinatra-*/lib/sinatra.rb line
-# that reads "use_in_file_templates!"
-
# to test
../appengine-java-sdk-1.2.0/bin/dev_appserver.sh tmp/war

0 comments on commit eeb3605

Please sign in to comment.