diff --git a/Berksfile b/Berksfile index ea5adf5..ea6efd0 100644 --- a/Berksfile +++ b/Berksfile @@ -6,3 +6,5 @@ group :integration do cookbook 'apt' cookbook 'test', :path => 'test/cookbooks/test' end + +cookbook 'rbenv', github: "optiflows-cookbooks/rbenv" diff --git a/attributes/ruby.rb b/attributes/ruby.rb new file mode 100644 index 0000000..1319e35 --- /dev/null +++ b/attributes/ruby.rb @@ -0,0 +1 @@ +default['razor']['ruby_ver'] = "1.9.3-p448" diff --git a/metadata.rb b/metadata.rb index 3707d89..e4687d3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -15,3 +15,4 @@ depends "postgresql" depends "database" depends "nodejs" +depends "rbenv" diff --git a/recipes/_app.rb b/recipes/_app.rb index 8757075..38f3a3c 100644 --- a/recipes/_app.rb +++ b/recipes/_app.rb @@ -41,7 +41,9 @@ notifies :restart, "service[razor]" end -execute "#{bundle_cmd} install --without test" do +rbenv_execute "Install razor" do + command "bundle install --without test && rbenv rehash" + ruby_version node['razor']['ruby_ver'] cwd install_path end @@ -63,7 +65,7 @@ }) end -template ::File.join(install_path, %w[conf razor_server.conf]) do +template ::File.join(install_path, "conf", "razor_server.conf") do source "razor_server.conf.erb" mode "0755" variables({ diff --git a/recipes/_rbenv.rb b/recipes/_rbenv.rb new file mode 100644 index 0000000..50762ff --- /dev/null +++ b/recipes/_rbenv.rb @@ -0,0 +1,30 @@ +# +# Cookbook Name:: razor +# Recipe:: _rbenv +# +# Author:: Fletcher Nichol () +# +# Copyright 2012, Blue Box Group, LLC +# +# 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 "rbenv::default" +include_recipe "rbenv::ruby_build" +include_recipe "rbenv::rbenv_bundler" + +rbenv_ruby node['razor']['ruby_ver'] + +rbenv_gem "bundler" do + ruby_version node['razor']['ruby_ver'] +end diff --git a/recipes/default.rb b/recipes/default.rb index 4112617..04788e0 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -27,6 +27,6 @@ include_recipe 'razor::_mongodb' include_recipe 'razor::_postgresql' include_recipe 'razor::_nodejs' -include_recipe 'razor::_ruby_from_package' +include_recipe "razor::_rbenv" include_recipe 'razor::_app' include_recipe 'razor::_add_images'