class EC2Launcher::InstancePathsConfig

Holds data about paths to various executables on instances.

Attributes

chef_path[R]
gem_path[R]
knife_path[R]
ruby_path[R]

Public Class Methods

new(environment) click to toggle source
# File lib/ec2launcher/instance_paths_config.rb, line 9
def initialize(environment)
  @gem_path = build_path(environment.gem_path, "gem", "gem")
  @ruby_path = build_path(environment.ruby_path, "ruby", "ruby")
  @chef_path = build_path(environment.chef_path, "chef-client", "chef-client")
  @knife_path = build_path(environment.knife_path, "knife", "knife")
end

Private Instance Methods

build_path(instance_path, executable, default_path) click to toggle source

Builds the path to an executable.

# File lib/ec2launcher/instance_paths_config.rb, line 19
def build_path(instance_path, executable, default_path)
  app_path = default_path
  unless instance_path.nil?
    if instance_path =~ /#{executable}$/
      app_path = instance_path
    else
      app_path = File.join(instance_path, executable)
    end
  end
  app_path
end