-
-
Save anonymous/3dc9e0d3413dfb973a1e to your computer and use it in GitHub Desktop.
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
# | |
# Cookbook Name:: Toppan Forms Linux Apache Mod Ruby server | |
# Recipe:: ruby | |
# | |
# Copyright (C) 2013 Toppan forms | |
# | |
# All rights reserved - Do Not Redistribute | |
# | |
ruby_version = node['ruby']['version'] # Ruby major version (e.g.e 1.8.7 or 1.9.3) | |
ruby_patch_level = node['ruby']['patch_level'] # Ruby Patch level (e.g. p193 rc1) | |
ruby_install_version = "#{ruby_version}-#{ruby_patch_level}" | |
executable_path = File.join(node['ruby_build']['default_ruby_base_path'], ruby_install_version, 'bin') | |
ruby_build_ruby "Build #{ruby_install_version}" do | |
definition ruby_install_version | |
action :install | |
end | |
commands = %w{erb gem irb rake rdoc ri ruby testrb}.inject("") do |string, binary| | |
string << "ln -fs #{File.join(executable_path, binary)} /usr/local/bin/#{binary}; " | |
string << "ln -fs /usr/local/bin/#{binary} /usr/bin/#{binary}; " | |
end | |
bash "Symlink ruby executables" do | |
code commands | |
action :nothing | |
subscribes :run, resources("ruby_build_ruby[Build #{ruby_install_version}]"), :immediately | |
notifies :reload, "ohai[reload]", :immediately | |
end | |
ohai "reload" do | |
action :nothing | |
notifies :create, "ruby_block[reload_ruby_for_passenger]", :immediately | |
end | |
# Hack until https://github.com/opscode-cookbooks/passenger_apache2/pull/11 is merged | |
ruby_block "reload_ruby_for_passenger" do | |
block do | |
node.load_attribute_by_short_filename('default', 'passenger_apache2') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment