Class: Resource::Gem
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Gem
constructor
A new instance of Gem.
- #run ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
Constructor Details
#initialize(name, &block) ⇒ Gem
Returns a new instance of Gem.
7 8 9 10 11 12 |
# File 'lib/resource/gem.rb', line 7 def initialize name, &block set_base_defaults @owner = 'root' @name = name self.instance_eval(&block) end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/resource/gem.rb', line 14 def run command = [] command << "gem install #{@name}" command << "--source #{@source}" if @source command << "--version #{@version}" if @version Execution.block 'Installing gem', @name, @owner do |b| b.always_run @always_run b.run(command * ' ') end end |