From c488821871c2168bd898686061e0ff8689141a16 Mon Sep 17 00:00:00 2001 From: Stephen Crosby Date: Sat, 20 Feb 2016 18:24:18 -0800 Subject: [PATCH 1/3] add CI through travis --- .travis.yml | 9 +++++++++ Gemfile | 2 +- errbit_github_plugin.gemspec | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..720b659 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: ruby +rvm: + - 2.1 + - 2.2 + - 2.3 +sudo: false +cache: bundler +script: + - bundle exec rspec diff --git a/Gemfile b/Gemfile index cbd451e..5ee986f 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' # Specify your gem's dependencies in errbit_github_plugin.gemspec gemspec -gem 'errbit_plugin', :git => 'https://github.com/errbit/errbit_plugin.git' +gem 'errbit_plugin' gem 'rspec' gem 'guard' gem 'guard-rspec' diff --git a/errbit_github_plugin.gemspec b/errbit_github_plugin.gemspec index 6170215..53d31f5 100644 --- a/errbit_github_plugin.gemspec +++ b/errbit_github_plugin.gemspec @@ -24,4 +24,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" + spec.add_development_dependency "activesupport" end From 5631dc959de5f600014610bdb131aa422fcbd8f8 Mon Sep 17 00:00:00 2001 From: Marvin Frederickson Date: Sat, 20 Feb 2016 22:13:16 -0900 Subject: [PATCH 2/3] add feature to close an issue --- lib/errbit_github_plugin/issue_tracker.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/errbit_github_plugin/issue_tracker.rb b/lib/errbit_github_plugin/issue_tracker.rb index 1329cab..3587972 100644 --- a/lib/errbit_github_plugin/issue_tracker.rb +++ b/lib/errbit_github_plugin/issue_tracker.rb @@ -82,5 +82,23 @@ def create_issue(title, body, user: {}) rescue Octokit::Unauthorized raise ErrbitGithubPlugin::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password." end + + def close_issue(url, user: {}) + if user['github_login'] && user['github_oauth_token'] + github_client = Octokit::Client.new( + login: user['github_login'], access_token: user['github_oauth_token']) + else + github_client = Octokit::Client.new( + login: options['username'], password: options['password']) + end + # It would be better to get the number from issue.number when we create the issue, + # however, since we only have the url, get the number from it. + # ex: "https://github.com/octocat/Hello-World/issues/1347" + issue_number = url.split("/").last + issue = github_client.close_issue(repo, issue_number) + issue.html_url + rescue Octokit::Unauthorized + raise ErrbitGithubPlugin::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password." + end end end From 87468e3502954b11a48d8792cbb4c5451594791a Mon Sep 17 00:00:00 2001 From: Marvin Frederickson Date: Thu, 10 Mar 2016 09:05:33 -0900 Subject: [PATCH 3/3] update from 2.3 to 2.3.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 720b659..bfe7a09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: ruby rvm: - 2.1 - 2.2 - - 2.3 + - 2.3.0 sudo: false cache: bundler script: