Class: Itamae::Plugin::Resource::RvmGemsetCreate

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

Instance Method Summary collapse

Instance Method Details

#action_create(options) ⇒ Object



22
23
24
25
26
# File 'lib/itamae/plugin/resource/rvm_gemset_create.rb', line 22

def action_create(options)
  command = "#{current.rvm_shell} #{attributes.ruby_version} -c 'rvm gemset create #{attributes.gemset_name}'"
  run_command(command)
  updated!
end

#pre_actionObject



7
8
9
10
11
12
# File 'lib/itamae/plugin/resource/rvm_gemset_create.rb', line 7

def pre_action
  case @current_action
  when :create
    attributes.executed = true
  end
end

#set_current_attributesObject



14
15
16
17
18
19
20
# File 'lib/itamae/plugin/resource/rvm_gemset_create.rb', line 14

def set_current_attributes
  current.executed = false
  run_command('/bin/bash --login -c "which rvm-shell"', error: false)
    .stdout.strip.each_line do |line|
      current.rvm_shell = line
  end
end