Class: Sunshine::Gem
- Inherits:
-
Dependency
- Object
- Dependency
- Sunshine::Gem
- Defined in:
- lib/sunshine/package_managers/gem.rb
Overview
The Gem dependency class supports most of rubygem’s installation features:
dependency_lib.instance_eval do
gem "rdoc", :version => '~>0.8',
:source => 'http://gemcutter.org',
:opts => '--use-lib blah' # Anything after --
end
See the Dependency class for more info.
Instance Attribute Summary
Attributes inherited from Dependency
#children, #name, #parents, #pkg
Instance Method Summary collapse
-
#initialize(name, options = {}, &block) ⇒ Gem
constructor
A new instance of Gem.
Methods inherited from Dependency
#add_child, #check, #check_test, #child_dependencies, #install, #install!, #install_parents!, #installed?, #missing_parents?, #parent_dependencies, #requires, sudo, sudo=, system_manager?, #to_s, #uninstall, #uninstall!, #uninstall_children!
Constructor Details
#initialize(name, options = {}, &block) ⇒ Gem
Returns a new instance of Gem.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sunshine/package_managers/gem.rb', line 19 def initialize(name, ={}, &block) super(name, ) do version = [:version] ? " --version '#{[:version]}'" : "" source = if [:source] " --source #{[:source]} --source http://gemcutter.org" end install_opts = " --no-ri --no-rdoc" if [:opts] install_opts = "#{install_opts} -- #{[:opts]}" end install "gem install #{@pkg}#{version}#{source}#{install_opts}" uninstall "gem uninstall #{@pkg}#{version}" check "gem list #{@pkg} -i#{version}" requires(*[:require].to_a) if [:require] instance_eval(&block) if block_given? end end |