Class: Itamae::Plugin::Resource::RvmGet

Inherits:
Resource::Base
  • Object
show all
Defined in:
lib/itamae/plugin/resource/rvm_get.rb

Constant Summary collapse

DEFAULT_GPG_KEY =
'409B6B1796C275462A1703113804BB82D39DC0E3'

Instance Method Summary collapse

Instance Method Details

#action_install(options) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/itamae/plugin/resource/rvm_get.rb', line 38

def action_install(options)
  install_gpgkey! unless current.gpg_installed
  ::Itamae.logger.debug "GPG-Key(#{attributes.gpg_key}) was installed."

  if current.installed
    if attributes.version && current.version != attributes.version.strip
      install!
      updated!
    end
  else
    install!
    updated!
  end
end

#pre_actionObject



9
10
11
12
13
14
15
# File 'lib/itamae/plugin/resource/rvm_get.rb', line 9

def pre_action
  case @current_action
  when :install
    attributes.gpg_installed = true
    attributes.version ||= 'latest'
  end
end

#set_current_attributesObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/itamae/plugin/resource/rvm_get.rb', line 17

def set_current_attributes
  current.gpg_installed = gpgkey_installed?
  ::Itamae.logger.debug "GPG-Key was #{"not " unless current.gpg_installed}installed."

  return true unless current.gpg_installed

  version = installed_rvm
  current.installed = !!version
  if version == attributes.version
    current.version = attributes.version.strip
  else
    current.version = version
  end

  if current.installed
    ::Itamae.logger.debug "Current RVM version: #{current.version}"
  else
    ::Itamae.logger.debug 'RVM was not installed.'
  end
end