forked from greendog99/greendog-rails-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_rvm.rb
29 lines (20 loc) · 964 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
# Set up rvm private gemset
puts "Setting up RVM gemset and installing bundled gems (may take a while) ... ".magenta
current_ruby = `rvm list`.match(/=> ([^ ]+)/)[1]
desired_ruby = ask("Which RVM Ruby would you like to use? [#{current_ruby}]".red)
desired_ruby = current_ruby if desired_ruby.blank?
gemset_name = ask("What name should the custom gemset have? [#{@app_name}]".red)
gemset_name = @app_name if gemset_name.blank?
# Create the gemset
run "rvm gemset create #{gemset_name}"
# Let us run shell commands inside our new gemset. Use this in other template partials.
@rvm = "rvm #{desired_ruby}@#{gemset_name}"
# Create .rvmrc
file '.rvmrc', @rvm
puts " #{@rvm}".yellow
# Make the .rvmrc trusted
run "rvm rvmrc trust #{@app_path}"
# Since the gemset is likely empty, manually install bundler so it can install the rest
run "#{@rvm} gem install bundler"
# Install all other gems needed from Gemfile
run "#{@rvm} exec bundle install"