diff --git a/Gemfile b/Gemfile index 245522e..7ad0b9c 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ gem 'kaminari' gem 'rack-ssl-enforcer' gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data gem 'rails_autolink', '~> 1.0.9' +gem 'campy' platform :ruby do gem 'mongo', '= 1.3.1' @@ -45,7 +46,7 @@ group :development, :test do gem 'webmock', :require => false unless ENV["CI"] gem 'ruby-debug', :platform => :mri_18 - gem 'debugger', :platform => :mri_19 + gem (RUBY_VERSION == "1.9.2" ? 'ruby-debug19' : 'debugger'), :platform => :mri_19 end # gem 'rpm_contrib', :git => "git://github.com/bensymonds/rpm_contrib.git", :branch => "mongo-1.4.0_update" end diff --git a/Gemfile.lock b/Gemfile.lock index ee859b2..f86a234 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,11 +34,14 @@ GEM i18n (~> 0.6) multi_json (~> 1.0) addressable (2.2.8) + archive-tar-minitar (0.5.2) arel (3.0.2) bcrypt-ruby (3.0.1) bson (1.3.1) bson_ext (1.3.1) builder (3.0.0) + campy (0.1.3) + multi_json (~> 1.0) capybara (1.1.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -55,13 +58,6 @@ GEM rdoc daemons (1.1.8) database_cleaner (0.6.7) - debugger (1.1.3) - columnize (>= 0.3.1) - debugger-linecache (~> 1.1.1) - debugger-ruby_core_source (~> 1.1.2) - debugger-linecache (1.1.1) - debugger-ruby_core_source (>= 1.1.1) - debugger-ruby_core_source (1.1.2) devise (1.5.3) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) @@ -112,6 +108,8 @@ GEM activesupport (>= 3.0.0) linecache (0.46) rbx-require-relative (> 0.0.4) + linecache19 (0.5.13) + ruby_core_source (>= 0.1.4) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -219,8 +217,18 @@ GEM ruby-debug-base (~> 0.10.4.0) ruby-debug-base (0.10.4) linecache (>= 0.3) + ruby-debug-base19 (0.11.25) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby_core_source (>= 0.1.4) + ruby-debug19 (0.11.6) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby-debug-base19 (>= 0.11.19) ruby-fogbugz (0.1.1) crack + ruby_core_source (0.1.5) + archive-tar-minitar (>= 0.5.2) rubyzip (0.9.8) selenium-webdriver (2.21.2) childprocess (>= 0.2.5) @@ -269,9 +277,9 @@ DEPENDENCIES actionmailer_inline_css (~> 1.3.0) bson (= 1.3.1) bson_ext (= 1.3.1) + campy capybara database_cleaner (~> 0.6.0) - debugger devise (~> 1.5.3) email_spec execjs @@ -299,6 +307,7 @@ DEPENDENCIES rspec (~> 2.6) rspec-rails (~> 2.6) ruby-debug + ruby-debug19 ruby-fogbugz therubyracer thin diff --git a/app/assets/images/campfire_create.png b/app/assets/images/campfire_create.png new file mode 100644 index 0000000..a28b9a0 Binary files /dev/null and b/app/assets/images/campfire_create.png differ diff --git a/app/assets/images/campfire_goto.png b/app/assets/images/campfire_goto.png new file mode 100644 index 0000000..d7e468b Binary files /dev/null and b/app/assets/images/campfire_goto.png differ diff --git a/app/assets/images/campfire_inactive.png b/app/assets/images/campfire_inactive.png new file mode 100644 index 0000000..d175a05 Binary files /dev/null and b/app/assets/images/campfire_inactive.png differ diff --git a/app/assets/stylesheets/issue_tracker_icons.css.erb b/app/assets/stylesheets/issue_tracker_icons.css.erb index ca86f8e..ba38725 100644 --- a/app/assets/stylesheets/issue_tracker_icons.css.erb +++ b/app/assets/stylesheets/issue_tracker_icons.css.erb @@ -1,5 +1,6 @@ /* Issue Tracker inactive, select, create and goto icons */ <% trackers = IssueTracker.subclasses.map{|t| t.label } << 'none' %> + <% trackers.each do |tracker| %> div.issue_tracker.nested label.<%= tracker %> { background: url(/assets/<%= tracker %>_inactive.png) no-repeat; diff --git a/app/models/issue_tracker.rb b/app/models/issue_tracker.rb index ba4c3ad..f8bb84e 100644 --- a/app/models/issue_tracker.rb +++ b/app/models/issue_tracker.rb @@ -14,6 +14,7 @@ class IssueTracker field :username, :type => String field :password, :type => String field :ticket_properties, :type => String + field :room_id, :type => String validate :check_params diff --git a/app/models/issue_trackers/campfire_tracker.rb b/app/models/issue_trackers/campfire_tracker.rb new file mode 100644 index 0000000..8d75a7e --- /dev/null +++ b/app/models/issue_trackers/campfire_tracker.rb @@ -0,0 +1,39 @@ +class IssueTrackers::CampfireTracker < IssueTracker + Label = "campfire" + Fields = [ + [:account, { + :placeholder => "Campfire Subdomain" + }], + [:api_token, { + :placeholder => "API Token" + }], + [:project_id, { + :placeholder => "Room ID", + :label => "Room ID", + }], + ] + + def check_params + if Fields.detect {|f| self[f[0]].blank? } + errors.add :base, 'You must specify your Campfire subdomain, API token and Room ID' + end + end + + def create_issue(problem, reported_by = nil) + # build the campfire client + campy = Campy::Room.new(:account => account, :token => api_token, :room_id => project_id) + + # post the issue to the campfire room + campy.paste issue_title problem + + # update the problem to say where it was sent + problem.update_attributes( + :issue_link => "Sent to Campfire", + :issue_type => Label + ) + end + + def url + "http://#{account}.campfirenow.com" + end +end \ No newline at end of file -- libgit2 0.21.2