Commit a42d9de37fa15e5dfd3c4c35b192e71dae24609b

Authored by Marcin Ciunelis
2 parents 386d8cd2 8c8f6e5b
Exists in master and in 1 other branch production

Merge remote-tracking branch 'errbit/master'

@@ -20,13 +20,14 @@ gem 'hoptoad_notifier', "~> 2.4" @@ -20,13 +20,14 @@ gem 'hoptoad_notifier', "~> 2.4"
20 gem 'actionmailer_inline_css', "~> 1.3.0" 20 gem 'actionmailer_inline_css', "~> 1.3.0"
21 21
22 platform :ruby do 22 platform :ruby do
23 - gem 'bson_ext', '~> 1.3.1' 23 + gem 'bson_ext', '~> 1.4.0'
24 end 24 end
25 25
26 group :development, :test do 26 group :development, :test do
27 gem 'rspec-rails', '~> 2.6' 27 gem 'rspec-rails', '~> 2.6'
28 gem 'webmock', :require => false 28 gem 'webmock', :require => false
29 - gem 'factory_girl_rails' 29 + gem 'factory_girl', '~> 1.3.3'
  30 + gem 'factory_girl_rails', '~> 1.0.1'
30 unless ENV['TRAVIS'] 31 unless ENV['TRAVIS']
31 gem 'ruby-debug', :platform => :mri_18 32 gem 'ruby-debug', :platform => :mri_18
32 gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug' 33 gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug'
@@ -6,7 +6,7 @@ GEM @@ -6,7 +6,7 @@ GEM
6 actionmailer (3.0.10) 6 actionmailer (3.0.10)
7 actionpack (= 3.0.10) 7 actionpack (= 3.0.10)
8 mail (~> 2.2.19) 8 mail (~> 2.2.19)
9 - actionmailer_inline_css (1.3.0) 9 + actionmailer_inline_css (1.3.1)
10 actionmailer (>= 3.0.0) 10 actionmailer (>= 3.0.0)
11 nokogiri (>= 1.4.4) 11 nokogiri (>= 1.4.4)
12 premailer (>= 1.7.1) 12 premailer (>= 1.7.1)
@@ -33,25 +33,26 @@ GEM @@ -33,25 +33,26 @@ GEM
33 activemodel (= 3.0.10) 33 activemodel (= 3.0.10)
34 activesupport (= 3.0.10) 34 activesupport (= 3.0.10)
35 activesupport (3.0.10) 35 activesupport (3.0.10)
36 - addressable (2.2.5) 36 + addressable (2.2.6)
37 archive-tar-minitar (0.5.2) 37 archive-tar-minitar (0.5.2)
38 arel (2.0.10) 38 arel (2.0.10)
39 - bcrypt-ruby (2.1.4)  
40 - bson (1.3.1)  
41 - bson_ext (1.3.1) 39 + bcrypt-ruby (3.0.1)
  40 + bson (1.4.0)
  41 + bson_ext (1.4.0)
42 builder (2.1.2) 42 builder (2.1.2)
43 columnize (0.3.4) 43 columnize (0.3.4)
44 - crack (0.1.8) 44 + crack (0.3.1)
45 css_parser (1.2.5) 45 css_parser (1.2.5)
46 addressable 46 addressable
47 daemons (1.1.4) 47 daemons (1.1.4)
48 database_cleaner (0.6.7) 48 database_cleaner (0.6.7)
49 - devise (1.4.2)  
50 - bcrypt-ruby (~> 2.1.2) 49 + devise (1.4.7)
  50 + bcrypt-ruby (~> 3.0)
51 orm_adapter (~> 0.0.3) 51 orm_adapter (~> 0.0.3)
52 warden (~> 1.0.3) 52 warden (~> 1.0.3)
53 diff-lcs (1.1.3) 53 diff-lcs (1.1.3)
54 - email_spec (1.1.1) 54 + email_spec (1.2.1)
  55 + mail (~> 2.2)
55 rspec (~> 2.0) 56 rspec (~> 2.0)
56 erubis (2.6.6) 57 erubis (2.6.6)
57 abstract (>= 1.0.0) 58 abstract (>= 1.0.0)
@@ -60,15 +61,15 @@ GEM @@ -60,15 +61,15 @@ GEM
60 factory_girl_rails (1.0.1) 61 factory_girl_rails (1.0.1)
61 factory_girl (~> 1.3) 62 factory_girl (~> 1.3)
62 railties (>= 3.0.0) 63 railties (>= 3.0.0)
63 - faraday (0.6.1)  
64 - addressable (~> 2.2.4) 64 + faraday (0.7.4)
  65 + addressable (~> 2.2.6)
