From 1b9640b688b0c7c8bfec26f432be9abdb59a30ef Mon Sep 17 00:00:00 2001 From: tzzzoz Date: Wed, 7 Feb 2018 15:32:44 +0800 Subject: [PATCH 1/2] Fix breaking changes for mina 1.x --- lib/mina/dotenv/defaults.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mina/dotenv/defaults.rb b/lib/mina/dotenv/defaults.rb index e889d53..5bf320b 100644 --- a/lib/mina/dotenv/defaults.rb +++ b/lib/mina/dotenv/defaults.rb @@ -1 +1 @@ -set_default :dotenv_location, '.env' +set :dotenv_location, '.env' From 265a5611aa65549a618c28dfaeb1157b12e0e35e Mon Sep 17 00:00:00 2001 From: tzzzoz Date: Wed, 7 Feb 2018 17:52:04 +0800 Subject: [PATCH 2/2] Fix breaking changes for mina 1.x(#fetch to get local/global variables) --- README.md | 4 ++-- lib/mina/dotenv/tasks.rb | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 488b580..4c25b82 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,8 @@ task :deploy => :environment do invoke :'deploy:cleanup' to :launch do - queue "mkdir -p #{deploy_to}/#{current_path}/tmp/" - queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt" + command %{mkdir -p #{deploy_to}/#{current_path}/tmp/} + command %{touch #{deploy_to}/#{current_path}/tmp/restart.txt} end end end diff --git a/lib/mina/dotenv/tasks.rb b/lib/mina/dotenv/tasks.rb index 54112c1..ecd8676 100644 --- a/lib/mina/dotenv/tasks.rb +++ b/lib/mina/dotenv/tasks.rb @@ -4,26 +4,26 @@ namespace :dotenv do desc 'Copies the local .env file to the server' task :push do - dotenv = Mina::Dotenv::Utils.read_file(dotenv_location) - queue! %( + dotenv = Mina::Dotenv::Utils.read_file(fetch(:dotenv_location)) + command %{ echo #{dotenv.shellescape} | sed -e 's/^[ \t]*//' > #{remote_dotenv_path} - ) - queue! %(rm -f .env) - queue! %(ln -nFs #{remote_dotenv_path} .env) + } + command %{rm -f .env} + command %{ln -nFs #{remote_dotenv_path} .env} end desc 'Copies the remote .env file to the current directory' task :pull do - scp_download(remote_dotenv_path, dotenv_location) - add_to_gitignore_command = %( - if [[ -z $(grep #{dotenv_location} .gitignore) ]]; - then echo #{dotenv_location} >> .gitignore; + scp_download(remote_dotenv_path, fetch(:dotenv_location)) + add_to_gitignore_command = %{ + if [[ -z $(grep #{fetch(:dotenv_location)} .gitignore) ]]; + then echo #{fetch(:dotenv_location)} >> .gitignore; fi; - ) + } `#{add_to_gitignore_command}` end end def remote_dotenv_path - "#{deploy_to}/#{shared_path}/.env" + "#{fetch(:shared_path)}/.env" end