Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use git to download and install chruby #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
default['chruby']['version'] = '0.3.4'
default['chruby']['version'] = '0.3.8'
default['chruby']['git_url'] = 'https://github.com/postmodern/chruby.git'
default['chruby']['gpg_check'] = false
default['chruby']['use_rvm_rubies'] = false
default['chruby']['use_rbenv_rubies'] = false
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
description "Installs/Configures chruby"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.2.1"
depends "ark"
depends "git"
depends "ruby_build"
supports "centos"
supports "ubuntu"
18 changes: 11 additions & 7 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

include_recipe "ark"
repo_path = "#{Chef::Config["file_cache_path"]}/chruby"
execute "Install chruby" do
cwd repo_path
command %{sudo make install}

ark "chruby" do
url "https://github.com/postmodern/chruby/archive/v#{node['chruby']['version']}.tar.gz"
action :install_with_make
action :nothing
end

# Workaround for Github issue 5 https://github.com/Atalanta/chef-chruby/issues/5
git repo_path do
repository node["chruby"]["git_url"]
reference "v#{node["chruby"]["version"]}"

link "/usr/local/chruby" do
to "/usr/local/chruby-1"
action :sync

notifies :run, resources(execute: "Install chruby"), :immediately
end

sh_owner = node['chruby']['sh_owner']
Expand Down
5 changes: 2 additions & 3 deletions templates/default/chruby.sh.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source /usr/local/chruby/share/chruby/chruby.sh
source /usr/local/share/chruby/chruby.sh

<% if ::File.exists?("/opt/chef/embedded") -%>
RUBIES+=(/opt/chef/embedded)
Expand All @@ -22,5 +22,4 @@ chruby embedded
chruby <%= node['chruby']['default'] %>
<% end -%>

<%= node['chruby']['auto_switch'] && "source /usr/local/chruby/share/chruby/auto.sh" %>

<%= node['chruby']['auto_switch'] && "source /usr/local/share/chruby/auto.sh" %>