forked from kfaustino/rails-templater
-
Notifications
You must be signed in to change notification settings - Fork 11
/
bootstrap.rb
29 lines (22 loc) · 867 Bytes
/
bootstrap.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
rvm_lib_path = "#{`echo $rvm_path`.strip}/lib"
$LOAD_PATH.unshift(rvm_lib_path) unless $LOAD_PATH.include?(rvm_lib_path)
require 'rvm'
rvm_ruby = ARGV[0]
app_name = ARGV[1]
unless rvm_ruby
puts "\n You need to specify a which rvm rubie to use."
end
unless app_name
puts "\n You need to name your app."
end
@env = RVM::Environment.new(rvm_ruby)
puts "Creating gemset #{app_name} in #{rvm_ruby}"
@env.gemset_create(app_name)
puts "Now using gemset #{app_name}"
@env.gemset_use!(app_name)
puts "Installing bundler gem."
puts "Successfully installed bundler" if @env.system("gem", "install", "bundler")
puts "Installing rails gem."
puts "Successfully installed rails" if @env.system("gem", "install", "rails")
template_file = File.join(File.expand_path(File.dirname(__FILE__)), 'templater.rb')
system("rails new #{app_name} -JT -d mysql -m #{template_file}")