Skip to content

Instantly share code, notes, and snippets.

@pmutua
Forked from rkjha/Rakefile.rb
Created July 25, 2017 04:26
Show Gist options
  • Save pmutua/6a4a591d321177a15d43dbb3e9ca5d08 to your computer and use it in GitHub Desktop.
Save pmutua/6a4a591d321177a15d43dbb3e9ca5d08 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