ruboty-github 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd8c7fa7a1712071c061bc2e3bddb463bec6e71c
4
- data.tar.gz: 6c1972801274751c46b23015b0d4e74f0cad2440
3
+ metadata.gz: 858be07d2d4a6b4c7175e4ec8d6016106bfaecb1
4
+ data.tar.gz: e7f1756359a7903812438a6953a612bc67e819fe
5
5
  SHA512:
6
- metadata.gz: 2ab00bdaa439941043be9126323bc6d2db1ec57cba540acdbed41832a806e5cd941aca250cb96ee54bbb8bcf34e0f66eed6d542d3b05c2628319b87b2e17e60c
7
- data.tar.gz: 9e047674f00296b8c8674968583018d14d763e096fecf4bdbbb1c369e27855e2aea757882b370756d398dd39585109961de684f0ff64134f3aab8583e1b1bb5f
6
+ metadata.gz: 3649533a6835fc21a2600582359d40093eb6e54c388b13f9070ad1a536a6b19f348a68eb6da594af63d052a9f25d690a04a709c5bfc2bb3f2142958ee2613fa0
7
+ data.tar.gz: 853d6eabb9f68f4f3c2f4e2c5a3476e99442abb87ba374619579fa176c3d2a23ccad193b7eb780bd103056dff8cd0ca6133d5ec93fbf08ba98e8be885272a2ef
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.2
2
+ - Allow merge & issue commands to take issue's URL
3
+ - `close issue <target>` -> `close[ issue] <target>`
4
+
1
5
  ## 0.1.1
2
6
  - Pass empty string as issue body instead of nil
3
7
 
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Github
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -1,6 +1,8 @@
1
1
  module Ruboty
2
2
  module Handlers
3
3
  class Github < Base
4
+ ISSUE_PATTERN = %r<(?:https?://[^/]+/)?(?<repo>.+)(?:#|/pull/|/issue/)(?<number>\d+) ?>
5
+
4
6
  env :GITHUB_HOST, "Pass GitHub Host if needed (e.g. github.example.com)", optional: true
5
7
 
6
8
  on(
@@ -16,7 +18,7 @@ module Ruboty
16
18
  )
17
19
 
18
20
  on(
19
- /close issue (?<repo>.+)#(?<number>\d+)\z/,
21
+ /close(?: issue)? #{ISSUE_PATTERN}\z/,
20
22
  name: "close_issue",
21
23
  description: "Close an issue",
22
24
  )
@@ -28,7 +30,7 @@ module Ruboty
28
30
  )
29
31
 
30
32
  on(
31
- /merge (?<repo>.+)#(?<number>\d+)\z/,
33
+ /merge #{ISSUE_PATTERN}\z/,
32
34
  name: "merge_pull_request",
33
35
  description: "Merge pull request",
34
36
  )
@@ -58,12 +58,12 @@ describe Ruboty::Handlers::Github do
58
58
 
59
59
  describe "#create_issue" do
60
60
  before do
61
- stub_request(:post, "https://github.com/api/v3/repos/#{user}/#{repository}/issues").
61
+ stub_request(:post, "https://api.github.com/repos/#{user}/#{repository}/issues").
62
62
  with(
63
63
  body: {
64
- labels: nil,
64
+ labels: [],
65
65
  title: title,
66
- body: nil,
66
+ body: "",
67
67
  }.to_json,
68
68
  headers: {
69
69
  Authorization: "token #{github_access_token}"
@@ -91,7 +91,7 @@ describe Ruboty::Handlers::Github do
91
91
 
92
92
  describe "#close_issue" do
93
93
  before do
94
- stub_request(:get, "https://github.com/api/v3/repos/#{user}/#{repository}/issues/#{issue_number}").
94
+ stub_request(:get, "https://api.github.com/repos/#{user}/#{repository}/issues/#{issue_number}").
95
95
  with(
96
96
  headers: {
97
97
  Authorization: "token #{github_access_token}"
@@ -106,7 +106,7 @@ describe Ruboty::Handlers::Github do
106
106
  "Content-Type" => "application/json",
107
107
  },
108
108
  )
109
- stub_request(:patch, "https://github.com/api/v3/repos/#{user}/#{repository}/issues/#{issue_number}").
109
+ stub_request(:patch, "https://api.github.com/repos/#{user}/#{repository}/issues/#{issue_number}").
110
110
  with(
111
111
  body: {
112
112
  state: "closed",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport