Module: AppTap::CLI::Helpers
Instance Method Summary collapse
- #app_config_path ⇒ Object
- #app_procfile_path ⇒ Object
- #brew_bin ⇒ Object
- #brew_command ⇒ Object
- #brew_dir ⇒ Object
- #brew_install_path ⇒ Object
- #brew_repo_url ⇒ Object
- #filter_config(service_name, config = nil, &block) ⇒ Object
- #load_config ⇒ Object
- #procfile_config_end_token ⇒ Object
- #procfile_config_start_token ⇒ Object
Instance Method Details
#app_config_path ⇒ Object
26 27 28 |
# File 'lib/apptap/cli/helpers.rb', line 26 def app_config_path File.join('config', 'apptap.yml') end |
#app_procfile_path ⇒ Object
14 15 16 |
# File 'lib/apptap/cli/helpers.rb', line 14 def app_procfile_path 'Procfile.dev' end |
#brew_bin ⇒ Object
34 35 36 |
# File 'lib/apptap/cli/helpers.rb', line 34 def brew_bin File.join(brew_install_path, 'bin') end |
#brew_command ⇒ Object
38 39 40 |
# File 'lib/apptap/cli/helpers.rb', line 38 def brew_command File.join(brew_bin, 'brew') end |
#brew_dir ⇒ Object
6 7 8 |
# File 'lib/apptap/cli/helpers.rb', line 6 def brew_dir '.brew' end |
#brew_install_path ⇒ Object
30 31 32 |
# File 'lib/apptap/cli/helpers.rb', line 30 def brew_install_path File.join(destination_root, brew_dir) end |
#brew_repo_url ⇒ Object
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_config ⇒ Object
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_token ⇒ Object
22 23 24 |
# File 'lib/apptap/cli/helpers.rb', line 22 def procfile_config_end_token '## END: AppTap Processes' end |
#procfile_config_start_token ⇒ Object
18 19 20 |
# File 'lib/apptap/cli/helpers.rb', line 18 def procfile_config_start_token '## START: AppTap Processes' end |