Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A simple rake file for deploying sinatra app.
### change APP_NAME and REPO ###
### Also replace example.com with your domain, it requires DNS setup, atleast a local entry in ssh-config or hosts file
require 'rake/remote_task'
set :domain, 'example.com'
set :app_name, 'APP_NAME'
set :repo, 'ssh://REPO'
namespace :deploy do
desc "Server setup"
remote_task :setup do
puts "setting up the server for deployment......"
run "mkdir #{app_name} && cd #{app_name} && git init && git remote add origin #{repo}"
puts ".....setup completed successfully."
end
desc "deploy to server"
remote_task :server do
puts "deploying to the server......."
run "cd #{app_name} && git pull origin master"
puts ".....deployed successfully."
end
end
desc "Deploy to the server"
task :deploy => ["deploy:server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment