diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a91802a..a12275a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,4 +1,6 @@ class ApplicationController < ActionController::Base + include HoptoadNotifier::Catcher + protect_from_forgery filter_parameter_logging :password, :password_confirmation diff --git a/config/deploy.rb b/config/deploy.rb index 00d8c6b..40ebd3e 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/config/environment.rb b/config/environment.rb index dad12c4..baa0e74 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -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 diff --git a/config/environments/production.rb b/config/environments/production.rb index 10a70e9..b01043c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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 diff --git a/mkmf.log b/mkmf.log new file mode 100644 index 0000000..31cb72a --- /dev/null +++ b/mkmf.log @@ -0,0 +1,8 @@ +find_executable: checking for git... -------------------- yes + +-------------------- + +find_executable: checking for cd... -------------------- yes + +-------------------- +