Module: Capistrano::Yutiriti::DSL
- Defined in:
- lib/capistrano/yutiriti/dsl.rb
Instance Method Summary collapse
- #config_path ⇒ Object
- #dot_env_path ⇒ Object
- #set_config_vars(vars = {}) ⇒ Object
- #unset_config_vars(keys) ⇒ Object
- #update_dot_env ⇒ Object
Instance Method Details
#config_path ⇒ Object
4 5 6 |
# File 'lib/capistrano/yutiriti/dsl.rb', line 4 def config_path shared_path.join("config") end |
#dot_env_path ⇒ Object
8 9 10 |
# File 'lib/capistrano/yutiriti/dsl.rb', line 8 def dot_env_path shared_path.join(".env") end |
#set_config_vars(vars = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/capistrano/yutiriti/dsl.rb', line 12 def set_config_vars(vars = {}) return if vars.empty? execute :mkdir, "-p", config_path within config_path do vars.each do |key, value| execute :echo, value, ">", key end end update_dot_env end |
#unset_config_vars(keys) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/capistrano/yutiriti/dsl.rb', line 26 def unset_config_vars(keys) return if keys.empty? execute :mkdir, "-p", config_path within config_path do execute :rm, "-f", *keys end update_dot_env end |
#update_dot_env ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/capistrano/yutiriti/dsl.rb', line 38 def update_dot_env execute " config_path=\#{config_path}\n dot_env_path=\#{dot_env_path}\n rm -f $dot_env_path\n mkdir -p $config_path\n for e in $(ls $config_path)\n do echo \"$e=$(cat $config_path/$e)\" >> $dot_env_path\n done\n chmod 600 $dot_env_path\n EOCOMMAND\nend\n" |