Commit 3b14e3c21f990bcaed28e2cf46ae1bc247c79468

Authored by Tracey Eubanks
1 parent 29f80cbd
Exists in master and in 1 other branch production

saving state

Gemfile
... ... @@ -11,6 +11,7 @@ gem 'redmine_client', :git => "git://github.com/oruen/redmine_client.git"
11 11 gem 'mongoid_rails_migrations'
12 12 gem 'useragent', '~> 0.3.1'
13 13 gem 'pivotal-tracker'
  14 +gem 'ruby-fogbugz', :require => 'fogbugz', :path => '/Users/tracey/Development/gems/ruby-fogbugz'
14 15  
15 16 platform :ruby do
16 17 gem 'bson_ext', '~> 1.2'
... ...
Gemfile.lock
... ... @@ -5,6 +5,13 @@ GIT
5 5 redmine_client (0.0.1)
6 6 activeresource (>= 2.3.0)
7 7  
  8 +PATH
  9 + remote: /Users/tracey/Development/gems/ruby-fogbugz
  10 + specs:
  11 + ruby-fogbugz (0.0.3)
  12 + crack
  13 + typhoeus
  14 +
8 15 GEM
9 16 remote: http://rubygems.org/
10 17 specs:
... ... @@ -131,6 +138,9 @@ GEM
131 138 thor (0.14.6)
132 139 treetop (1.4.9)
133 140 polyglot (>= 0.3.1)
  141 + typhoeus (0.2.4)
  142 + mime-types
  143 + mime-types
134 144 tzinfo (0.3.26)
135 145 useragent (0.3.1)
136 146 warden (1.0.3)
... ... @@ -159,6 +169,7 @@ DEPENDENCIES
159 169 redmine_client!
160 170 rspec (~> 2.5)
161 171 rspec-rails (~> 2.5)
  172 + ruby-fogbugz!
162 173 thin
163 174 useragent (~> 0.3.1)
164 175 webmock
... ...
app/models/issue_tracker.rb
... ... @@ -68,15 +68,18 @@ class IssueTracker
68 68 end
69 69  
70 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$/, '')
  71 + fogbugz = Fogbugz::Interface.new(:email => email, :password => password, :uri => uri)
  72 + fogbugz.account = account
  73 + fogbugz.token = api_token
  74 +
  75 + issue = {}
  76 + issue['sTitle'] = issue_title err
  77 + issue['sProject'] = project_id
  78 + issue['sEvent'] = self.class.fogbugz_body_template.result(binding)
  79 + issue['sTags'] << 'errbit'
  80 +
  81 + fogbugz.command(
  82 + # 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 83 end
81 84  
82 85 def issue_title err
... ... @@ -116,7 +119,7 @@ class IssueTracker
116 119 end
117 120  
118 121 def fogbugz_body_template
119   - @@fogbugz_body_template ||= ERB.new(File.read(Rails.root + "app/views/errs/fogbugz_body.txt.erb))
  122 + @@fogbugz_body_template ||= ERB.new(File.read(Rails.root + "app/views/errs/fogbugz_body.txt.erb"))
120 123 end
121 124 end
122 125 end
... ...