From 86b6e4df184c0784ea84eaaba0bc28d5cde258b8 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Thu, 4 Oct 2012 11:32:54 +1300 Subject: [PATCH] Allow unneeded gems to be removed to disable the corresponding issue tracker, notification service, or authentication provider --- Gemfile | 58 ++++++++++++++++++++++++++++++++++++---------------------- Gemfile.lock | 7 ++++--- app/models/issue_trackers/fogbugz_tracker.rb | 87 ++++++++++++++++++++++++++++++++++++++++++++------------------------------------------- app/models/issue_trackers/github_issues_tracker.rb | 96 +++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- app/models/issue_trackers/lighthouse_tracker.rb | 83 ++++++++++++++++++++++++++++++++++++++++++----------------------------------------- app/models/issue_trackers/pivotal_labs_tracker.rb | 69 +++++++++++++++++++++++++++++++++++---------------------------------- app/models/issue_trackers/redmine_tracker.rb | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------ app/models/notification_services/campfire_service.rb | 48 +++++++++++++++++++++++++----------------------- app/models/notification_services/hipchat_service.rb | 50 ++++++++++++++++++++++++++------------------------ config/initializers/_load_config.rb | 3 +++ lib/issue_trackers/apis/mingle.rb | 2 ++ 11 files changed, 321 insertions(+), 291 deletions(-) diff --git a/Gemfile b/Gemfile index 995a004..5d99e7c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,43 +1,55 @@ source 'http://rubygems.org' gem 'rails', '3.2.8' - -gem 'nokogiri' gem 'mongoid', '~> 2.4.10' - -# force SSL -gem 'rack-ssl', :require => 'rack/ssl' - +gem 'mongoid_rails_migrations' +gem 'devise', '~> 1.5.3' +gem 'nokogiri' gem 'haml' gem 'htmlentities', "~> 4.3.0" +gem 'rack-ssl', :require => 'rack/ssl' # force SSL -gem 'devise', '~> 1.5.3' +gem 'useragent', '~> 0.3.1' +gem 'inherited_resources' +gem 'SystemTimer', :platform => :ruby_18 +gem 'actionmailer_inline_css', "~> 1.3.0" +gem 'kaminari' +gem 'rack-ssl-enforcer' +gem 'fabrication', "~> 1.3.0" # Used for both tests and demo data +gem 'rails_autolink', '~> 1.0.9' +# Please don't update hoptoad_notifier to airbrake. +# It's for internal use only, and we monkeypatch certain methods +gem 'hoptoad_notifier', "~> 2.4" -gem 'omniauth-github' -gem 'oa-core' +# Remove / comment out any of the gems below if you want to disable +# a given issue tracker, notification service, or authentication. + +# Issue Trackers +# --------------------------------------- +# Lighthouse gem 'lighthouse-api' +# Redmine gem 'oruen_redmine_client', :require => 'redmine_client' -gem 'mongoid_rails_migrations' -gem 'useragent', '~> 0.3.1' +# Pivotal Tracker gem 'pivotal-tracker' +# Fogbugz gem 'ruby-fogbugz', :require => 'fogbugz' - +# Github Issues gem 'octokit', '~> 1.0.0' -gem 'inherited_resources' -gem 'SystemTimer', :platform => :ruby_18 -gem 'actionmailer_inline_css', "~> 1.3.0" -gem 'kaminari' -gem 'rack-ssl-enforcer' -gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data -gem 'rails_autolink', '~> 1.0.9' +# Notification services +# --------------------------------------- +# Campfire gem 'campy' +# Hipchat gem 'hipchat' -# Please don't update this to airbrake - We override the send_notice method -# to handle internal errors. -gem 'hoptoad_notifier', "~> 2.4" +# Authentication +# --------------------------------------- +# GitHub OAuth +gem 'omniauth-github' + platform :ruby do gem 'mongo', '= 1.6.2' @@ -45,6 +57,8 @@ platform :ruby do gem 'bson_ext', '= 1.6.2' end +gem 'omniauth' +gem 'oa-core' gem 'ri_cal' gem 'yajl-ruby', :require => "yajl" diff --git a/Gemfile.lock b/Gemfile.lock index b20d5f3..58e1b7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM execjs (1.4.0) multi_json (~> 1.0) fabrication (1.3.2) - faraday (0.8.1) + faraday (0.8.4) multipart-post (~> 1.1) faraday_middleware (0.8.8) faraday (>= 0.7.4, < 0.9) @@ -172,13 +172,13 @@ GEM faraday_middleware (~> 0.8) hashie (~> 1.2) multi_json (~> 1.3) - omniauth (1.1.0) + omniauth (1.1.1) hashie (~> 1.2) rack omniauth-github (1.0.2) omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) - omniauth-oauth2 (1.1.0) + omniauth-oauth2 (1.1.1) oauth2 (~> 0.8.0) omniauth (~> 1.0) orm_adapter (0.0.7) @@ -328,6 +328,7 @@ DEPENDENCIES nokogiri oa-core octokit (~> 1.0.0) + omniauth omniauth-github oruen_redmine_client pivotal-tracker diff --git a/app/models/issue_trackers/fogbugz_tracker.rb b/app/models/issue_trackers/fogbugz_tracker.rb index f315f23..3ef9d44 100644 --- a/app/models/issue_trackers/fogbugz_tracker.rb +++ b/app/models/issue_trackers/fogbugz_tracker.rb @@ -1,52 +1,53 @@ -class IssueTrackers::FogbugzTracker < IssueTracker - Label = "fogbugz" - Fields = [ - [:project_id, { - :label => "Area Name" - }], - [:account, { - :label => "FogBugz URL", - :placeholder => "abc from http://abc.fogbugz.com/" - }], - [:username, { - :placeholder => "Username/Email for your account" - }], - [:password, { - :placeholder => "Password for your account" - }] - ] - - def check_params - if Fields.detect {|f| self[f[0]].blank? } - errors.add :base, 'You must specify your FogBugz Area Name, FogBugz URL, Username, and Password' +if defined? Fogbugz + class IssueTrackers::FogbugzTracker < IssueTracker + Label = "fogbugz" + Fields = [ + [:project_id, { + :label => "Area Name" + }], + [:account, { + :label => "FogBugz URL", + :placeholder => "abc from http://abc.fogbugz.com/" + }], + [:username, { + :placeholder => "Username/Email for your account" + }], + [:password, { + :placeholder => "Password for your account" + }] + ] + + def check_params + if Fields.detect {|f| self[f[0]].blank? } + errors.add :base, 'You must specify your FogBugz Area Name, FogBugz URL, Username, and Password' + end end - end - def create_issue(problem, reported_by = nil) - fogbugz = Fogbugz::Interface.new(:email => username, :password => password, :uri => "https://#{account}.fogbugz.com") - fogbugz.authenticate + def create_issue(problem, reported_by = nil) + fogbugz = Fogbugz::Interface.new(:email => username, :password => password, :uri => "https://#{account}.fogbugz.com") + fogbugz.authenticate - issue = {} - issue['sTitle'] = issue_title problem - issue['sArea'] = project_id - issue['sEvent'] = body_template.result(binding) - issue['sTags'] = ['errbit'].join(',') - issue['cols'] = ['ixBug'].join(',') + issue = {} + issue['sTitle'] = issue_title problem + issue['sArea'] = project_id + issue['sEvent'] = body_template.result(binding) + issue['sTags'] = ['errbit'].join(',') + issue['cols'] = ['ixBug'].join(',') - fb_resp = fogbugz.command(:new, issue) - problem.update_attributes( - :issue_link => "https://#{account}.fogbugz.com/default.asp?#{fb_resp['case']['ixBug']}", - :issue_type => Label - ) + fb_resp = fogbugz.command(:new, issue) + problem.update_attributes( + :issue_link => "https://#{account}.fogbugz.com/default.asp?#{fb_resp['case']['ixBug']}", + :issue_type => Label + ) - end + end - def body_template - @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/fogbugz_body.txt.erb")) - end + def body_template + @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/fogbugz_body.txt.erb")) + end - def url - "http://#{account}.fogbugz.com/" + def url + "http://#{account}.fogbugz.com/" + end end end - diff --git a/app/models/issue_trackers/github_issues_tracker.rb b/app/models/issue_trackers/github_issues_tracker.rb index 7bec1b0..1dd3431 100644 --- a/app/models/issue_trackers/github_issues_tracker.rb +++ b/app/models/issue_trackers/github_issues_tracker.rb @@ -1,55 +1,57 @@ -class IssueTrackers::GithubIssuesTracker < IssueTracker - Label = "github" - Note = 'Please configure your github repository in the GITHUB REPO field above.
' << - 'Instead of providing your username & password, you can link your Github account ' << - 'to your user profile, and allow Errbit to create issues using your OAuth token.' - - Fields = [ - [:username, { - :placeholder => "Your username on GitHub" - }], - [:password, { - :placeholder => "Password for your account" - }] - ] - - attr_accessor :oauth_token - - def project_id - app.github_repo - end - - def check_params - if Fields.detect {|f| self[f[0]].blank? } - errors.add :base, 'You must specify your GitHub username and password' +if defined? Octokit + class IssueTrackers::GithubIssuesTracker < IssueTracker + Label = "github" + Note = 'Please configure your github repository in the GITHUB REPO field above.
' << + 'Instead of providing your username & password, you can link your Github account ' << + 'to your user profile, and allow Errbit to create issues using your OAuth token.' + + Fields = [ + [:username, { + :placeholder => "Your username on GitHub" + }], + [:password, { + :placeholder => "Password for your account" + }] + ] + + attr_accessor :oauth_token + + def project_id + app.github_repo end - end - def create_issue(problem, reported_by = nil) - # Login using OAuth token, if given. - if oauth_token - client = Octokit::Client.new(:login => username, :oauth_token => oauth_token) - else - client = Octokit::Client.new(:login => username, :password => password) + def check_params + if Fields.detect {|f| self[f[0]].blank? } + errors.add :base, 'You must specify your GitHub username and password' + end end - begin - issue = client.create_issue(project_id, issue_title(problem), body_template.result(binding).unpack('C*').pack('U*'), options = {}) - problem.update_attributes( - :issue_link => issue.html_url, - :issue_type => Label - ) - - rescue Octokit::Unauthorized - raise IssueTrackers::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password." + def create_issue(problem, reported_by = nil) + # Login using OAuth token, if given. + if oauth_token + client = Octokit::Client.new(:login => username, :oauth_token => oauth_token) + else + client = Octokit::Client.new(:login => username, :password => password) + end + + begin + issue = client.create_issue(project_id, issue_title(problem), body_template.result(binding).unpack('C*').pack('U*'), options = {}) + problem.update_attributes( + :issue_link => issue.html_url, + :issue_type => Label + ) + + rescue Octokit::Unauthorized + raise IssueTrackers::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password." + end end - end - def body_template - @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/github_issues_body.txt.erb").gsub(/^\s*/, '')) - end + def body_template + @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/github_issues_body.txt.erb").gsub(/^\s*/, '')) + end - def url - "https://github.com/#{project_id}/issues" + def url + "https://github.com/#{project_id}/issues" + end end -end +end \ No newline at end of file diff --git a/app/models/issue_trackers/lighthouse_tracker.rb b/app/models/issue_trackers/lighthouse_tracker.rb index 39bad82..8c2b0a2 100644 --- a/app/models/issue_trackers/lighthouse_tracker.rb +++ b/app/models/issue_trackers/lighthouse_tracker.rb @@ -1,49 +1,50 @@ -class IssueTrackers::LighthouseTracker < IssueTracker - Label = "lighthouseapp" - Fields = [ - [:account, { - :placeholder => "abc from http://abc.lighthouseapp.com" - }], - [:api_token, { - :placeholder => "API Token for your account" - }], - [:project_id, { - :placeholder => "Lighthouse project" - }] - ] - - def check_params - if Fields.detect {|f| self[f[0]].blank? } - errors.add :base, 'You must specify your Lighthouseapp account, API token and Project ID' +if defined? Lighthouse + class IssueTrackers::LighthouseTracker < IssueTracker + Label = "lighthouseapp" + Fields = [ + [:account, { + :placeholder => "abc from http://abc.lighthouseapp.com" + }], + [:api_token, { + :placeholder => "API Token for your account" + }], + [:project_id, { + :placeholder => "Lighthouse project" + }] + ] + + def check_params + if Fields.detect {|f| self[f[0]].blank? } + errors.add :base, 'You must specify your Lighthouseapp account, API token and Project ID' + end end - end - def create_issue(problem, reported_by = nil) - Lighthouse.account = account - Lighthouse.token = api_token - # updating lighthouse account - Lighthouse::Ticket.site - Lighthouse::Ticket.format = :xml - ticket = Lighthouse::Ticket.new(:project_id => project_id) - ticket.title = issue_title problem + def create_issue(problem, reported_by = nil) + Lighthouse.account = account + Lighthouse.token = api_token + # updating lighthouse account + Lighthouse::Ticket.site + Lighthouse::Ticket.format = :xml + ticket = Lighthouse::Ticket.new(:project_id => project_id) + ticket.title = issue_title problem - ticket.body = body_template.result(binding) + ticket.body = body_template.result(binding) - ticket.tags << "errbit" - ticket.save! - problem.update_attributes( - :issue_link => "#{Lighthouse::Ticket.site.to_s.sub(/#{Lighthouse::Ticket.site.path}$/, '')}#{Lighthouse::Ticket.element_path(ticket.id, :project_id => project_id)}".sub(/\.xml$/, ''), - :issue_type => Label - ) + ticket.tags << "errbit" + ticket.save! + problem.update_attributes( + :issue_link => "#{Lighthouse::Ticket.site.to_s.sub(/#{Lighthouse::Ticket.site.path}$/, '')}#{Lighthouse::Ticket.element_path(ticket.id, :project_id => project_id)}".sub(/\.xml$/, ''), + :issue_type => Label + ) - end + end - def body_template - @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/lighthouseapp_body.txt.erb").gsub(/^\s*/, '')) - end + def body_template + @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/lighthouseapp_body.txt.erb").gsub(/^\s*/, '')) + end - def url - "http://#{account}.lighthouseapp.com" + def url + "http://#{account}.lighthouseapp.com" + end end -end - +end \ No newline at end of file diff --git a/app/models/issue_trackers/pivotal_labs_tracker.rb b/app/models/issue_trackers/pivotal_labs_tracker.rb index 9a26043..cc014f9 100644 --- a/app/models/issue_trackers/pivotal_labs_tracker.rb +++ b/app/models/issue_trackers/pivotal_labs_tracker.rb @@ -1,42 +1,43 @@ -class IssueTrackers::PivotalLabsTracker < IssueTracker - Label = "pivotal" - Fields = [ - [:api_token, { - :placeholder => "API Token for your account" - }], - [:project_id, {}] - ] +if defined? PivotalTracker + class IssueTrackers::PivotalLabsTracker < IssueTracker + Label = "pivotal" + Fields = [ + [:api_token, { + :placeholder => "API Token for your account" + }], + [:project_id, {}] + ] - def check_params - if Fields.detect {|f| self[f[0]].blank? } - errors.add :base, 'You must specify your Pivotal Tracker API token and Project ID' + def check_params + if Fields.detect {|f| self[f[0]].blank? } + errors.add :base, 'You must specify your Pivotal Tracker API token and Project ID' + end end - end - def create_issue(problem, reported_by = nil) - PivotalTracker::Client.token = api_token - PivotalTracker::Client.use_ssl = true - project = PivotalTracker::Project.find project_id.to_i - story = project.stories.create :name => issue_title(problem), - :story_type => 'bug', :description => body_template.result(binding), - :requested_by => reported_by.name + def create_issue(problem, reported_by = nil) + PivotalTracker::Client.token = api_token + PivotalTracker::Client.use_ssl = true + project = PivotalTracker::Project.find project_id.to_i + story = project.stories.create :name => issue_title(problem), + :story_type => 'bug', :description => body_template.result(binding), + :requested_by => reported_by.name - if story.errors.present? - raise IssueTrackers::IssueTrackerError, story.errors.first - else - problem.update_attributes( - :issue_link => "https://www.pivotaltracker.com/story/show/#{story.id}", - :issue_type => Label - ) + if story.errors.present? + raise IssueTrackers::IssueTrackerError, story.errors.first + else + problem.update_attributes( + :issue_link => "https://www.pivotaltracker.com/story/show/#{story.id}", + :issue_type => Label + ) + end end - end - def body_template - @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/pivotal_body.txt.erb")) - end + def body_template + @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/pivotal_body.txt.erb")) + end - def url - "https://www.pivotaltracker.com/" + def url + "https://www.pivotaltracker.com/" + end end -end - +end \ No newline at end of file diff --git a/app/models/issue_trackers/redmine_tracker.rb b/app/models/issue_trackers/redmine_tracker.rb index 6895013..dabfacb 100644 --- a/app/models/issue_trackers/redmine_tracker.rb +++ b/app/models/issue_trackers/redmine_tracker.rb @@ -1,63 +1,64 @@ -class IssueTrackers::RedmineTracker < IssueTracker - Label = "redmine" - Fields = [ - [:account, { - :label => "Redmine URL", - :placeholder => "e.g. http://www.redmine.org/" - }], - [:api_token, { - :placeholder => "API Token for your account" - }], - [:project_id, { - :label => "Ticket Project", - :placeholder => "Redmine Project where tickets will be created" - }], - [:alt_project_id, { - :optional => true, - :label => "App Project", - :placeholder => "Where app's files & revisions can be viewed. (Leave blank to use the above project by default)" - }] - ] +if defined? RedmineClient + class IssueTrackers::RedmineTracker < IssueTracker + Label = "redmine" + Fields = [ + [:account, { + :label => "Redmine URL", + :placeholder => "e.g. http://www.redmine.org/" + }], + [:api_token, { + :placeholder => "API Token for your account" + }], + [:project_id, { + :label => "Ticket Project", + :placeholder => "Redmine Project where tickets will be created" + }], + [:alt_project_id, { + :optional => true, + :label => "App Project", + :placeholder => "Where app's files & revisions can be viewed. (Leave blank to use the above project by default)" + }] + ] - def check_params - if Fields.detect {|f| self[f[0]].blank? && !f[1][:optional]} - errors.add :base, 'You must specify your Redmine URL, API token and Project ID' + def check_params + if Fields.detect {|f| self[f[0]].blank? && !f[1][:optional]} + errors.add :base, 'You must specify your Redmine URL, API token and Project ID' + end end - end - def create_issue(problem, reported_by = nil) - token = api_token - acc = account - RedmineClient::Base.configure do - self.token = token - self.site = acc - self.format = :xml + def create_issue(problem, reported_by = nil) + token = api_token + acc = account + RedmineClient::Base.configure do + self.token = token + self.site = acc + self.format = :xml + end + issue = RedmineClient::Issue.new(:project_id => project_id) + issue.subject = issue_title problem + issue.description = body_template.result(binding) + issue.save! + problem.update_attributes( + :issue_link => "#{RedmineClient::Issue.site.to_s.sub(/#{RedmineClient::Issue.site.path}$/, '')}#{RedmineClient::Issue.element_path(issue.id, :project_id => project_id)}".sub(/\.xml\?project_id=#{project_id}$/, "\?project_id=#{project_id}"), + :issue_type => Label + ) end - issue = RedmineClient::Issue.new(:project_id => project_id) - issue.subject = issue_title problem - issue.description = body_template.result(binding) - issue.save! - problem.update_attributes( - :issue_link => "#{RedmineClient::Issue.site.to_s.sub(/#{RedmineClient::Issue.site.path}$/, '')}#{RedmineClient::Issue.element_path(issue.id, :project_id => project_id)}".sub(/\.xml\?project_id=#{project_id}$/, "\?project_id=#{project_id}"), - :issue_type => Label - ) - end - def url_to_file(file_path, line_number = nil) - # alt_project_id let's users specify a different project for tickets / app files. - project = self.alt_project_id.present? ? self.alt_project_id : self.project_id - url = "#{self.account}/projects/#{project}/repository/annotate/#{file_path.sub(/^\//,'')}" - line_number ? url << "#L#{line_number}" : url - end + def url_to_file(file_path, line_number = nil) + # alt_project_id let's users specify a different project for tickets / app files. + project = self.alt_project_id.present? ? self.alt_project_id : self.project_id + url = "#{self.account}/projects/#{project}/repository/annotate/#{file_path.sub(/^\//,'')}" + line_number ? url << "#L#{line_number}" : url + end - def body_template - @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/textile_body.txt.erb")) - end + def body_template + @@body_template ||= ERB.new(File.read(Rails.root + "app/views/issue_trackers/textile_body.txt.erb")) + end - def url - acc_url = account.start_with?('http') ? account : "http://#{account}" - URI.parse("#{acc_url}?project_id=#{project_id}").to_s - rescue URI::InvalidURIError + def url + acc_url = account.start_with?('http') ? account : "http://#{account}" + URI.parse("#{acc_url}?project_id=#{project_id}").to_s + rescue URI::InvalidURIError + end end end - diff --git a/app/models/notification_services/campfire_service.rb b/app/models/notification_services/campfire_service.rb index b6e1604..986fbff 100644 --- a/app/models/notification_services/campfire_service.rb +++ b/app/models/notification_services/campfire_service.rb @@ -1,29 +1,31 @@ -class NotificationServices::CampfireService < NotificationService - Label = "campfire" - Fields = [ - [:subdomain, { - :placeholder => "Campfire Subdomain" - }], - [:api_token, { - :placeholder => "API Token" - }], - [:room_id, { - :placeholder => "Room ID", - :label => "Room ID" - }], - ] +if defined? Campy + class NotificationServices::CampfireService < NotificationService + Label = "campfire" + Fields = [ + [:subdomain, { + :placeholder => "Campfire Subdomain" + }], + [:api_token, { + :placeholder => "API Token" + }], + [:room_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' + 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 - end - def create_notification(problem) - # build the campfire client - campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id) + def create_notification(problem) + # build the campfire client + campy = Campy::Room.new(:account => subdomain, :token => api_token, :room_id => room_id) - # post the issue to the campfire room - campy.speak "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}" + # post the issue to the campfire room + campy.speak "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}" + end end end \ No newline at end of file diff --git a/app/models/notification_services/hipchat_service.rb b/app/models/notification_services/hipchat_service.rb index 8680df7..8ecb9bb 100644 --- a/app/models/notification_services/hipchat_service.rb +++ b/app/models/notification_services/hipchat_service.rb @@ -1,29 +1,31 @@ -class NotificationServices::HipchatService < NotificationService - Label = 'hipchat' - Fields = [ - [:api_token, { - :placeholder => "API Token" - }], - [:room_id, { - :placeholder => "Room ID", - :label => "Room ID" - }], - ] +if defined? HipChat + class NotificationServices::HipchatService < NotificationService + Label = 'hipchat' + Fields = [ + [:api_token, { + :placeholder => "API Token" + }], + [:room_id, { + :placeholder => "Room ID", + :label => "Room ID" + }], + ] - def check_params - if Fields.any? { |f, _| self[f].blank? } - errors.add :base, 'You must specify your Hipchat API token and Room ID' + def check_params + if Fields.any? { |f, _| self[f].blank? } + errors.add :base, 'You must specify your Hipchat API token and Room ID' + end end - end - def create_notification(problem) - url = app_problem_url problem.app, problem - message = <<-MSG.strip_heredoc - [#{ERB::Util.html_escape problem.app.name}]#{ERB::Util.html_escape notification_description(problem)}
- #{url} - MSG + def create_notification(problem) + url = app_problem_url problem.app, problem + message = <<-MSG.strip_heredoc + [#{ERB::Util.html_escape problem.app.name}]#{ERB::Util.html_escape notification_description(problem)}
+ #{url} + MSG - client = HipChat::Client.new(api_token) - client[room_id].send('Errbit', message, :color => 'red') + client = HipChat::Client.new(api_token) + client[room_id].send('Errbit', message, :color => 'red') + end end -end +end \ No newline at end of file diff --git a/config/initializers/_load_config.rb b/config/initializers/_load_config.rb index b0ca943..4ead497 100644 --- a/config/initializers/_load_config.rb +++ b/config/initializers/_load_config.rb @@ -60,6 +60,9 @@ default_config.each do |k,v| Errbit::Config.send("#{k}=", v) if Errbit::Config.send(k) === nil end +# Disable GitHub oauth if gem is missing +Errbit::Config.github_authentication = false unless defined?(OmniAuth::Strategies::GitHub) + # Set SMTP settings if given. if smtp = Errbit::Config.smtp_settings ActionMailer::Base.delivery_method = :smtp diff --git a/lib/issue_trackers/apis/mingle.rb b/lib/issue_trackers/apis/mingle.rb index 23b3069..52304b2 100644 --- a/lib/issue_trackers/apis/mingle.rb +++ b/lib/issue_trackers/apis/mingle.rb @@ -1,3 +1,5 @@ +require 'active_resource' + module Mingle class Card < ActiveResource::Base # site template ~> "https://username:password@mingle.example.com/api/v1/projects/:project_id/" -- libgit2 0.21.2