Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created July 7, 2010 18:59
Show Gist options
  • Select an option

  • Save adamhjk/467100 to your computer and use it in GitHub Desktop.

Select an option

Save adamhjk/467100 to your computer and use it in GitHub Desktop.
define :localgem, :version => nil do
script "install_#{params[:name]}_local_#{params[:version]}" do
interpreter "bash"
user "root"
code <<-EOH
export GEM_HOME=/srv/localgems
export GEM_PATH=/srv/localgems
export PATH="/srv/localgems/bin:$PATH"
gem install #{params[:name]} #{params[:version].nil? ? '' : "--version #{params[:version]}" } --no-rdoc --no-ri
EOH
not_if do
to_check = params[:version] ? "#{params[:name]}-#{params[:version]}" : "#{params[:name]}-\\d"
Dir["/srv/localgems/gems/*"].find { |d| d =~ /#{to_check}/ }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment