Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add Heroku deploy notification

  • Loading branch information...
commit f71c71f52f1b856203e5da2d767d37e5b0e09c38 1 parent bb88704
@jasonm jasonm authored
View
15 README_FOR_HEROKU_ADDON.md
@@ -69,14 +69,25 @@ In order to use hoptoad_notifier in a non-Rails rack app, just load the hoptoad_
For Rails 1.x, visit the [Hoptoad notifier's README on GitHub](http://github.com/thoughtbot/hoptoad_notifier),
and be sure to use `ENV['HOPTOAD_API_KEY']` where your API key is required in configuration code.
-3. Configure your notification settings
--------------------------------------------
+3. Configure your notification settings (important!)
+---------------------------------------------------
Once you have included and configured the notifier in your application,
you will want to configure your notification settings.
+This is important - without setting your email address, you won't receive notification emails.
+
Hoptoad can deliver exception notifications to your email inbox. To configure these delivery settings:
1. Visit your application's Hoptoad Add-on page, like [ http://api.heroku.com/myapps/my-great-app/addons/hoptoad:basic ](http://api.heroku.com/myapps/my-great-app/addons/hoptoad:basic)
2. Click "Go to Hoptoad admin" to configure the Hoptoad Add-on on the Hoptoadapp.com website
3. Click the "Profile" button in the header to edit your email address and notification settings.
+
+4. Optionally: Set up deploy notification
+-----------------------------------------
+
+If your Hoptoad plan supports deploy notification, set it up for your Heroku application like this:
+
+ rake hoptoad:heroku:add_deploy_notification
+
+This will install a Heroku [HTTP Deploy Hook](http://docs.heroku.com/deploy-hooks) to notify Hoptoad of the deploy.
View
11 lib/hoptoad_notifier/rails3_tasks.rb
@@ -1,16 +1,7 @@
require 'hoptoad_notifier'
+require 'shared_tasks'
namespace :hoptoad do
- desc "Notify Hoptoad of a new deploy."
- task :deploy => :environment do
- require 'hoptoad_tasks'
- HoptoadTasks.deploy(:rails_env => ENV['TO'],
- :scm_revision => ENV['REVISION'],
- :scm_repository => ENV['REPO'],
- :local_username => ENV['USER'],
- :api_key => ENV['API_KEY'])
- end
-
desc "Verify your gem installation by sending a test exception to the hoptoad service"
task :test => [:environment] do
Rails.logger = Logger.new(STDOUT)
View
24 lib/hoptoad_notifier/shared_tasks.rb
@@ -0,0 +1,24 @@
+namespace :hoptoad do
+ desc "Notify Hoptoad of a new deploy."
+ task :deploy => :environment do
+ require 'hoptoad_tasks'
+ HoptoadTasks.deploy(:rails_env => ENV['TO'],
+ :scm_revision => ENV['REVISION'],
+ :scm_repository => ENV['REPO'],
+ :local_username => ENV['USER'],
+ :api_key => ENV['API_KEY'])
+ end
+
+ namespace :heroku do
+ desc "Install Heroku deploy notifications addon"
+ task :add_deploy_notification => [:environment] do
+ heroku_api_key = `heroku console 'puts ENV[%{HOPTOAD_API_KEY}]' | head -n 1`.strip
+ heroku_rails_env = `heroku console 'puts RAILS_ENV' | head -n 1`.strip
+
+ command = %Q(heroku addons:add deployhooks:http url="http://hoptoadapp.com/deploys.txt?deploy[rails_env]=#{heroku_rails_env}&api_key=#{heroku_api_key}")
+
+ puts "\nRunning:\n#{command}\n"
+ puts `#{command}`
+ end
+ end
+end
View
16 lib/hoptoad_notifier/tasks.rb
@@ -1,21 +1,7 @@
require 'hoptoad_notifier'
+require 'shared_tasks'
namespace :hoptoad do
- desc "Notify Hoptoad of a new deploy."
- task :deploy => :environment do
- require 'hoptoad_tasks'
- HoptoadTasks.deploy(:rails_env => ENV['TO'],
- :scm_revision => ENV['REVISION'],
- :scm_repository => ENV['REPO'],
- :local_username => ENV['USER'],
- :api_key => ENV['API_KEY'])
- end
-
- task :log_stdout do
- require 'logger'
- RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
- end
-
desc "Verify your gem installation by sending a test exception to the hoptoad service"
task :test => ['hoptoad:log_stdout', :environment] do
RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
Please sign in to comment.
Something went wrong with that request. Please try again.