namespace :remenv do

set :remenv_file, -> { "#{shared_path}/.env" }

desc "Upload the current environment as a file"
task :sync do
  on roles(:app), in: :parallel do
    envfile = fetch(:remenv_file)
    envio   = Remenv::IO.write(stringio)

    upload!(envio, envfile)
  end
end

desc "Sync and restart apps"
task sync_with_restart: ['remenv:sync', 'deploy:restart']

end