Skip to content

Instantly share code, notes, and snippets.

@lenny
Created October 11, 2011 14:30
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 lenny/1278231 to your computer and use it in GitHub Desktop.
Save lenny/1278231 to your computer and use it in GitHub Desktop.
script/tomcat-console to run Rails console from a WAR
#!/usr/bin/env jruby
raise "Must specify CATALINA_HOME" unless ENV['CATALINA_HOME']
ENV['GEM_HOME'] ||= File.expand_path('../../gems', __FILE__)
require File.expand_path('../../../META-INF/init', __FILE__)
# expected by rails/commands
APP_PATH = File.expand_path('../../config/application', __FILE__)
require 'java'
Dir[File.expand_path('../../lib/*.jar', __FILE__)].each {|f| require f}
$CLASSPATH << File.expand_path('../../classes/', __FILE__)
$CLASSPATH << "#{ENV['CATALINA_HOME']}/lib/"
require File.expand_path('../../config/environment', __FILE__)
ARGV.unshift('c')
require 'rails/commands'
~
~
~
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment