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'

Gemfile
... ... @@ -20,13 +20,14 @@ gem 'hoptoad_notifier', "~> 2.4"
20 20 gem 'actionmailer_inline_css', "~> 1.3.0"
21 21  
22 22 platform :ruby do
23   - gem 'bson_ext', '~> 1.3.1'
  23 + gem 'bson_ext', '~> 1.4.0'
24 24 end
25 25  
26 26 group :development, :test do
27 27 gem 'rspec-rails', '~> 2.6'
28 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 31 unless ENV['TRAVIS']
31 32 gem 'ruby-debug', :platform => :mri_18
32 33 gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug'
... ...
Gemfile.lock
... ... @@ -6,7 +6,7 @@ GEM
6 6 actionmailer (3.0.10)
7 7 actionpack (= 3.0.10)
8 8 mail (~> 2.2.19)
9   - actionmailer_inline_css (1.3.0)
  9 + actionmailer_inline_css (1.3.1)
10 10 actionmailer (>= 3.0.0)
11 11 nokogiri (>= 1.4.4)
12 12 premailer (>= 1.7.1)
... ... @@ -33,25 +33,26 @@ GEM
33 33 activemodel (= 3.0.10)
34 34 activesupport (= 3.0.10)
35 35 activesupport (3.0.10)
36   - addressable (2.2.5)
  36 + addressable (2.2.6)
37 37 archive-tar-minitar (0.5.2)
38 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 42 builder (2.1.2)
43 43 columnize (0.3.4)
44   - crack (0.1.8)
  44 + crack (0.3.1)
45 45 css_parser (1.2.5)
46 46 addressable
47 47 daemons (1.1.4)
48 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 51 orm_adapter (~> 0.0.3)
52 52 warden (~> 1.0.3)
53 53 diff-lcs (1.1.3)
54   - email_spec (1.1.1)
  54 + email_spec (1.2.1)
  55 + mail (~> 2.2)
55 56 rspec (~> 2.0)
56 57 erubis (2.6.6)
57 58 abstract (>= 1.0.0)
... ... @@ -60,15 +61,15 @@ GEM
60 61 factory_girl_rails (1.0.1)
61 62 factory_girl (~> 1.3)
62 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 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 73 has_scope (0.5.1)
73 74 hashie (1.0.0)
74 75 hoptoad_notifier (2.4.11)
... ... @@ -76,10 +77,10 @@ GEM
76 77 builder
77 78 htmlentities (4.3.0)
78 79 i18n (0.5.0)
79   - inherited_resources (1.2.2)
  80 + inherited_resources (1.3.0)
80 81 has_scope (~> 0.5.0)
81 82 responders (~> 0.6.0)
82   - libxml-ruby (1.1.4)
  83 + libxml-ruby (2.2.2)
83 84 lighthouse-api (2.0)
84 85 activeresource (>= 3.0.0)
85 86 activesupport (>= 3.0.0)
... ... @@ -93,40 +94,43 @@ GEM
93 94 mime-types (~> 1.16)
94 95 treetop (~> 1.4.8)
95 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 99 mongoid (2.1.2)
99 100 activemodel (~> 3.0)
100 101 mongo (~> 1.3)
101 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 108 multi_json (1.0.3)
108 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 115 hashie (~> 1.0.0)
115   - multi_json (~> 1.0.0)
116   - rash (~> 0.3.0)
  116 + multi_json (~> 1.0.2)
117 117 orm_adapter (0.0.5)
118 118 oruen_redmine_client (0.0.1)
119 119 activeresource (>= 2.3.0)
120   - pivotal-tracker (0.2.0)
  120 + pivotal-tracker (0.4.1)
121 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 129 polyglot (0.3.2)
126 130 premailer (1.7.3)
127 131 css_parser (>= 1.1.9)
128 132 htmlentities (>= 4.0.0)
129   - rack (1.2.3)
  133 + rack (1.2.4)
130 134 rack-mount (0.6.14)
131 135 rack (>= 1.0.0)
132 136 rack-test (0.5.7)
... ... @@ -146,12 +150,10 @@ GEM
146 150 rdoc (~> 3.4)
147 151 thor (~> 0.14.4)
148 152 rake (0.9.2)
149   - rash (0.3.0)
150   - hashie (~> 1.0.0)
151 153 rbx-require-relative (0.0.5)
152 154 rdoc (3.9.4)
153 155 responders (0.6.4)
154   - rest-client (1.5.1)
  156 + rest-client (1.6.7)
155 157 mime-types (>= 1.16)
156 158 rspec (2.6.0)
157 159 rspec-core (~> 2.6.0)
... ... @@ -195,14 +197,14 @@ GEM
195 197 typhoeus (0.2.4)
196 198 mime-types
197 199 mime-types
198   - tzinfo (0.3.29)
199   - useragent (0.3.1)
  200 + tzinfo (0.3.30)
  201 + useragent (0.3.2)
200 202 warden (1.0.5)
201 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 206 crack (>= 0.1.7)
205   - will_paginate (3.0.0)
  207 + will_paginate (3.0.2)
206 208  
207 209 PLATFORMS
208 210 ruby
... ... @@ -210,11 +212,12 @@ PLATFORMS
210 212 DEPENDENCIES
211 213 SystemTimer
212 214 actionmailer_inline_css (~> 1.3.0)
213   - bson_ext (~> 1.3.1)
  215 + bson_ext (~> 1.4.0)
214 216 database_cleaner (~> 0.6.0)
215 217 devise (~> 1.4.0)
216 218 email_spec
217   - factory_girl_rails
  219 + factory_girl (~> 1.3.3)
  220 + factory_girl_rails (~> 1.0.1)
218 221 haml
219 222 hoptoad_notifier (~> 2.4)
220 223 htmlentities (~> 4.3.0)
... ...
app/models/app.rb
... ... @@ -94,7 +94,7 @@ class App
94 94 end
95 95  
96 96 def last_deploy_at
97   - deploys.last && deploys.last.created_at
  97 + (last_deploy = deploys.last) && last_deploy.created_at
98 98 end
99 99  
100 100  
... ...
app/models/problem.rb
... ... @@ -109,7 +109,9 @@ class Problem
109 109 def cache_app_attributes
110 110 if app
111 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 115 self.save if persisted?
114 116 end
115 117 end
... ...
app/views/apps/show.html.haml
... ... @@ -3,7 +3,7 @@
3 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 4 = javascript_include_tag 'apps.show'
5 5 - content_for :meta do
6   - %strong Errs Caught:
  6 + %strong Errors Caught:
7 7 = @app.problems.count
8 8 %strong Deploy Count:
9 9 = @app.deploys.count
... ... @@ -83,7 +83,7 @@
83 83 %h3 No deploys
84 84  
85 85 - if @app.problems.any?
86   - %h3.clear Errs
  86 + %h3.clear Errors
87 87 = render 'errs/table', :errs => @problems
88 88 - else
89 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 22  
23 23 - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @problem.comments.any?
24 24 - content_for :comments do
25   - %h3 Comments on this Err
  25 + %h3 Comments
26 26 - @problem.comments.each do |comment|
27 27 .window
28 28 %table.comment
... ...
lib/overrides/hoptoad_notifier/hoptoad_notifier.rb
... ... @@ -14,9 +14,8 @@ HoptoadNotifier.module_eval do
14 14 app.save!
15 15 end
16 16 notice.send("api_key=", app.api_key)
17   - # Create notice internally.
18   - debugger
19 17  
  18 + # Create notice internally.
20 19 report = ErrorReport.new(notice.to_xml)
21 20 report.generate_notice!
22 21  
... ...
spec/models/problem_spec.rb
... ... @@ -180,16 +180,16 @@ describe Problem do
180 180 before do
181 181 @app = Factory(:app)
182 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 184 end
185 185  
186 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 188 assert_equal @last_deploy, problem.last_deploy_at
189 189 end
190 190  
191 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 193 next_deploy = 5.minutes.ago.localtime.round(0)
194 194 lambda {
195 195 @deploy = Factory(:deploy, :app => @app, :created_at => next_deploy)
... ...