65 multipart-post (~> 1.1.0) 66 multipart-post (~> 1.1.0)
66 - rack (>= 1.1.0, < 2)  
67 - faraday_middleware (0.6.5)  
68 - faraday (~> 0.6.0)  
69 - haml (3.0.25)  
70 - happymapper (0.3.2)  
71 - libxml-ruby (~> 1.1.3) 67 + rack (< 2, >= 1.1.0)
  68 + faraday_middleware (0.7.0)
  69 + faraday (~> 0.7.3)
  70 + haml (3.1.3)
  71 + happymapper (0.4.0)
  72 + libxml-ruby (~> 2.0)
72 has_scope (0.5.1) 73 has_scope (0.5.1)
73 hashie (1.0.0) 74 hashie (1.0.0)
74 hoptoad_notifier (2.4.11) 75 hoptoad_notifier (2.4.11)
@@ -76,10 +77,10 @@ GEM @@ -76,10 +77,10 @@ GEM
76 builder 77 builder
77 htmlentities (4.3.0) 78 htmlentities (4.3.0)
78 i18n (0.5.0) 79 i18n (0.5.0)
79 - inherited_resources (1.2.2) 80 + inherited_resources (1.3.0)
80 has_scope (~> 0.5.0) 81 has_scope (~> 0.5.0)
81 responders (~> 0.6.0) 82 responders (~> 0.6.0)
82 - libxml-ruby (1.1.4) 83 + libxml-ruby (2.2.2)
83 lighthouse-api (2.0) 84 lighthouse-api (2.0)
84 activeresource (>= 3.0.0) 85 activeresource (>= 3.0.0)
85 activesupport (>= 3.0.0) 86 activesupport (>= 3.0.0)
@@ -93,40 +94,43 @@ GEM @@ -93,40 +94,43 @@ GEM
93 mime-types (~> 1.16) 94 mime-types (~> 1.16)
94 treetop (~> 1.4.8) 95 treetop (~> 1.4.8)
95 mime-types (1.16) 96 mime-types (1.16)
96 - mongo (1.3.1)  
97 - bson (>= 1.3.1) 97 + mongo (1.4.0)
  98 + bson (= 1.4.0)
98 mongoid (2.1.2) 99 mongoid (2.1.2)
99 activemodel (~> 3.0) 100 activemodel (~> 3.0)
100 mongo (~> 1.3) 101 mongo (~> 1.3)
101 tzinfo (~> 0.3.22) 102 tzinfo (~> 0.3.22)
102 - mongoid_rails_migrations (0.0.10)  
103 - activesupport (~> 3.0.0)  
104 - bundler (>= 0.9.19)  
105 - rails (~> 3.0.0)  
106 - railties (~> 3.0.0) 103 + mongoid_rails_migrations (0.0.14)
  104 + activesupport (>= 3.0.0)
  105 + bundler (>= 1.0.0)
  106 + rails (>= 3.0.0)
  107 + railties (>= 3.0.0)
107 multi_json (1.0.3) 108 multi_json (1.0.3)
108 multipart-post (1.1.3) 109 multipart-post (1.1.3)
109 - nokogiri (1.4.4)  
110 - octokit (0.6.3)  
111 - addressable (~> 2.2.4)  
112 - faraday (~> 0.6.0)  
113 - faraday_middleware (~> 0.6.0) 110 + nokogiri (1.5.0)
  111 + octokit (0.6.4)
  112 + addressable (~> 2.2.6)
  113 + faraday (~> 0.7.3)
  114 + faraday_middleware (~> 0.7.0.rc1)
114 hashie (~> 1.0.0) 115 hashie (~> 1.0.0)
115 - multi_json (~> 1.0.0)  
116 - rash (~> 0.3.0) 116 + multi_json (~> 1.0.2)
117 orm_adapter (0.0.5) 117 orm_adapter (0.0.5)
118 oruen_redmine_client (0.0.1) 118 oruen_redmine_client (0.0.1)
119 activeresource (>= 2.3.0) 119 activeresource (>= 2.3.0)
120 - pivotal-tracker (0.2.0) 120 + pivotal-tracker (0.4.1)
121 builder 121 builder
122 - happymapper (>= 0.2.4)  
123 - nokogiri (~> 1.4.1)  
124 - rest-client (~> 1.5.1) 122 + builder
  123 + happymapper (>= 0.3.2)
  124 + happymapper (>= 0.3.2)
  125 + nokogiri (>= 1.4.3)
  126 + nokogiri (~> 1.4)
  127 + rest-client (~> 1.6.0)
  128 + rest-client (~> 1.6.0)
