module Albacore::CmdConfig

Use on configuration objects that are command-oriented.

a mixin that adds a couple of field writers and readers. specifically, allows the configuration to have a work_dir and exe field and defined a method that joins paths relative to the work_dir

Public Instance Methods

add_parameter(param) click to toggle source

add a parameter to the list of parameters to pass to the executable

# File lib/albacore/cmd_config.rb, line 38
def add_parameter param
  parameters.add param
end
parameters() click to toggle source

returns a Set with parameters

# File lib/albacore/cmd_config.rb, line 33
def parameters
  @parameters ||= Set.new
end

Private Instance Methods

in_work_dir() { || ... } click to toggle source

helper method that changes directory to the work directory and then yields to the block

# File lib/albacore/cmd_config.rb, line 53
def in_work_dir
  unless @work_dir.nil?
    Dir.chdir @work_dir do
      trace "in work dir '#{@work_dir}'"
      yield
    end
  else
    trace "not in work dir, because it is nil."
    yield
  end
end
join(*segments) click to toggle source

helper method that joins the path segments with respect to the work_dir.

# File lib/albacore/cmd_config.rb, line 45
def join *segments
  segments ||= []
  segments.unshift work_dir
  File.join segments
end