class ForemanDebian::Command::Install

Public Instance Methods

decode_concurrency(concurrency_encoded) click to toggle source
# File lib/foreman_debian/command/install.rb, line 51
def decode_concurrency(concurrency_encoded)
  concurrency_hash = {}
  concurrency_encoded.split(',').each do |entry|
    parts = entry.split('=')
    raise 'Invalid concurrency option' unless parts.size == 2
    name, concurrency = parts
    concurrency_hash[name] = concurrency.to_i
  end
  concurrency_hash
end
dir_root() click to toggle source

@return [Pathname]

# File lib/foreman_debian/command/install.rb, line 47
def dir_root
  Pathname.new(working_dir)
end
execute() click to toggle source
# File lib/foreman_debian/command/install.rb, line 19
def execute
  jobs = {}
  procfile.entries do |name, command|
    jobs[name] = expand_procfile_command(command)
  end
  concurrency = decode_concurrency(concurrency_encoded)
  get_engine.install(jobs, concurrency, user)
end
expand_procfile_command(command) click to toggle source
# File lib/foreman_debian/command/install.rb, line 28
def expand_procfile_command(command)
  args = Shellwords.split(command)
  args[0] = Pathname.new(args[0]).expand_path(dir_root).to_s
  Shellwords.join(args)
end
procfile() click to toggle source

@return [Foreman::Procfile]

# File lib/foreman_debian/command/install.rb, line 41
def procfile
  raise "Procfile `#{procfile_path.to_s}` does not exist" unless procfile_path.file?
  Foreman::Procfile.new(procfile_path)
end
procfile_path() click to toggle source

@return [Pathname]

# File lib/foreman_debian/command/install.rb, line 35
def procfile_path
  path_relative = procfile_path_relative || "#{working_dir}/Procfile"
  Pathname.new(path_relative).expand_path(Dir.getwd)
end