Module: Capistrano::FigaroYml::Helpers
- Defined in:
- lib/capistrano/figaro_yml/helpers.rb
Instance Method Summary collapse
- #check_config_present_error ⇒ Object
- #check_figaro_file_exists_error ⇒ Object
-
#check_git_tracking_error ⇒ Object
error helpers.
- #figaro_yml_content ⇒ Object
- #figaro_yml_env ⇒ Object
- #local_figaro_yml(env) ⇒ Object
Instance Method Details
#check_config_present_error ⇒ Object
45 46 47 48 49 50 |
# File 'lib/capistrano/figaro_yml/helpers.rb', line 45 def check_config_present_error puts puts "Error - '#{figaro_yml_env}' config not present in '#{fetch(:figaro_yml_local_path)}'." puts "Please populate it." puts end |
#check_figaro_file_exists_error ⇒ Object
52 53 54 55 56 |
# File 'lib/capistrano/figaro_yml/helpers.rb', line 52 def check_figaro_file_exists_error puts puts "Error - '#{fetch(:figaro_yml_local_path)}' file does not exists, and it's required." puts end |
#check_git_tracking_error ⇒ Object
error helpers
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/capistrano/figaro_yml/helpers.rb', line 33 def check_git_tracking_error puts puts "Error - please remove '#{fetch(:figaro_yml_local_path)}' from git:" puts puts " $ git rm --cached #{fetch(:figaro_yml_local_path)}" puts puts "and gitignore it:" puts puts " $ echo '#{fetch(:figaro_yml_local_path)}' >> .gitignore" puts end |
#figaro_yml_content ⇒ Object
27 28 29 |
# File 'lib/capistrano/figaro_yml/helpers.rb', line 27 def figaro_yml_content local_figaro_yml(figaro_yml_env).to_yaml end |
#figaro_yml_env ⇒ Object
23 24 25 |
# File 'lib/capistrano/figaro_yml/helpers.rb', line 23 def figaro_yml_env fetch(:figaro_yml_env).to_s end |
#local_figaro_yml(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/capistrano/figaro_yml/helpers.rb', line 7 def local_figaro_yml(env) @local_figaro_yml ||= YAML.load(ERB.new(File.read(figaro_yml_local_path)).result) local_figaro = {} deployment_env = fetch(:rails_env, env).to_s @local_figaro_yml.each do |key, value| if key == env local_figaro[deployment_env] = @local_figaro_yml[key] elsif !value.is_a?(Hash) local_figaro[key] = @local_figaro_yml[key] end end local_figaro end |