-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactoring of recipes which will result in a minor version bump.
There are now 2 main modes in which to use RVM: isolated as a user or system-wide. * recipe[rvm] - pulls in the RVM gem and initializes Chef to use the LWRPs which is a breaking change to previous behavior. Use this recipe if you only want access to the LWRPs provided. * recipe[rvm::system_install] - only installs RVM framework system-wide. Use this recipe by itself if you want RVM installed but will handle rubies yourself (by hand, with the LWRPs, etc.) * recipe[rvm::system] - installs RVM system-wide and installs rubies, gems, etc. Use this recipe to get the same functionality previously availble by including recipe[rvm]. * recipe[rvm:user_install] - installs the RVM framwork for one or more isolated users. Use this recipe if you want to handle rubies yourself. * recipe[rvm::user] - installs RVM for one or more isolated users and installs rubies, gems, etc. This is equivalent to recipe[rvm::system], but for user installs.
- Loading branch information
Showing
7 changed files
with
236 additions
and
56 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Recipe:: system | ||
# | ||
# Copyright 2010, 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::system_install" | ||
|
||
install_rubies = node['rvm']['install_rubies'] == true || | ||
node['rvm']['install_rubies'] == "true" | ||
|
||
if install_rubies | ||
# install additional rubies | ||
node['rvm']['rubies'].each do |rubie| | ||
rvm_ruby rubie | ||
end | ||
|
||
# set a default ruby | ||
rvm_default_ruby node['rvm']['default_ruby'] | ||
|
||
# install global gems | ||
node['rvm']['global_gems'].each do |gem| | ||
rvm_global_gem gem[:name] do | ||
version gem[:version] if gem[:version] | ||
action gem[:action] if gem[:action] | ||
options gem[:options] if gem[:options] | ||
source gem[:source] if gem[:source] | ||
end | ||
end | ||
|
||
# install additional gems | ||
node['rvm']['gems'].each_pair do |rstring, gems| | ||
rvm_environment rstring | ||
|
||
gems.each do |gem| | ||
rvm_gem gem[:name] do | ||
ruby_string rstring | ||
version gem[:version] if gem[:version] | ||
action gem[:action] if gem[:action] | ||
options gem[:options] if gem[:options] | ||
source gem[:source] if gem[:source] | ||
end | ||
end | ||
end | ||
end | ||
|
||
# add users to rvm group | ||
if node['rvm']['group_users'].any? | ||
group 'rvm' do | ||
members node['rvm']['group_users'] | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Recipe:: system_install | ||
# | ||
# Copyright 2010, 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' | ||
|
||
script_flags = build_script_flags(node['rvm']['version'], node['rvm']['branch']) | ||
upgrade_strategy = build_upgrade_strategy(node['rvm']['upgrade']) | ||
installer_url = node['rvm']['installer_url'] | ||
rvm_prefix = ::File.dirname(node['rvm']['root_path']) | ||
rvm_gem_options = node['rvm']['rvm_gem_options'] | ||
rvmrc = node['rvm']['rvmrc'] | ||
|
||
install_pkg_prereqs | ||
|
||
# Build the rvm group ahead of time, if it is set. This allows avoiding | ||
# collision with later processes which may set a guid explicitly | ||
if node['rvm']['group_id'] != 'default' | ||
g = group 'rvm' do | ||
group_name 'rvm' | ||
gid node['rvm']['group_id'] | ||
action :nothing | ||
end | ||
g.run_action(:create) | ||
end | ||
|
||
rvmrc_template :rvm_prefix => rvm_prefix, | ||
:rvm_gem_options => rvm_gem_options, | ||
:rvmrc => rvmrc, | ||
:rvmrc_file => "/etc/rvmrc" | ||
|
||
install_rvm :rvm_prefix => rvm_prefix, | ||
:installer_url => installer_url, | ||
:script_flags => script_flags | ||
|
||
upgrade_rvm :rvm_prefix => rvm_prefix, | ||
:upgrade_strategy => upgrade_strategy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Recipe:: user | ||
# | ||
# 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::user_install' | ||
|
||
node['rvm']['user_installs'].each do |rvm_user| | ||
perform_install_rubies = rvm_user['install_rubies'] == true || | ||
rvm_user['install_rubies'] == "true" || | ||
node['rvm']['user_install_rubies'] == true || | ||
node['rvm']['user_install_rubies'] == "true" | ||
rubies = rvm_user['rubies'] || | ||
node['rvm']['user_rubies'] | ||
default_ruby = rvm_user['default_ruby'] || | ||
node['rvm']['user_default_ruby'] | ||
global_gems = rvm_user['global_gems'] || | ||
node['rvm']['user_global_gems'] | ||
gems = rvm_user['gems'] || | ||
node['rvm']['user_gems'] | ||
|
||
if perform_install_rubies | ||
install_rubies :rubies => rubies, | ||
:default_ruby => default_ruby, | ||
:global_gems => global_gems, | ||
:gems => gems, | ||
:user => rvm_user['user'] | ||
end | ||
end |
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