Skip to content

Commit

Permalink
adding hoptoad again
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvlopes committed Jan 31, 2010
1 parent 21c98f9 commit 23bd0be
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ApplicationController < ActionController::Base
include HoptoadNotifier::Catcher

protect_from_forgery
filter_parameter_logging :password, :password_confirmation

Expand Down
43 changes: 20 additions & 23 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# SSH SETTINGS
set :user , "git"
set :deploy_to, "~/#{application}"
set :deploy_to, "/var/rails/#{application}"
set :shared_directory, "#{deploy_to}/shared"
set :use_sudo, false
set :group_writable, false
Expand All @@ -27,7 +27,10 @@
deploy.update_crontab
end

after 'deploy:update_code', 'db:upload_database_yaml'
after 'deploy:update_code' do
db.upload_database_yaml
assets.symlink
end

namespace :deploy do
# Restart passenger on deploy
Expand All @@ -40,11 +43,11 @@
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end

desc "Update the crontab file"
task :update_crontab, :roles => :db do
run "cd #{release_path} && whenever --update-crontab #{application}"
end
end
end

namespace :log do
Expand All @@ -65,37 +68,31 @@
run_locally "cd #{root_path} && jammit"
upload "#{root_path}/public/assets", "#{current_release}/public", :via => :scp, :recursive => true
end
end

namespace :db do

desc "remote backup and download the MySQL database"
task :backup, :roles => :db do
backup_rb ||= "#{current_path}/lib/backup.rb"
run "if [ -f #{backup_rb} ]; then ruby #{backup_rb} backup #{deploy_to} ; fi"
get "#{deploy_to}/etc/dump.tar.gz", "#{Date.today.to_s}.tar.gz"
run "rm #{deploy_to}/etc/dump.tar.gz"
task :symlink, :roles => :app do
run <<-CMD
rm -rf #{current_path}/public/system &&
ln -nfs #{shared_path}/system #{release_path}/public/system
CMD
end
end

desc "upload and restore of remote MySQL database"
task :restore, :roles => :db do
unless File.exists?("dump.tar.gz")
puts "Backup dump.tar.gz not found"
exit 0
end
backup_rb ||= "#{current_path}/lib/backup.rb"
upload "dump.tar.gz", "#{deploy_to}/etc/dump.tar.gz"
run "if [ -f #{backup_rb} ]; then ruby #{backup_rb} restore #{deploy_to} ; fi"
end
namespace :db do

desc "upload database.yml"
task :upload_database_yaml do
upload File.join(File.dirname(__FILE__), "database.yml"), "#{shared_path}/database.yml"
run "ln -s #{shared_path}/database.yml #{release_path}/config/database.yml"
end

end

Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
$: << File.join(vendored_notifier, 'lib')
end

require 'hoptoad_notifier/capistrano'

Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
$: << File.join(vendored_notifier, 'lib')
end
Expand Down
1 change: 1 addition & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
config.gem 'formtastic', :version => '0.9.7'
config.gem 'paperclip', :version => '2.3.1.1'
config.gem 'inherited_resources', :version => '0.9.4'
config.gem 'hoptoad_notifier', :version => '2.1.3'

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
Expand Down
1 change: 0 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Settings specified here will take precedence over those in config/environment.rb

config.gem 'whenever', :version => '0.4.1'
config.gem 'hoptoad_notifier', :version => '2.1.3'

# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
Expand Down
8 changes: 8 additions & 0 deletions mkmf.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
find_executable: checking for git... -------------------- yes

--------------------

find_executable: checking for cd... -------------------- yes

--------------------

0 comments on commit 23bd0be

Please sign in to comment.