This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
namespace :db do | |
namespace(rails_env) do | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( File.basename($0) == "rake" && ARGV.include?("gems:install") ) | |
# do stuff | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://github.com/thoughtbot/suspenders/blob/4d9c29a1dfe14a591ac461d5ea8e660f1a642d5b/config/deploy.rb#L40 | |
namespace :db do | |
desc "Create database password in shared path" | |
task :password do | |
set :db_password, Proc.new { Capistrano::CLI.password_prompt("Remote database password: ") } | |
run "mkdir -p #{shared_path}/config" | |
put db_password, "#{shared_path}/config/dbpassword" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before "deploy:rollback:revision", "deploy:rollback_database" | |
desc "Rolls back database to migration level of the previously deployed release" | |
task :rollback_database, :roles => :db, :only => { :primary => true } do | |
if releases.length < 2 | |
abort "could not rollback the code because there is no prior release" | |
else | |
rake = fetch(:rake, "rake") | |
rails_env = fetch(:rails_env, "production") | |
migrate_env = fetch(:migrate_env, "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include at least one source and the rails gem | |
source :gemcutter | |
gem 'rails', '~> 2.3.5', :require => nil | |
group :development do | |
# bundler requires these gems in development | |
gem 'rails-footnotes' | |
end | |
group :test do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after "deploy:update_code", "bundler:bundle" | |
namespace :bundler do | |
task :bundle do | |
run "mkdir -p #{%w(cache doc gems specifications).map { |x| "#{shared_path}/bundler_gems/#{x}" }.join(' ')} #{release_path}/vendor/bundler_gems; rm -R #{release_path}/vendor/bundler_gems/*; ln -s #{shared_path}/bundler_gems/* #{release_path}/vendor/bundler_gems/; cd #{release_path}; gem bundle" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/582686/should-i-define-a-main-method-in-my-ruby-scripts/582694#582694 | |
# Detect if the file is being run directly. | |
#if __FILE__ == $PROGRAM_NAME | |
if __FILE__ == $0 | |
x = SweetClass.new(ARGV) | |
x.run # or go, or whatever | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from http://stackoverflow.com/questions/1686779/multifile-rake-build | |
# Runs a task (in this case the default task) for each Rakefile nested in the current directory | |
task :default do | |
FileList["*/**/Rakefile"].each do |project| | |
next if project =~ /^admin_console/ | |
next if project =~ /^logging/ | |
# clear current tasks | |
Rake::Task.clear | |
#load tasks from this project | |
load project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Script: app_ctl | |
# Description: Starts and stops a Ruby script | |
# | |
die() | |
{ | |
echo "$*" | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webrat' | |
require 'webrat/mechanize' | |
include Webrat::Methods | |
include Webrat::Matchers | |
Webrat.configure do |config| | |
config.mode = :mechanize | |
end |