Skip to content
This repository was archived by the owner on Feb 17, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/mina/dotenv/defaults.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
set_default :dotenv_location, '.env'
set :dotenv_location, '.env'
22 changes: 11 additions & 11 deletions lib/mina/dotenv/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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