Commit e45067af0192eb9acf68006f6512ac51084017e4

Authored by Ryan Jones
1 parent f2611648
Exists in master and in 1 other branch production

added campfire tracker

Gemfile
... ... @@ -30,6 +30,7 @@ gem 'kaminari'
30 30 gem 'rack-ssl-enforcer'
31 31 gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data
32 32 gem 'rails_autolink', '~> 1.0.9'
  33 +gem 'campy'
33 34  
34 35 platform :ruby do
35 36 gem 'mongo', '= 1.3.1'
... ... @@ -45,7 +46,7 @@ group :development, :test do
45 46 gem 'webmock', :require => false
46 47 unless ENV["CI"]
47 48 gem 'ruby-debug', :platform => :mri_18
48   - gem 'debugger', :platform => :mri_19
  49 + gem (RUBY_VERSION == "1.9.2" ? 'ruby-debug19' : 'debugger'), :platform => :mri_19
49 50 end
50 51 # gem 'rpm_contrib', :git => "git://github.com/bensymonds/rpm_contrib.git", :branch => "mongo-1.4.0_update"
51 52 end
... ...
Gemfile.lock
... ... @@ -34,11 +34,14 @@ GEM
34 34 i18n (~> 0.6)
35 35 multi_json (~> 1.0)
36 36 addressable (2.2.8)
  37 + archive-tar-minitar (0.5.2)
37 38 arel (3.0.2)
38 39 bcrypt-ruby (3.0.1)
39 40 bson (1.3.1)
40 41 bson_ext (1.3.1)
41 42 builder (3.0.0)
  43 + campy (0.1.3)
  44 + multi_json (~> 1.0)
42 45 capybara (1.1.2)
43 46 mime-types (>= 1.16)
44 47 nokogiri (>= 1.3.3)
... ... @@ -55,13 +58,6 @@ GEM
55 58 rdoc
56 59 daemons (1.1.8)
57 60 database_cleaner (0.6.7)
58   - debugger (1.1.3)
59   - columnize (>= 0.3.1)
60   - debugger-linecache (~> 1.1.1)
61   - debugger-ruby_core_source (~> 1.1.2)
62   - debugger-linecache (1.1.1)
63   - debugger-ruby_core_source (>= 1.1.1)
64   - debugger-ruby_core_source (1.1.2)
65 61 devise (1.5.3)
66 62 bcrypt-ruby (~> 3.0)
67 63 orm_adapter (~> 0.0.3)
... ... @@ -112,6 +108,8 @@ GEM
112 108 activesupport (>= 3.0.0)
113 109 linecache (0.46)
114 110 rbx-require-relative (> 0.0.4)
  111 + linecache19 (0.5.13)
  112 + ruby_core_source (>= 0.1.4)
115 113 mail (2.4.4)
116 114 i18n (>= 0.4.0)
117 115 mime-types (~> 1.16)
... ... @@ -219,8 +217,18 @@ GEM
219 217 ruby-debug-base (~> 0.10.4.0)
220 218 ruby-debug-base (0.10.4)
221 219 linecache (>= 0.3)
  220 + ruby-debug-base19 (0.11.25)
  221 + columnize (>= 0.3.1)
  222 + linecache19 (>= 0.5.11)
  223 + ruby_core_source (>= 0.1.4)
  224 + ruby-debug19 (0.11.6)
  225 + columnize (>= 0.3.1)
  226 + linecache19 (>= 0.5.11)
  227 + ruby-debug-base19 (>= 0.11.19)
222 228 ruby-fogbugz (0.1.1)
223 229 crack
  230 + ruby_core_source (0.1.5)
  231 + archive-tar-minitar (>= 0.5.2)
224 232 rubyzip (0.9.8)
225 233 selenium-webdriver (2.21.2)
226 234 childprocess (>= 0.2.5)
... ... @@ -269,9 +277,9 @@ DEPENDENCIES
269 277 actionmailer_inline_css (~> 1.3.0)
270 278 bson (= 1.3.1)
271 279 bson_ext (= 1.3.1)
  280 + campy
272 281 capybara
273 282 database_cleaner (~> 0.6.0)
274   - debugger
275 283 devise (~> 1.5.3)
276 284 email_spec
277 285 execjs
... ... @@ -299,6 +307,7 @@ DEPENDENCIES
299 307 rspec (~> 2.6)
300 308 rspec-rails (~> 2.6)
301 309 ruby-debug
  310 + ruby-debug19
302 311 ruby-fogbugz
303 312 therubyracer
304 313 thin
... ...
app/assets/images/campfire_create.png 0 → 100644

1.57 KB

app/assets/images/campfire_goto.png 0 → 100644

1.61 KB

app/assets/images/campfire_inactive.png 0 → 100644

1.57 KB

app/assets/stylesheets/issue_tracker_icons.css.erb
1 1 /* Issue Tracker inactive, select, create and goto icons */
2 2 <% trackers = IssueTracker.subclasses.map{|t| t.label } << 'none' %>
  3 +
3 4 <% trackers.each do |tracker| %>
4 5 div.issue_tracker.nested label.<%= tracker %> {
5 6 background: url(/assets/<%= tracker %>_inactive.png) no-repeat;
... ...
app/models/issue_tracker.rb
... ... @@ -14,6 +14,7 @@ class IssueTracker
14 14 field :username, :type => String
15 15 field :password, :type => String
16 16 field :ticket_properties, :type => String
  17 + field :room_id, :type => String
17 18  
18 19 validate :check_params
19 20  
... ...
app/models/issue_trackers/campfire_tracker.rb 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +class IssueTrackers::CampfireTracker < IssueTracker
  2 + Label = "campfire"
  3 + Fields = [
  4 + [:account, {
  5 + :placeholder => "Campfire Subdomain"
  6 + }],
  7 + [:api_token, {
  8 + :placeholder => "API Token"
  9 + }],
  10 + [:project_id, {
  11 + :placeholder => "Room ID",
  12 + :label => "Room ID",
  13 + }],
  14 + ]
  15 +
  16 + def check_params
  17 + if Fields.detect {|f| self[f[0]].blank? }
  18 + errors.add :base, 'You must specify your Campfire subdomain, API token and Room ID'
  19 + end
  20 + end
  21 +
  22 + def create_issue(problem, reported_by = nil)
  23 + # build the campfire client
  24 + campy = Campy::Room.new(:account => account, :token => api_token, :room_id => project_id)
  25 +
  26 + # post the issue to the campfire room
  27 + campy.paste issue_title problem
  28 +
  29 + # update the problem to say where it was sent
  30 + problem.update_attributes(
  31 + :issue_link => "Sent to Campfire",
  32 + :issue_type => Label
  33 + )
  34 + end
  35 +
  36 + def url
  37 + "http://#{account}.campfirenow.com"
  38 + end
  39 +end
0 40 \ No newline at end of file
... ...