Commit 08e9103fec202c609b508ef15c78a73db9e73586
1 parent
f4f7de6d
Exists in
master
and in
1 other branch
it works.. sort of. need to figure out why err.app doesn't work
Showing
8 changed files
with
29 additions
and
12 deletions
Show diff stats
Gemfile
... | ... | @@ -14,12 +14,13 @@ gem 'pivotal-tracker' |
14 | 14 | gem 'ruby-fogbugz', :require => 'fogbugz', :path => '/Users/tracey/Development/gems/ruby-fogbugz' |
15 | 15 | |
16 | 16 | platform :ruby do |
17 | - gem 'bson_ext', '~> 1.2' | |
17 | + gem 'bson_ext', '~> 1.3.1' | |
18 | 18 | end |
19 | 19 | |
20 | 20 | group :development, :test do |
21 | 21 | gem 'rspec-rails', '~> 2.5' |
22 | 22 | gem 'webmock', :require => false |
23 | + gem 'ruby-debug19', :require => 'ruby-debug' | |
23 | 24 | end |
24 | 25 | |
25 | 26 | group :test do | ... | ... |
Gemfile.lock
... | ... | @@ -43,11 +43,13 @@ GEM |
43 | 43 | activesupport (= 3.0.5) |
44 | 44 | activesupport (3.0.5) |
45 | 45 | addressable (2.2.5) |
46 | + archive-tar-minitar (0.5.2) | |
46 | 47 | arel (2.0.9) |
47 | 48 | bcrypt-ruby (2.1.4) |
48 | 49 | bson (1.3.1) |
49 | - bson_ext (1.3.0) | |
50 | + bson_ext (1.3.1) | |
50 | 51 | builder (2.1.2) |
52 | + columnize (0.3.4) | |
51 | 53 | crack (0.1.8) |
52 | 54 | daemons (1.1.4) |
53 | 55 | database_cleaner (0.6.7) |
... | ... | @@ -72,6 +74,8 @@ GEM |
72 | 74 | lighthouse-api (2.0) |
73 | 75 | activeresource (>= 3.0.0) |
74 | 76 | activesupport (>= 3.0.0) |
77 | + linecache19 (0.5.12) | |
78 | + ruby_core_source (>= 0.1.4) | |
75 | 79 | mail (2.2.17) |
76 | 80 | activesupport (>= 2.3.6) |
77 | 81 | i18n (>= 0.4.0) |
... | ... | @@ -130,6 +134,16 @@ GEM |
130 | 134 | activesupport (~> 3.0) |
131 | 135 | railties (~> 3.0) |
132 | 136 | rspec (~> 2.5.0) |
137 | + ruby-debug-base19 (0.11.25) | |
138 | + columnize (>= 0.3.1) | |
139 | + linecache19 (>= 0.5.11) | |
140 | + ruby_core_source (>= 0.1.4) | |
141 | + ruby-debug19 (0.11.6) | |
142 | + columnize (>= 0.3.1) | |
143 | + linecache19 (>= 0.5.11) | |
144 | + ruby-debug-base19 (>= 0.11.19) | |
145 | + ruby_core_source (0.1.5) | |
146 | + archive-tar-minitar (>= 0.5.2) | |
133 | 147 | thin (1.2.11) |
134 | 148 | daemons (>= 1.0.9) |
135 | 149 | eventmachine (>= 0.12.6) |
... | ... | @@ -153,7 +167,7 @@ PLATFORMS |
153 | 167 | ruby |
154 | 168 | |
155 | 169 | DEPENDENCIES |
156 | - bson_ext (~> 1.2) | |
170 | + bson_ext (~> 1.3.1) | |
157 | 171 | database_cleaner (~> 0.6.0) |
158 | 172 | devise (~> 1.1.8) |
159 | 173 | email_spec |
... | ... | @@ -168,6 +182,7 @@ DEPENDENCIES |
168 | 182 | redmine_client! |
169 | 183 | rspec (~> 2.5) |
170 | 184 | rspec-rails (~> 2.5) |
185 | + ruby-debug19 | |
171 | 186 | ruby-fogbugz! |
172 | 187 | thin |
173 | 188 | useragent (~> 0.3.1) | ... | ... |
app/models/app.rb
... | ... | @@ -21,7 +21,7 @@ class App |
21 | 21 | embeds_many :watchers |
22 | 22 | embeds_many :deploys |
23 | 23 | embeds_one :issue_tracker |
24 | - has_many :errs, :dependent => :destroy | |
24 | + has_many :errs, :inverse_of => :app, :dependent => :destroy | |
25 | 25 | |
26 | 26 | before_validation :generate_api_key, :on => :create |
27 | 27 | before_save :normalize_github_url | ... | ... |
app/models/err.rb
app/models/issue_tracker.rb
... | ... | @@ -76,14 +76,12 @@ class IssueTracker |
76 | 76 | issue = {} |
77 | 77 | issue['sTitle'] = issue_title err |
78 | 78 | issue['sArea'] = project_id |
79 | - puts err.app.inspect | |
80 | - puts app_err_url(err.app, err) | |
81 | 79 | issue['sEvent'] = self.class.fogbugz_body_template.result(binding) |
82 | 80 | issue['sTags'] = ['errbit'].join(',') |
83 | 81 | issue['cols'] = ['ixBug'].join(',') |
84 | 82 | |
85 | - # fb_resp = fogbugz.command(:new, issue) | |
86 | - # err.update_attribute :issue_link, "https://#{account}.fogbugz.com/default.asp?#{fb_resp['case']['ixBug']}" | |
83 | + fb_resp = fogbugz.command(:new, issue) | |
84 | + err.update_attribute :issue_link, "https://#{account}.fogbugz.com/default.asp?#{fb_resp['case']['ixBug']}" | |
87 | 85 | end |
88 | 86 | |
89 | 87 | def issue_title err | ... | ... |
app/views/errs/fogbugz_body.txt.erb
1 | -"See this exception on Errbit": <%= app_err_url(err.app, err) %> | |
1 | +<% # some sort of stupid mongoid bugg that doesn't allow us to use err.app. have to explicitly search for it %> | |
2 | +"See this exception on Errbit": <%= app_err_url(App.where(_id: err.app_id).first, err) %> | |
2 | 3 | <% if notice = err.notices.first %> |
3 | 4 | <%= notice.message %> |
4 | 5 | ... | ... |
app/views/errs/show.html.haml
... | ... | @@ -10,7 +10,8 @@ |
10 | 10 | %strong Last Notice: |
11 | 11 | = last_notice_at(@err).to_s(:micro) |
12 | 12 | - content_for :action_bar do |
13 | - - if @err.app.issue_tracker | |
13 | + / some sort of mongoid association bug or something. have to actually search for the stupid app instead of using @err.app | |
14 | + - if App.where(_id: @err.app_id).first.issue_tracker | |
14 | 15 | - if @err.issue_link.blank? |
15 | 16 | %span= link_to 'create issue', create_issue_app_err_path(@app, @err), :method => :post, :class => "#{@app.issue_tracker.issue_tracker_type}_create create-issue" |
16 | 17 | - else | ... | ... |
spec/controllers/apps_controller_spec.rb
... | ... | @@ -266,12 +266,13 @@ describe AppsController do |
266 | 266 | context 'with correct params' do |
267 | 267 | before do |
268 | 268 | put :update, :id => @app.id, :app => { :issue_tracker_attributes => { |
269 | - :issue_tracker_type => 'fogbugz', :project_id => 'Service - Peon', :username => '1234', :password => '123123' } } | |
269 | + :issue_tracker_type => 'fogbugz', :account => 'abc', :project_id => 'Service - Peon', :username => '1234', :password => '123123' } } | |
270 | 270 | @app.reload |
271 | 271 | end |
272 | 272 | |
273 | 273 | subject {@app.issue_tracker} |
274 | 274 | its(:issue_tracker_type) {should == 'fogbugz'} |
275 | + its(:account) {should == 'abc'} | |
275 | 276 | its(:project_id) {should == 'Service - Peon'} |
276 | 277 | its(:username) {should == '1234'} |
277 | 278 | its(:password) {should == '123123'} | ... | ... |