Skip to content

Instantly share code, notes, and snippets.

@enebo
Created September 1, 2016 16:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enebo/aaf72a926358165b360a5e6221b31522 to your computer and use it in GitHub Desktop.
Save enebo/aaf72a926358165b360a5e6221b31522 to your computer and use it in GitHub Desktop.
#!/usr/bin/env jruby
require 'rubygems'
require 'fileutils'
require 'optparse'
ENV['RAILS_ENV'] = "development"
launcher, options = "jruby", ""
OptionParser.new do |opt|
opt.banner = "Usage: runner [OPTIONS]"
opt.separator ""
opt.separator "Options"
opt.on('-r', '--ruby ruby', 'which ruby you want to run') { |v| launcher = v }
opt.on('-o', '--options opts', 'options for ruby command') { |v| options = v }
end.parse!
full_path = File.expand_path launcher
launcher = full_path if File.exist? full_path
$jruby = "#{launcher} #{options} "
def jruby_command(command, *args)
command = "#{$jruby} -S #{command} #{args.join(' ')}"
puts "$ #{command}"
value = system command
puts value
end
rails_app = 'frogger'
FileUtils.rm_rf rails_app
jruby_command("gem", "install rails --version=4.2.7")
jruby_command("rails", "new", rails_app)
Dir.chdir(rails_app) do
jruby_command("bundle", "install")
jruby_command("rails", "generate scaffold person name:string")
jruby_command("rake", "db:migrate")
jruby_command("rails", "server")
end
puts "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment