Skip to content

Instantly share code, notes, and snippets.

View ysf's full-sized avatar
💭
writing jokes.

ysf ysf

💭
writing jokes.
View GitHub Profile
@ysf
ysf / deploy.rb
Created September 25, 2009 11:31
usage: 'cap deploy:setup' for initialization. 'cap deploy' for updates and cap 'deploy:restart' for passenger restart. only the latest four releases are left on the server.
set :application, "application_name"
set :rails_env, 'production' # only needed for migrations
set :user, "webXX"
role :web, "serverX.domaincamp.de" # Your HTTP server, Apache/etc
role :app, "serverX.domaincamp.de" # This may be the same as your `Web` server
role :db, "serverX.domaincamp.de", :primary => true # This is where Rails migrations will run
set :scm, :git
set :repository, "git@yourgithost.tld:username/project/project.git"
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"