/
user_install.rb
46 lines (40 loc) · 1.69 KB
/
user_install.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
38
39
40
41
42
43
44
45
46
#
# Cookbook Name:: rvm
# Recipe:: user_install
#
# Copyright 2011 Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe 'rvm'
install_pkg_prereqs
node['rvm']['user_installs'].each do |rvm_user|
script_flags = build_script_flags(rvm_user['version'], rvm_user['branch'])
upgrade_strategy = build_upgrade_strategy(rvm_user['upgrade'])
installer_url = rvm_user['installer_url'] || node['rvm']['installer_url']
rvm_prefix = rvm_user['home'] ||
"#{node['rvm']['user_home_root']}/#{rvm_user['user']}"
rvm_gem_options = rvm_user['rvm_gem_options'] || node['rvm']['rvm_gem_options']
rvmrc = rvm_user['rvmrc'] || Hash.new
rvmrc_template :rvm_prefix => rvm_prefix,
:rvm_gem_options => rvm_gem_options,
:rvmrc => rvmrc,
:user => rvm_user['user']
install_rvm :rvm_prefix => rvm_prefix,
:installer_url => installer_url,
:script_flags => script_flags,
:user => rvm_user['user']
upgrade_rvm :rvm_prefix => rvm_prefix,
:upgrade_strategy => upgrade_strategy,
:user => rvm_user['user']
end