Commit 29f80cbd06ad919588bf6d7dc79811b93527b2de
1 parent
5328293a
Exists in
master
and in
1 other branch
started integration
Showing
1 changed file
with
20 additions
and
0 deletions
Show diff stats
app/models/issue_tracker.rb
... | ... | @@ -22,6 +22,8 @@ class IssueTracker |
22 | 22 | create_redmine_issue err |
23 | 23 | when 'pivotal' |
24 | 24 | create_pivotal_issue err |
25 | + when 'fogbugz' | |
26 | + create_fogbugz_issue err | |
25 | 27 | end |
26 | 28 | end |
27 | 29 | |
... | ... | @@ -65,6 +67,18 @@ class IssueTracker |
65 | 67 | err.update_attribute :issue_link, "#{Lighthouse::Ticket.site.to_s.sub(/#{Lighthouse::Ticket.site.path}$/, '')}#{Lighthouse::Ticket.element_path(ticket.id, :project_id => project_id)}".sub(/\.xml$/, '') |
66 | 68 | end |
67 | 69 | |
70 | + def create_fogbugz_issue err | |
71 | + FogBugz.account = account | |
72 | + FogBugz.token = api_token | |
73 | + FogBugz::Issue.site | |
74 | + issue = FogBugz::Issue.new(:project_id => project_id) | |
75 | + issue.subject = issue_title err | |
76 | + issue.body = self.class.fogbugz_body_template.result(binding) | |
77 | + issue.tags << 'errbit' | |
78 | + issue.save! | |
79 | + err.update_attribute :issue_link, "#{FogBugz::Issue.site.to_s.sub(/#{FogBugz::Issue.site.path}$/, '')}#{FogBugz::Issue.element_path(issue.id, :project => project_id}".sub(/\.xml$/, '') | |
80 | + end | |
81 | + | |
68 | 82 | def issue_title err |
69 | 83 | "[#{ err.environment }][#{ err.where }] #{err.message.to_s.truncate(100)}" |
70 | 84 | end |
... | ... | @@ -81,6 +95,8 @@ class IssueTracker |
81 | 95 | "You must specify your Redmine url, api token and project id" |
82 | 96 | when 'pivotal' |
83 | 97 | "You must specify your Pivotal Tracker api token and project id" |
98 | + when 'fogbugz' | |
99 | + "You must specify your FogBugz account, project id, username, and password" | |
84 | 100 | end |
85 | 101 | errors.add(:base, message) |
86 | 102 | end |
... | ... | @@ -98,5 +114,9 @@ class IssueTracker |
98 | 114 | def pivotal_body_template |
99 | 115 | @@pivotal_body_template ||= ERB.new(File.read(Rails.root + "app/views/errs/pivotal_body.txt.erb")) |
100 | 116 | end |
117 | + | |
118 | + def fogbugz_body_template | |
119 | + @@fogbugz_body_template ||= ERB.new(File.read(Rails.root + "app/views/errs/fogbugz_body.txt.erb)) | |
120 | + end | |
101 | 121 | end |
102 | 122 | end | ... | ... |