Class: Itamae::Plugin::Resource::RvmGemPackage

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

Instance Method Summary collapse

Instance Method Details

#org_run_commandObject



5
# File 'lib/itamae/plugin/resource/rvm_gem_package.rb', line 5

alias_method :org_run_command, :run_command

#run_command(cmd, option = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/itamae/plugin/resource/rvm_gem_package.rb', line 7

def run_command(cmd,option={})
  unless current.rvm_shell
    org_run_command('/bin/bash --login -c "which rvm-shell"', error: false)
      .stdout.strip.each_line do |line|
        current.rvm_shell = line
    end
  end

  ::Itamae.logger.debug "current.rvm_shell: #{current.rvm_shell}"

  command = "#{current.rvm_shell} #{attributes.rvm_use} -c '#{cmd.is_a?(Array) ? cmd.join(' ') : cmd}'"
  super(command, option)
end