Skip to content

Instantly share code, notes, and snippets.

@rkjha
Created November 12, 2014 10:15
Show Gist options
  • Save rkjha/da9d34d19ec111461546 to your computer and use it in GitHub Desktop.
Save rkjha/da9d34d19ec111461546 to your computer and use it in GitHub Desktop.
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