Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
kastner committed Nov 2, 2009
0 parents commit 23f2fa1
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
79 changes: 79 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
role :server, "metaatem"

set :deploy_to, "/var/www/xtract.metaatem.net"
set :scm, :git
set :repository, "git@github.com:kastner/xtract.git"
set :branch, "origin/master"
set :migrate_target, :current

set(:latest_release) { fetch(:current_path) }
set(:release_path) { fetch(:current_path) }
set(:current_release) { fetch(:current_path) }

set(:current_revision) { capture("cd #{current_path}; git rev-parse --short HEAD").strip }
set(:latest_revision) { capture("cd #{current_path}; git rev-parse --short HEAD").strip }
set(:previous_revision) { capture("cd #{current_path}; git rev-parse --short HEAD@{1}").strip }

namespace :deploy do
desc "Deploy the MFer"
task :default do
update
restart
end

desc "Setup a GitHub-style deployment."
task :setup, :except => { :no_release => true } do
dirs = [deploy_to, shared_path]
dirs += shared_children.map { |d| File.join(shared_path, d) }
run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
run "git clone #{repository} #{current_path}"
end

task :update do
transaction do
update_code
end
end

desc "Update the deployed code."
task :update_code, :except => { :no_release => true } do
run "cd #{current_path}; git fetch origin; git reset --hard #{branch}"
finalize_update
end

desc "Update the database (overwritten to avoid symlink)"
task :migrations do
update_code
migrate
restart
end

desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end

[:start, :stop].each do |t|
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end

namespace :rollback do
desc "Moves the repo back to the previous version of HEAD"
task :repo, :except => { :no_release => true } do
set :branch, "HEAD@{1}"
deploy.default
end

desc "Rewrite reflog so HEAD@{1} will continue to point to at the next previous release."
task :cleanup, :except => { :no_release => true } do
run "cd #{current_path}; git reflog delete --rewrite HEAD@{1}; git reflog delete --rewrite HEAD@{1}"
end

desc "Rolls back to the previously deployed version."
task :default do
rollback.repo
rollback.cleanup
end
end
end
4 changes: 4 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'sinatra'
require 'xtract.rb'

run Sinatra::Application
2 changes: 2 additions & 0 deletions log/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
1 change: 1 addition & 0 deletions public/hi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi
2 changes: 2 additions & 0 deletions tmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
3 changes: 3 additions & 0 deletions xtract.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
get "/" do
"Hi"
end

0 comments on commit 23f2fa1

Please sign in to comment.