Permalink
Browse files

add rvm cookbook

  • Loading branch information...
1 parent d52398e commit 160434aaf2662e2af0a0e4dcbcf9cc8d21d00775 @bleything committed May 4, 2012
View
@@ -50,6 +50,12 @@
]
},
+ "rvm": {
+ "rubies": [
+ "1.9.3"
+ ],
+ },
+
"resolvers": {
"example.com": [
"8.8.8.8",
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
@@ -0,0 +1,2 @@
+default.rvm.rubies = [ '1.9.3' ]
+default.rvm.default_ruby = nil
@@ -0,0 +1,2 @@
+### set up rvm
+if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi
@@ -0,0 +1,6 @@
+maintainer "Ben Bleything"
+maintainer_email "ben@bleything.net"
+license "Apache 2.0"
+description "Installs/Configures rvm"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.1"
@@ -0,0 +1,37 @@
+#
+# Cookbook Name:: rvm
+# Recipe:: default
+#
+# Copyright 2012, Ben Bleything <ben@bleything.net>
+#
+# 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.
+#
+
+remote_file "/tmp/rvm-installer" do
+ source "http://get.rvm.io"
+ not_if { ::File.directory? "#{ENV['HOME']}/.rvm" }
+end
+
+execute "rvm-installer" do
+ command "bash -s master < /tmp/rvm-installer"
+ not_if { ::File.directory? "#{ENV['HOME']}/.rvm" }
+end
+
+file "#{ENV['HOME']}/.rvm/gemsets/global.gems" do
+ content "bundler\n"
+end
+
+directory "#{ENV['HOME']}/.bash.d"
+cookbook_file "#{ENV['HOME']}/.bash.d/rvm" do
+ not_if { ::File.exists? "#{ENV['HOME']}/.bash.d/rvm" }
+end
@@ -0,0 +1,31 @@
+#
+# Cookbook Name:: rvm
+# Recipe:: rubies
+#
+# Copyright 2012, Ben Bleything <ben@bleything.net>
+#
+# 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::default'
+include_recipe 'apps::gcc' # need to get an unbroken gcc
+
+node.rvm.rubies.each do |ruby|
+ execute "rvm install #{ruby}" do
+ environment "CC" => "/usr/local/bin/gcc-4.2",
+ "CXX" => "/usr/local/bin/g++-4.2"
+
+ command "#{ENV['HOME']}/.rvm/bin/rvm install #{ruby}"
+ not_if "#{ENV['HOME']}/.rvm/bin/rvm list | grep #{ruby}"
+ end
+end

0 comments on commit 160434a

Please sign in to comment.