diff --git a/attributes/default.rb b/attributes/default.rb index 6f751ba..f2eee0c 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -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 diff --git a/metadata.rb b/metadata.rb index dbc83b2..89e15a2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -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" diff --git a/recipes/default.rb b/recipes/default.rb index 24ab8d7..9e141ac 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -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'] diff --git a/templates/default/chruby.sh.erb b/templates/default/chruby.sh.erb index 3447461..4a6cffb 100644 --- a/templates/default/chruby.sh.erb +++ b/templates/default/chruby.sh.erb @@ -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) @@ -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" %>