Skip to content

Instantly share code, notes, and snippets.

@ryansch
Created April 14, 2011 23:26
Show Gist options
  • Select an option

  • Save ryansch/920825 to your computer and use it in GitHub Desktop.

Select an option

Save ryansch/920825 to your computer and use it in GitHub Desktop.
require 'rubygems/format'
define :rvm_cookbook_gem, :action => :install do
remote_file params[:name] do
action :create_if_missing
backup false
end
ruby_block "Load gemspec and install gem" do
block do
gemspec = Gem::Format.from_file_by_path(params[:name]).spec
p = Chef::Resource::GemPackage.new(gemspec.name, collection, node)
p.source "file://#{params[:name]}"
p.version gemspec.version.version
p.gem_binary "rvm $(rvm alias show default) gem"
p.run_action(params[:action])
end
end
file params[:name] do
action :delete
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment