Module: Capricorn::Actors::BaseActor::Helper

Defined in:
lib/capricorn/actors/base_actor.rb

Instance Method Summary collapse

Instance Method Details

#ensure_presence_of_gem(name, options = {}) ⇒ Object

ensure the presence of a gem



189
190
191
192
193
# File 'lib/capricorn/actors/base_actor.rb', line 189

def ensure_presence_of_gem(name, options={})
  if !gem_installed(name, options)
    gem_install(name, options)
  end
end

#gem_install(name, options = {}) ⇒ Object

install a gem.



172
173
174
# File 'lib/capricorn/actors/base_actor.rb', line 172

def gem_install(name, options={})
  gem_cmd('install', name, options)
end

#gem_installed(name, options) ⇒ Object

check if a gem is installed



177
178
179
180
181
# File 'lib/capricorn/actors/base_actor.rb', line 177

def gem_installed(name, options)
  version = options[:version] || '0.0.0'
  options = { :version => version, :installed => true }
  (gem_cmd('list', name, options).strip == 'true')
end

#gem_update(name, options = {}) ⇒ Object

update a gem



184
185
186
# File 'lib/capricorn/actors/base_actor.rb', line 184

def gem_update(name, options={})
  !(gem_cmd('update', name, options) =~ /Nothing to update/)
end