Module: AppTap::CLI::Helpers

Included in:
Foreman, Init, Install
Defined in:
lib/apptap/cli/helpers.rb

Instance Method Summary collapse

Instance Method Details

#app_config_pathObject



26
27
28
# File 'lib/apptap/cli/helpers.rb', line 26

def app_config_path
  File.join('config', 'apptap.yml')
end

#app_procfile_pathObject



14
15
16
# File 'lib/apptap/cli/helpers.rb', line 14

def app_procfile_path
  'Procfile.dev'
end

#brew_binObject



34
35
36
# File 'lib/apptap/cli/helpers.rb', line 34

def brew_bin
  File.join(brew_install_path, 'bin')
end

#brew_commandObject



38
39
40
# File 'lib/apptap/cli/helpers.rb', line 38

def brew_command
  File.join(brew_bin, 'brew')
end

#brew_dirObject



6
7
8
# File 'lib/apptap/cli/helpers.rb', line 6

def brew_dir
  '.brew'
end

#brew_install_pathObject



30
31
32
# File 'lib/apptap/cli/helpers.rb', line 30

def brew_install_path
  File.join(destination_root, brew_dir)
end

#brew_repo_urlObject



10
11
12
# File 'lib/apptap/cli/helpers.rb', line 10

def brew_repo_url
  'https://github.com/mxcl/homebrew.git'
end

#filter_config(service_name, config = nil, &block) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/apptap/cli/helpers.rb', line 46

def filter_config(service_name, config = nil, &block)
  config ||= self.load_config
  filtered_config = config
  if service_name && service_name.length > 0
    unless config.keys.include?(service_name)
      say_status 'error', "Unable to find a service called '#{service_name}'!", :red
    end
    filtered_config = config.select { |config_name| config_name == service_name } 
  end

  if block_given?
    filtered_config.each do |name, service_config|
      yield(name, service_config)
    end
  end

  filtered_config
end

#load_configObject



42
43
44
# File 'lib/apptap/cli/helpers.rb', line 42

def load_config
  YAML.load_file(File.join(destination_root, app_config_path))
end

#procfile_config_end_tokenObject



22
23
24
# File 'lib/apptap/cli/helpers.rb', line 22

def procfile_config_end_token
  '## END: AppTap Processes'
end

#procfile_config_start_tokenObject



18
19
20
# File 'lib/apptap/cli/helpers.rb', line 18

def procfile_config_start_token
  '## START: AppTap Processes'
end