Commit a12f708

mo khan <mo@mokhan.ca>
2015-05-23 01:09:54
install ruby with rbenv and community cookbooks.
1 parent d01508f
attributes/default.rb
@@ -55,7 +55,11 @@ default['unicorn']['username'] = node['user']['username']
 default['unicorn']['current_path'] = "#{node['capistrano']['root_path']}/current"
 default['unicorn']['rails_env'] = node.chef_environment
 default['monit']['application'] = 'app'
-default['rbenv']['ruby_version'] = '2.2.2'
+#default['rbenv']['ruby_version'] = '2.2.2'
+default['rbenv']['rubies'] = [ "2.2.2" ]
+default['rbenv']['plugins'] = [
+  { 'name' => 'rbenv-gem-rehash', 'git_url' => 'https://github.com/sstephenson/rbenv-gem-rehash.git' }
+]
 default['aws']['username'] = node['user']['username']
 default['aws']['profiles']['default']['region'] = 'us-east-1'
 default['aws']['profiles']['default']['aws_access_key_id'] = 'secret'
recipes/rbenv.rb
@@ -1,40 +1,43 @@
-include_recipe "apt"
-configuration = node['rbenv']
+include_recipe "ruby_build::default"
+include_recipe "rbenv::system"
 
-items = [ "build-essential", "tklib", "zlib1g-dev", "libssl-dev", "libreadline-gplv2-dev", "libxml2", "libxml2-dev", "libxslt1-dev" ]
-items.each do |item|
-  package item do
-    action :upgrade
-  end
-end
+#include_recipe "apt"
+#configuration = node['rbenv']
 
-git "/usr/local/rbenv" do
-  repository "git://github.com/sstephenson/rbenv.git"
-  reference "master"
-  action :sync
-end
+#items = [ "build-essential", "tklib", "zlib1g-dev", "libssl-dev", "libreadline-gplv2-dev", "libxml2", "libxml2-dev", "libxslt1-dev" ]
+#items.each do |item|
+  #package item do
+    #action :upgrade
+  #end
+#end
 
-directory "/usr/local/rbenv/plugins" do
-  action :create
-end
+#git "/usr/local/rbenv" do
+  #repository "git://github.com/sstephenson/rbenv.git"
+  #reference "master"
+  #action :sync
+#end
 
-git "/usr/local/rbenv/plugins/ruby-build" do
-  repository "git://github.com/sstephenson/ruby-build.git"
-  reference "master"
-  action :sync
-end
+#directory "/usr/local/rbenv/plugins" do
+  #action :create
+#end
 
-template "/etc/skel/.bashrc" do
-  source "bashrc.erb"
-end
+#git "/usr/local/rbenv/plugins/ruby-build" do
+  #repository "git://github.com/sstephenson/ruby-build.git"
+  #reference "master"
+  #action :sync
+#end
 
-bash "install ruby #{configuration['ruby_version']}" do
-  code <<-SCRIPT
-  export PATH="/usr/local/rbenv/bin:$PATH"
-  eval "$(rbenv init -)"
-  rbenv install #{configuration['ruby_version']}
-  rbenv global #{configuration['ruby_version']}
-  gem install bundler --no-ri --no-rdoc
-  rbenv rehash
-  SCRIPT
-end
+#template "/etc/skel/.bashrc" do
+  #source "bashrc.erb"
+#end
+
+#bash "install ruby #{configuration['ruby_version']}" do
+  #code <<-SCRIPT
+  #export PATH="/usr/local/rbenv/bin:$PATH"
+  #eval "$(rbenv init -)"
+  #rbenv install #{configuration['ruby_version']}
+  #rbenv global #{configuration['ruby_version']}
+  #gem install bundler --no-ri --no-rdoc
+  #rbenv rehash
+  #SCRIPT
+#end
Berksfile
@@ -1,3 +1,5 @@
 source "https://api.berkshelf.com"
 
 metadata
+
+cookbook "rbenv", git: 'git://github.com/fnichol/chef-rbenv.git'
Berksfile.lock
@@ -2,6 +2,9 @@ DEPENDENCIES
   mokhan-myface
     path: .
     metadata: true
+  rbenv
+    git: git://github.com/fnichol/chef-rbenv.git
+    revision: 0a3018634bafe58ad21c6ee271af015220e444b9
 
 GRAPH
   apt (2.7.0)
@@ -9,14 +12,21 @@ GRAPH
   chef-sugar (3.1.0)
   database (4.0.6)
     postgresql (>= 1.0.0)
+  java (1.31.0)
   mokhan-myface (0.1.0)
     apt (>= 0.0.0)
     build-essential (>= 0.0.0)
     database (>= 0.0.0)
     postgresql (>= 0.0.0)
+    rbenv (>= 0.0.0)
+    ruby_build (>= 0.0.0)
   openssl (4.0.0)
     chef-sugar (>= 0.0.0)
   postgresql (3.4.18)
     apt (>= 1.9.0)
     build-essential (>= 0.0.0)
     openssl (~> 4.0.0)
+  rbenv (0.7.3)
+    java (> 1.4.0)
+    ruby_build (>= 0.0.0)
+  ruby_build (0.8.0)
metadata.rb
@@ -10,3 +10,5 @@ depends "apt"
 depends "build-essential"
 depends "database"
 depends "postgresql"
+depends "ruby_build"
+depends "rbenv"