class Kleiber::Project

Provides api to control such project @author Кирилл Бобыкин <qelphybox@gmail.com>

Constants

VARS

Attributes

guest_port[R]
host[R]
host_port[R]
name[R]
path[R]
prefix[R]

Public Class Methods

new(settings) click to toggle source
# File lib/kleiber/project.rb, line 9
def initialize(settings)
  @name       = settings[:name]
  @prefix     = settings[:prefix]
  @path       = settings[:path]
  @guest_port = settings[:guest_port]
  @host_port  = settings[:host_port]
  @host       = settings[:host]
  @tasks      = settings[:tasks]
  @env        = settings[:env]
end

Public Instance Methods

command_with(command, params) click to toggle source

Returns command with option to run @param [Hash] params params need run with @return [String] command line

# File lib/kleiber/project.rb, line 50
def command_with(command, params)
  ["cd #{path}", send("handle_#{command}", params)].join(' && ')
end
env() click to toggle source
# File lib/kleiber/project.rb, line 25
def env
  @env || {}
end
environment() click to toggle source

Return env variables of this project @return [Hash]

# File lib/kleiber/project.rb, line 35
def environment
  @env_vars ||= VARS.reduce({}) do |hash, (key, value)|
    hash.merge("#{prefix}_#{value}" => send(key))
  end.merge(env)
end
tasks() click to toggle source
# File lib/kleiber/project.rb, line 29
def tasks
  @tasks || {}
end