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,12 +14,13 @@ gem 'pivotal-tracker' | ||
| 14 | gem 'ruby-fogbugz', :require => 'fogbugz', :path => '/Users/tracey/Development/gems/ruby-fogbugz' | 14 | gem 'ruby-fogbugz', :require => 'fogbugz', :path => '/Users/tracey/Development/gems/ruby-fogbugz' |
| 15 | 15 | ||
| 16 | platform :ruby do | 16 | platform :ruby do |
| 17 | - gem 'bson_ext', '~> 1.2' | 17 | + gem 'bson_ext', '~> 1.3.1' |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | group :development, :test do | 20 | group :development, :test do |
| 21 | gem 'rspec-rails', '~> 2.5' | 21 | gem 'rspec-rails', '~> 2.5' |
| 22 | gem 'webmock', :require => false | 22 | gem 'webmock', :require => false |
| 23 | + gem 'ruby-debug19', :require => 'ruby-debug' | ||
| 23 | end | 24 | end |
| 24 | 25 | ||
| 25 | group :test do | 26 | group :test do |
Gemfile.lock
| @@ -43,11 +43,13 @@ GEM | @@ -43,11 +43,13 @@ GEM | ||
| 43 | activesupport (= 3.0.5) | 43 | activesupport (= 3.0.5) |
| 44 | activesupport (3.0.5) | 44 | activesupport (3.0.5) |
| 45 | addressable (2.2.5) | 45 | addressable (2.2.5) |
| 46 | + archive-tar-minitar (0.5.2) | ||
| 46 | arel (2.0.9) | 47 | arel (2.0.9) |
| 47 | bcrypt-ruby (2.1.4) | 48 | bcrypt-ruby (2.1.4) |
| 48 | bson (1.3.1) | 49 | bson (1.3.1) |
| 49 | - bson_ext (1.3.0) | 50 | + bson_ext (1.3.1) |
| 50 | builder (2.1.2) | 51 | builder (2.1.2) |
| 52 | + columnize (0.3.4) | ||
| 51 | crack (0.1.8) | 53 | crack (0.1.8) |
| 52 | daemons (1.1.4) | 54 | daemons (1.1.4) |
| 53 | database_cleaner (0.6.7) | 55 | database_cleaner (0.6.7) |
| @@ -72,6 +74,8 @@ GEM | @@ -72,6 +74,8 @@ GEM | ||
| 72 | lighthouse-api (2.0) | 74 | lighthouse-api (2.0) |
| 73 | activeresource (>= 3.0.0) | 75 | activeresource (>= 3.0.0) |
| 74 | activesupport (>= 3.0.0) | 76 | activesupport (>= 3.0.0) |
| 77 | + linecache19 (0.5.12) | ||
| 78 | + ruby_core_source (>= 0.1.4) | ||
| 75 | mail (2.2.17) | 79 | mail (2.2.17) |
| 76 | activesupport (>= 2.3.6) | 80 | activesupport (>= 2.3.6) |
| 77 | i18n (>= 0.4.0) | 81 | i18n (>= 0.4.0) |
| @@ -130,6 +134,16 @@ GEM | @@ -130,6 +134,16 @@ GEM | ||
| 130 | activesupport (~> 3.0) | 134 | activesupport (~> 3.0) |
| 131 | railties (~> 3.0) | 135 | railties (~> 3.0) |
| 132 | rspec (~> 2.5.0) | 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 | thin (1.2.11) | 147 | thin (1.2.11) |
| 134 | daemons (>= 1.0.9) | 148 | daemons (>= 1.0.9) |
| 135 | eventmachine (>= 0.12.6) | 149 | eventmachine (>= 0.12.6) |
| @@ -153,7 +167,7 @@ PLATFORMS | @@ -153,7 +167,7 @@ PLATFORMS | ||
| 153 | ruby | 167 | ruby |
| 154 | 168 | ||
| 155 | DEPENDENCIES | 169 | DEPENDENCIES |
| 156 | - bson_ext (~> 1.2) | 170 | + bson_ext (~> 1.3.1) |
| 157 | database_cleaner (~> 0.6.0) | 171 | database_cleaner (~> 0.6.0) |
| 158 | devise (~> 1.1.8) | 172 | devise (~> 1.1.8) |
| 159 | email_spec | 173 | email_spec |
| @@ -168,6 +182,7 @@ DEPENDENCIES | @@ -168,6 +182,7 @@ DEPENDENCIES | ||
| 168 | redmine_client! | 182 | redmine_client! |
| 169 | rspec (~> 2.5) | 183 | rspec (~> 2.5) |
| 170 | rspec-rails (~> 2.5) | 184 | rspec-rails (~> 2.5) |
| 185 | + ruby-debug19 | ||
| 171 | ruby-fogbugz! | 186 | ruby-fogbugz! |
| 172 | thin | 187 | thin |
| 173 | useragent (~> 0.3.1) | 188 | useragent (~> 0.3.1) |
app/models/app.rb
| @@ -21,7 +21,7 @@ class App | @@ -21,7 +21,7 @@ class App | ||
| 21 | embeds_many :watchers | 21 | embeds_many :watchers |
| 22 | embeds_many :deploys | 22 | embeds_many :deploys |
| 23 | embeds_one :issue_tracker | 23 | embeds_one :issue_tracker |
| 24 | - has_many :errs, :dependent => :destroy | 24 | + has_many :errs, :inverse_of => :app, :dependent => :destroy |
| 25 | 25 | ||
| 26 | before_validation :generate_api_key, :on => :create | 26 | before_validation :generate_api_key, :on => :create |
| 27 | before_save :normalize_github_url | 27 | before_save :normalize_github_url |
app/models/err.rb
| @@ -16,7 +16,7 @@ class Err | @@ -16,7 +16,7 @@ class Err | ||
| 16 | index :last_notice_at | 16 | index :last_notice_at |
| 17 | index :app_id | 17 | index :app_id |
| 18 | 18 | ||
| 19 | - belongs_to :app, inverse_of: :errs | 19 | + belongs_to :app |
| 20 | has_many :notices | 20 | has_many :notices |
| 21 | 21 | ||
| 22 | validates_presence_of :klass, :environment | 22 | validates_presence_of :klass, :environment |
app/models/issue_tracker.rb
| @@ -76,14 +76,12 @@ class IssueTracker | @@ -76,14 +76,12 @@ class IssueTracker | ||
| 76 | issue = {} | 76 | issue = {} |
| 77 | issue['sTitle'] = issue_title err | 77 | issue['sTitle'] = issue_title err |
| 78 | issue['sArea'] = project_id | 78 | issue['sArea'] = project_id |
| 79 | - puts err.app.inspect | ||
| 80 | - puts app_err_url(err.app, err) | ||
| 81 | issue['sEvent'] = self.class.fogbugz_body_template.result(binding) | 79 | issue['sEvent'] = self.class.fogbugz_body_template.result(binding) |
| 82 | issue['sTags'] = ['errbit'].join(',') | 80 | issue['sTags'] = ['errbit'].join(',') |
| 83 | issue['cols'] = ['ixBug'].join(',') | 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 | end | 85 | end |
| 88 | 86 | ||
| 89 | def issue_title err | 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 | <% if notice = err.notices.first %> | 3 | <% if notice = err.notices.first %> |
| 3 | <%= notice.message %> | 4 | <%= notice.message %> |
| 4 | 5 |
app/views/errs/show.html.haml
| @@ -10,7 +10,8 @@ | @@ -10,7 +10,8 @@ | ||
| 10 | %strong Last Notice: | 10 | %strong Last Notice: |
| 11 | = last_notice_at(@err).to_s(:micro) | 11 | = last_notice_at(@err).to_s(:micro) |
| 12 | - content_for :action_bar do | 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 | - if @err.issue_link.blank? | 15 | - if @err.issue_link.blank? |
| 15 | %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 | %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 | - else | 17 | - else |
spec/controllers/apps_controller_spec.rb
| @@ -266,12 +266,13 @@ describe AppsController do | @@ -266,12 +266,13 @@ describe AppsController do | ||
| 266 | context 'with correct params' do | 266 | context 'with correct params' do |
| 267 | before do | 267 | before do |
| 268 | put :update, :id => @app.id, :app => { :issue_tracker_attributes => { | 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 | @app.reload | 270 | @app.reload |
| 271 | end | 271 | end |
| 272 | 272 | ||
| 273 | subject {@app.issue_tracker} | 273 | subject {@app.issue_tracker} |
| 274 | its(:issue_tracker_type) {should == 'fogbugz'} | 274 | its(:issue_tracker_type) {should == 'fogbugz'} |
| 275 | + its(:account) {should == 'abc'} | ||
| 275 | its(:project_id) {should == 'Service - Peon'} | 276 | its(:project_id) {should == 'Service - Peon'} |
| 276 | its(:username) {should == '1234'} | 277 | its(:username) {should == '1234'} |
| 277 | its(:password) {should == '123123'} | 278 | its(:password) {should == '123123'} |