Skip to content

Commit

Permalink
Add a basic Capistrano recipe to this repository
Browse files Browse the repository at this point in the history
  • Loading branch information
henare committed Sep 26, 2010
1 parent 6e0a4b3 commit 004c2d1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks
39 changes: 39 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
set :application, "planningalerts.org.au/app"
set :repository, "git://git.openaustralia.org/planningalerts-app.git"

set :scm, :git

set :stage, "test" unless exists? :stage

set :use_sudo, false

if stage == "production"
set :deploy_to, "/srv/www/www.#{application}"
elsif stage == "test"
set :deploy_to, "/srv/www/test.#{application}"
#set :branch, "test"
end

set :user, "deploy"

role :web, "openaustralia.org"

namespace :deploy do
desc "After a code update, we link additional config and the scrapers"
after "deploy:update_code" do
links = {
"#{release_path}/config/database.yml" => "#{deploy_to}/shared/database.yml",
"#{release_path}/app/models/configuration.rb" => "#{deploy_to}/shared/configuration.rb",
"#{release_path}/config/production.sphinx.conf" => "#{deploy_to}/shared/production.sphinx.conf",
"#{release_path}/config/sphinx.yml" => "#{deploy_to}/shared/sphinx.yml",
"#{deploy_to}/../parsers/current/public" => "#{current_path}/public/scrapers"
}

# "ln -sf <a> <b>" creates a symbolic link but deletes <b> if it already exists
run links.map {|a| "ln -sf #{a.last} #{a.first}"}.join(";")
end

task :restart, :except => { :no_release => true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
end

0 comments on commit 004c2d1

Please sign in to comment.