Module: Capistrano::DatabaseYml::Helpers
- Defined in:
- lib/capistrano/database_yml/helpers.rb
Instance Method Summary collapse
- #check_config_present_error ⇒ Object
- #check_database_file_exists_error ⇒ Object
-
#check_git_tracking_error ⇒ Object
error helpers.
- #database_yml_content ⇒ Object
- #database_yml_env ⇒ Object
- #local_database_yml(env) ⇒ Object
Instance Method Details
#check_config_present_error ⇒ Object
34 35 36 37 38 39 |
# File 'lib/capistrano/database_yml/helpers.rb', line 34 def check_config_present_error puts puts "Error - '#{database_yml_env}' config not present in '#{fetch(:database_yml_local_path)}'." puts "Please populate it." puts end |
#check_database_file_exists_error ⇒ Object
41 42 43 44 45 |
# File 'lib/capistrano/database_yml/helpers.rb', line 41 def check_database_file_exists_error puts puts "Error - '#{fetch(:database_yml_local_path)}' file does not exists, and it's required." puts end |
#check_git_tracking_error ⇒ Object
error helpers
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/capistrano/database_yml/helpers.rb', line 22 def check_git_tracking_error puts puts "Error - please remove '#{fetch(:database_yml_local_path)}' from git:" puts puts " $ git rm --cached #{fetch(:database_yml_local_path)}" puts puts "and gitignore it:" puts puts " $ echo '#{fetch(:database_yml_local_path)}' >> .gitignore" puts end |
#database_yml_content ⇒ Object
16 17 18 |
# File 'lib/capistrano/database_yml/helpers.rb', line 16 def database_yml_content { database_yml_env => local_database_yml(database_yml_env) }.to_yaml end |
#database_yml_env ⇒ Object
12 13 14 |
# File 'lib/capistrano/database_yml/helpers.rb', line 12 def database_yml_env fetch(:database_yml_env).to_s end |
#local_database_yml(env) ⇒ Object
7 8 9 10 |
# File 'lib/capistrano/database_yml/helpers.rb', line 7 def local_database_yml(env) @local_database_yml ||= YAML.load_file(database_yml_local_path) @local_database_yml[env] end |