Created
October 31, 2018 16:57
-
-
Save enebo/ddc91173166ede411a553d09e91b1968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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=5.1.6") | |
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