125 polyglot (0.3.2) 129 polyglot (0.3.2)
126 premailer (1.7.3) 130 premailer (1.7.3)
127 css_parser (>= 1.1.9) 131 css_parser (>= 1.1.9)
128 htmlentities (>= 4.0.0) 132 htmlentities (>= 4.0.0)
129 - rack (1.2.3) 133 + rack (1.2.4)
130 rack-mount (0.6.14) 134 rack-mount (0.6.14)
131 rack (>= 1.0.0) 135 rack (>= 1.0.0)
132 rack-test (0.5.7) 136 rack-test (0.5.7)
@@ -146,12 +150,10 @@ GEM @@ -146,12 +150,10 @@ GEM
146 rdoc (~> 3.4) 150 rdoc (~> 3.4)
147 thor (~> 0.14.4) 151 thor (~> 0.14.4)
148 rake (0.9.2) 152 rake (0.9.2)
149 - rash (0.3.0)  
150 - hashie (~> 1.0.0)  
151 rbx-require-relative (0.0.5) 153 rbx-require-relative (0.0.5)
152 rdoc (3.9.4) 154 rdoc (3.9.4)
153 responders (0.6.4) 155 responders (0.6.4)
154 - rest-client (1.5.1) 156 + rest-client (1.6.7)
155 mime-types (>= 1.16) 157 mime-types (>= 1.16)
156 rspec (2.6.0) 158 rspec (2.6.0)
157 rspec-core (~> 2.6.0) 159 rspec-core (~> 2.6.0)
@@ -195,14 +197,14 @@ GEM @@ -195,14 +197,14 @@ GEM
195 typhoeus (0.2.4) 197 typhoeus (0.2.4)
196 mime-types 198 mime-types
197 mime-types 199 mime-types
198 - tzinfo (0.3.29)  
199 - useragent (0.3.1) 200 + tzinfo (0.3.30)
  201 + useragent (0.3.2)
200 warden (1.0.5) 202 warden (1.0.5)
201 rack (>= 1.0) 203 rack (>= 1.0)
202 - webmock (1.6.2)  
203 - addressable (>= 2.2.2) 204 + webmock (1.7.6)
  205 + addressable (> 2.2.5, ~> 2.2)
204 crack (>= 0.1.7) 206 crack (>= 0.1.7)
205 - will_paginate (3.0.0) 207 + will_paginate (3.0.2)
206 208
207 PLATFORMS 209 PLATFORMS
208 ruby 210 ruby
@@ -210,11 +212,12 @@ PLATFORMS @@ -210,11 +212,12 @@ PLATFORMS
210 DEPENDENCIES 212 DEPENDENCIES
211 SystemTimer 213 SystemTimer
212 actionmailer_inline_css (~> 1.3.0) 214 actionmailer_inline_css (~> 1.3.0)
213 - bson_ext (~> 1.3.1) 215 + bson_ext (~> 1.4.0)
214 database_cleaner (~> 0.6.0) 216 database_cleaner (~> 0.6.0)
215 devise (~> 1.4.0) 217 devise (~> 1.4.0)
216 email_spec 218 email_spec
217 - factory_girl_rails 219 + factory_girl (~> 1.3.3)
  220 + factory_girl_rails (~> 1.0.1)
218 haml 221 haml
219 hoptoad_notifier (~> 2.4) 222 hoptoad_notifier (~> 2.4)
220 htmlentities (~> 4.3.0) 223 htmlentities (~> 4.3.0)
app/models/app.rb
@@ -94,7 +94,7 @@ class App @@ -94,7 +94,7 @@ class App
94 end 94 end
95 95
96 def last_deploy_at 96 def last_deploy_at
97 - deploys.last && deploys.last.created_at 97 + (last_deploy = deploys.last) && last_deploy.created_at
98 end 98 end
99 99
100 100
app/models/problem.rb
@@ -109,7 +109,9 @@ class Problem @@ -109,7 +109,9 @@ class Problem
109 def cache_app_attributes 109 def cache_app_attributes
110 if app 110 if app
111 self.app_name = app.name 111 self.app_name = app.name
112 - self.last_deploy_at = app.last_deploy_at 112 + self.last_deploy_at = if (last_deploy = app.deploys.where(:environment => self.environment).last)
  113 + last_deploy.created_at
  114 + end
