ruboty-github 0.2.0 → 0.2.1

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: 6ec8b03de436019f0accdda3ec4dcfea4cfe458e
4
- data.tar.gz: 418118d889005e3a1f1680d67e2d3bdc240d4201
3
+ metadata.gz: 093d1614cfcf90a313fddb5d1b9e8e23ccaf44bf
4
+ data.tar.gz: 58bfb5159b11c65f62a9985b28e562dd5b374c90
5
5
  SHA512:
6
- metadata.gz: 280f46b8b332c5ad84c47487e7922019c65ae7756d1503599db7a53f277f5be6792d507385490e5e3f4929741210b27119a91a140667761d2cb2d087618ffcd4
7
- data.tar.gz: 40ad2193ad9086bd71f4b032ece80f27cc91509d3ecea7652a6e0ac749eadfda81018af7a3cdfbb9ffa3b0e9534e837b8c21bd94db6f4de54534f298dfcdae4d
6
+ metadata.gz: 6402e655cb325d41478424554fb8f9a35884b1c2c0a4e8b97b2c5375a30766dce44ae4303b6db3138e77febafb5e0d84ee4e9d2832b6955cccdc0b931c4309fe
7
+ data.tar.gz: f1d46447fd0bc857845d19a8e6f1ff618b0e96c5781d9bb5df72a3f2f887e9a2f99e1f7f38c5ce69ab325514faea0901f579a90822140217c3beaf2fda6f8828
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.2.1
2
+ - Add `search issues <query>` command
3
+
1
4
  ## 0.2.0
2
5
  - Change ENV from GITHUB_HOST to GITHUB_BASE_URL
3
6
 
data/README.md CHANGED
@@ -11,6 +11,7 @@ gem "ruboty-github"
11
11
  ```
12
12
  @ruboty close <URL> - Close an Issue
13
13
  @ruboty create issue "<title>" on <repo>[\n<description>] - Create a new Issue
14
+ @ruboty search issues <query> - Search issues
14
15
  @ruboty merge <URL> - Merge a Pull Request
15
16
  @ruboty pull request "<title>" from <from> to <to> - Create a new Pull Request
16
17
  @ruboty remember my github token <token> - Remember sender's GitHub access token
@@ -0,0 +1,49 @@
1
+ module Ruboty
2
+ module Github
3
+ module Actions
4
+ class SearchIssues < Base
5
+ def call
6
+ if has_access_token?
7
+ list
8
+ else
9
+ require_access_token
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def list
16
+ message.reply(search_summary, code: true)
17
+ end
18
+
19
+ def search_summary
20
+ if issues.empty?
21
+ empty_summary
22
+ else
23
+ issues.map { |issue| issue_description(issue) }.join("\n")
24
+ end
25
+ end
26
+
27
+ def empty_summary
28
+ "Issue not found"
29
+ end
30
+
31
+ def issue_description(issue)
32
+ %<%s by %s %s> % [issue.title, issue.user.login, issue.html_url]
33
+ end
34
+
35
+ def issues
36
+ search_result.items
37
+ end
38
+
39
+ def search_result
40
+ client.search_issues(query)
41
+ end
42
+
43
+ def query
44
+ message[:query]
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Github
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
data/lib/ruboty/github.rb CHANGED
@@ -5,6 +5,7 @@ require "ruboty"
5
5
  require "ruboty/github/actions/base"
6
6
  require "ruboty/github/actions/close_issue"
7
7
  require "ruboty/github/actions/create_issue"
8
+ require "ruboty/github/actions/search_issues"
8
9
  require "ruboty/github/actions/create_pull_request"
9
10
  require "ruboty/github/actions/merge_pull_request"
10
11
  require "ruboty/github/actions/remember"
@@ -35,6 +35,12 @@ module Ruboty
35
35
  description: "Merge pull request",
36
36
  )
37
37
 
38
+ on(
39
+ /search issues (?<query>.+)/,
40
+ name: "search_issues",
41
+ description: "Search issues",
42
+ )
43
+
38
44
  def create_issue(message)
39
45
  Ruboty::Github::Actions::CreateIssue.new(message).call
40
46
  end
@@ -54,6 +60,10 @@ module Ruboty
54
60
  def merge_pull_request(message)
55
61
  Ruboty::Github::Actions::MergePullRequest.new(message).call
56
62
  end
63
+
64
+ def search_issues(message)
65
+ Ruboty::Github::Actions::SearchIssues.new(message).call
66
+ end
57
67
  end
58
68
  end
59
69
  end
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2015-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -143,6 +143,7 @@ files:
143
143
  - lib/ruboty/github/actions/create_pull_request.rb
144
144
  - lib/ruboty/github/actions/merge_pull_request.rb
145
145
  - lib/ruboty/github/actions/remember.rb
146
+ - lib/ruboty/github/actions/search_issues.rb
146
147
  - lib/ruboty/github/version.rb
147
148
  - lib/ruboty/handlers/github.rb
148
149
  - ruboty-github.gemspec