-
Notifications
You must be signed in to change notification settings - Fork 1
/
rvm.rb
37 lines (29 loc) · 890 Bytes
/
rvm.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
30
31
32
33
34
35
36
37
say_recipe 'rvm'
# load in RVM environment
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
end
else
raise "RVM ruby lib is currently unavailable."
end
rvm_env = "default@#{app_name}"
say_wizard "Creating RVM gemset #{app_name}"
RVM.gemset_create app_name
say_wizard "Trusting project's .rvmrc"
run "rvm rvmrc trust"
say_wizard "Switching to use RVM gemset #{app_name}"
RVM.gemset_use! app_name
# create rvmrc file
create_file '.rvmrc' do
"rvm #{rvm_env}"
end
if run("gem list --installed bundler", :capture => true) =~ /false/
run "gem install bundler --no-rdoc --no-ri"
end