113 self.save if persisted? 115 self.save if persisted?
114 end 116 end
115 end 117 end
app/views/apps/show.html.haml
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 = auto_discovery_link_tag :atom, app_url(@app, User.token_authentication_key => current_user.authentication_token, :format => "atom"), :title => "Errbit notices for #{@app.name} at #{root_url}" 3 = auto_discovery_link_tag :atom, app_url(@app, User.token_authentication_key => current_user.authentication_token, :format => "atom"), :title => "Errbit notices for #{@app.name} at #{root_url}"
4 = javascript_include_tag 'apps.show' 4 = javascript_include_tag 'apps.show'
5 - content_for :meta do 5 - content_for :meta do
6 - %strong Errs Caught: 6 + %strong Errors Caught:
7 = @app.problems.count 7 = @app.problems.count
8 %strong Deploy Count: 8 %strong Deploy Count:
9 = @app.deploys.count 9 = @app.deploys.count
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 %h3 No deploys 83 %h3 No deploys
84 84
85 - if @app.problems.any? 85 - if @app.problems.any?
86 - %h3.clear Errs 86 + %h3.clear Errors
87 = render 'errs/table', :errs => @problems 87 = render 'errs/table', :errs => @problems
88 - else 88 - else
89 %h3.clear No errs have been caught yet, make sure you setup your app 89 %h3.clear No errs have been caught yet, make sure you setup your app
app/views/errs/show.html.haml
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 22
23 - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @problem.comments.any? 23 - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @problem.comments.any?
24 - content_for :comments do 24 - content_for :comments do
25 - %h3 Comments on this Err 25 + %h3 Comments
26 - @problem.comments.each do |comment| 26 - @problem.comments.each do |comment|
27 .window 27 .window
28 %table.comment 28 %table.comment
lib/overrides/hoptoad_notifier/hoptoad_notifier.rb
@@ -14,9 +14,8 @@ HoptoadNotifier.module_eval do @@ -14,9 +14,8 @@ HoptoadNotifier.module_eval do
14 app.save! 14 app.save!
15 end 15 end
16 notice.send("api_key=", app.api_key) 16 notice.send("api_key=", app.api_key)
17 - # Create notice internally.  
18 - debugger  
19 17
  18 + # Create notice internally.
20 report = ErrorReport.new(notice.to_xml) 19 report = ErrorReport.new(notice.to_xml)
21 report.generate_notice! 20 report.generate_notice!
22 21
spec/models/problem_spec.rb
@@ -180,16 +180,16 @@ describe Problem do @@ -180,16 +180,16 @@ describe Problem do
180 before do 180 before do
181 @app = Factory(:app) 181 @app = Factory(:app)
182 @last_deploy = 10.days.ago.localtime.round(0) 182 @last_deploy = 10.days.ago.localtime.round(0)
183 - deploy = Factory(:deploy, :app => @app, :created_at => @last_deploy) 183 + deploy = Factory(:deploy, :app => @app, :created_at => @last_deploy, :environment => "production")
184 end 184 end
185 185
186 it "is set when a problem is created" do 186 it "is set when a problem is created" do
187 - problem = Factory(:problem, :app => @app) 187 + problem = Factory(:problem, :app => @app, :environment => "production")
188 assert_equal @last_deploy, problem.last_deploy_at 188 assert_equal @last_deploy, problem.last_deploy_at
189 end 189 end
190 190
191 it "is updated when a deploy is created" do 191 it "is updated when a deploy is created" do
192 - problem = Factory(:problem, :app => @app) 192 + problem = Factory(:problem, :app => @app, :environment => "production")
193 next_deploy = 5.minutes.ago.localtime.round(0) 193 next_deploy = 5.minutes.ago.localtime.round(0)
194 lambda { 194 lambda {
195 @deploy = Factory(:deploy, :app => @app, :created_at => next_deploy) 195 @deploy = Factory(:deploy, :app => @app, :created_at => next_deploy)