Commit df20cb1a21929aa8c074c796705880f585264a98

Authored by Ryan Jones
1 parent d9b71184
Exists in master and in 1 other branch production

ping campfire if theres a notice

@@ -34,6 +34,7 @@ gem 'rack-ssl-enforcer' @@ -34,6 +34,7 @@ gem 'rack-ssl-enforcer'
34 gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data 34 gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data
35 gem 'rails_autolink', '~> 1.0.9' 35 gem 'rails_autolink', '~> 1.0.9'
36 gem 'campy' 36 gem 'campy'
  37 +gem 'heroku'
37 38
38 platform :ruby do 39 platform :ruby do
39 gem 'mongo', '= 1.3.1' 40 gem 'mongo', '= 1.3.1'
@@ -68,6 +68,7 @@ GEM @@ -68,6 +68,7 @@ GEM
68 rspec (~> 2.0) 68 rspec (~> 2.0)
69 erubis (2.7.0) 69 erubis (2.7.0)
70 eventmachine (0.12.10) 70 eventmachine (0.12.10)
  71 + excon (0.15.5)
71 execjs (1.4.0) 72 execjs (1.4.0)
72 multi_json (~> 1.0) 73 multi_json (~> 1.0)
73 fabrication (1.3.2) 74 fabrication (1.3.2)
@@ -81,6 +82,14 @@ GEM @@ -81,6 +82,14 @@ GEM
81 libxml-ruby (~> 2.0) 82 libxml-ruby (~> 2.0)
82 has_scope (0.5.1) 83 has_scope (0.5.1)
83 hashie (1.2.0) 84 hashie (1.2.0)
  85 + heroku (2.30.1)
  86 + heroku-api (~> 0.3.1)
  87 + launchy (>= 0.3.2)
  88 + netrc (~> 0.7.5)
  89 + rest-client (~> 1.6.1)
  90 + rubyzip
  91 + heroku-api (0.3.2)
  92 + excon (~> 0.15.5)
84 hike (1.2.1) 93 hike (1.2.1)
85 hoptoad_notifier (2.4.11) 94 hoptoad_notifier (2.4.11)
86 activesupport 95 activesupport
@@ -128,6 +137,7 @@ GEM @@ -128,6 +137,7 @@ GEM
128 railties (>= 3.0.0) 137 railties (>= 3.0.0)
129 multi_json (1.3.6) 138 multi_json (1.3.6)
130 multipart-post (1.1.5) 139 multipart-post (1.1.5)
  140 + netrc (0.7.5)
131 nokogiri (1.5.0) 141 nokogiri (1.5.0)
132 oa-core (0.3.2) 142 oa-core (0.3.2)
133 oauth2 (0.5.2) 143 oauth2 (0.5.2)
@@ -285,6 +295,7 @@ DEPENDENCIES @@ -285,6 +295,7 @@ DEPENDENCIES
285 execjs 295 execjs
286 fabrication (~> 1.3.0) 296 fabrication (~> 1.3.0)
287 haml 297 haml
  298 + heroku
288 hoptoad_notifier (~> 2.4) 299 hoptoad_notifier (~> 2.4)
289 htmlentities (~> 4.3.0) 300 htmlentities (~> 4.3.0)
290 inherited_resources 301 inherited_resources
app/models/issue_trackers/campfire_tracker.rb
@@ -24,7 +24,7 @@ class IssueTrackers::CampfireTracker < IssueTracker @@ -24,7 +24,7 @@ class IssueTrackers::CampfireTracker < IssueTracker
24 campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => project_id) 24 campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => project_id)
25 25
26 # post the issue to the campfire room 26 # post the issue to the campfire room
27 - campy.paste "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{issue_title problem}" 27 + campy.speak "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{issue_title problem}"
28 28
29 # update the problem to say where it was sent 29 # update the problem to say where it was sent
30 problem.update_attributes( 30 problem.update_attributes(
app/models/notice_observer.rb
@@ -4,6 +4,11 @@ class NoticeObserver < Mongoid::Observer @@ -4,6 +4,11 @@ class NoticeObserver < Mongoid::Observer
4 def after_create notice 4 def after_create notice
5 return unless should_notify? notice 5 return unless should_notify? notice
6 6
  7 + # if the app has the campfire tracker, post into the chat
  8 + if notice.app.issue_tracker.class.name == "IssueTrackers::CampfireTracker"
  9 + app.issue_tracker.create_issue(notice)
  10 + end
  11 +
7 Mailer.err_notification(notice).deliver 12 Mailer.err_notification(notice).deliver
8 end 13 end
9 14
lib/tasks/errbit/demo.rake
@@ -41,7 +41,7 @@ namespace :errbit do @@ -41,7 +41,7 @@ namespace :errbit do
41 end 41 end
42 42
43 errors.each do |error_template| 43 errors.each do |error_template|
44 - rand(34).times do 44 + rand(1).times do
45 45
46 error_report = error_template.reverse_merge({ 46 error_report = error_template.reverse_merge({
47 :error_class => "StandardError", 47 :error_class => "StandardError",