Sha256: f08ecf3065d7a9e30806d936335283f03ce96864d68c9cd5289e2704d9e1e65d

Contents?: true

Size: 1.84 KB

Versions: 11

Compression:

Stored size: 1.84 KB

Contents

#
# 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.
#

# thanks to:
# - http://www.agileweboperations.com/chef-rvm-ruby-enterprise-edition-as-default-ruby/
# - http://github.com/denimboy/xprdev/blob/master/rvm/recipes/default.rb

script_flags = ""
if node['rvm']['version']
  script_flags += " --version #{node['rvm']['version']}"
end
if node['rvm']['branch']
  script_flags += " --branch #{node['rvm']['branch']}"
end

upgrade_strategy = if node['rvm']['upgrade'].nil? || node['rvm']['upgrade'] == false
  "none"
else
  node['rvm']['upgrade']
end

pkgs = %w{ sed grep tar gzip bzip2 bash curl }
case node[:platform]
  when "centos","redhat","fedora"
    pkgs << "git"
  when "debian","ubuntu","suse"
    pkgs << "git-core"
end

pkgs.each do |pkg|
  package pkg
end

execute "install system-wide RVM" do
  user      "root"
  command   <<-CODE
    bash -c "bash <( curl -Ls #{node['rvm']['installer_url']} )#{script_flags}"
  CODE
  not_if    rvm_wrap_cmd(%{type rvm | head -1 | grep -q '^rvm is a function$'})
end

template  "/etc/rvmrc" do
  source  "rvmrc.erb"
  owner   "root"
  group   "rvm"
  mode    "0644"
end

execute "upgrade RVM to #{upgrade_strategy}" do
  user      "root"
  command   rvm_wrap_cmd(%{rvm get #{upgrade_strategy}})
  only_if   { %w{ latest head }.include? upgrade_strategy }
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
flombe-0.1.0.12 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.11 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.10 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.9 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.8 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.7 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.6 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.5 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.4 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.3 cookbooks/rvm/recipes/system.rb
flombe-0.1.0.2 cookbooks/rvm/recipes/system.rb