class PoiseRuby::Resources::RubyExecute::Provider

The default provider for `ruby_execute`.

@see Resource @provides ruby_execute

Private Instance Methods

command() click to toggle source

Command to pass to shell_out.

@return [String, Array<String>]

# File lib/poise_ruby/resources/ruby_execute.rb, line 64
def command
  if new_resource.parent_bundle
    bundle_exec_command(new_resource.command, path: environment['PATH'])
  else
    if new_resource.command.is_a?(Array)
      [new_resource.ruby] + new_resource.command
    else
      "#{new_resource.ruby} #{new_resource.command}"
    end
  end
end
environment() click to toggle source

Environment variables to pass to shell_out.

@return [Hash]

# File lib/poise_ruby/resources/ruby_execute.rb, line 79
def environment
  Mash.new.tap do |environment|
    environment.update(new_resource.parent_ruby.ruby_environment) if new_resource.parent_ruby
    environment['BUNDLE_GEMFILE'] = new_resource.parent_bundle.gemfile_path if new_resource.parent_bundle
    environment.update(new_resource.environment) if new_resource.environment
  end
end