ruboty-jira 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -1
- data/Rakefile +0 -2
- data/lib/ruboty/handlers/jira.rb +1 -1
- data/lib/ruboty/jira/actions/base.rb +18 -0
- data/lib/ruboty/jira/actions/comment.rb +15 -2
- data/lib/ruboty/jira/actions/create_issue.rb +2 -20
- data/lib/ruboty/jira/version.rb +1 -1
- data/ruboty-jira.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad999d51bcbcb0132b7b491cf2287af7aaaa29ee
|
4
|
+
data.tar.gz: 9ceeac0347f625aafa2e64fd72c74747243917bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c20df46f34eb691981358dcf60b71a71225a8eea37ce7224cb8430da4400e2363f7bb8ca6e40313add1185e9c62c4354dd9c8655e668aaaec23a532e197fb51
|
7
|
+
data.tar.gz: de9965cc92c9f63bdefc04c3e84bfe22be211f45332eb6864cfac21a40ed0048873eb048a107cbbd6fe833f9ba610aae03d6cce6fa999480b1b352af71b3a392
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ruboty::Jira
|
1
|
+
# Ruboty::Jira [](https://badge.fury.io/rb/ruboty-jira) [](https://travis-ci.org/rike422/ruboty-jira) [](https://coveralls.io/github/rike422/ruboty-jira?branch=master) [](https://codeclimate.com/github/rike422/ruboty-jira)
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruboty/jira`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
data/Rakefile
CHANGED
data/lib/ruboty/handlers/jira.rb
CHANGED
@@ -83,6 +83,24 @@ module Ruboty
|
|
83
83
|
def query_issue(jql)
|
84
84
|
client.Issue.jql(jql)
|
85
85
|
end
|
86
|
+
|
87
|
+
def valid_project?
|
88
|
+
return true unless associate_project.nil?
|
89
|
+
message.reply <<-ERROR
|
90
|
+
Please associate this channel with the jira project
|
91
|
+
ex: @Botname jira project associate <project_name>
|
92
|
+
ERROR
|
93
|
+
false
|
94
|
+
end
|
95
|
+
|
96
|
+
def valid_user?
|
97
|
+
return true unless associate_user.nil?
|
98
|
+
message.reply <<-ERROR
|
99
|
+
Please associate chat name with the jira account
|
100
|
+
ex: @Botname jira user #<jira_user_name> is @<chat_name>
|
101
|
+
ERROR
|
102
|
+
false
|
103
|
+
end
|
86
104
|
end
|
87
105
|
end
|
88
106
|
end
|
@@ -3,7 +3,8 @@ module Ruboty
|
|
3
3
|
module Actions
|
4
4
|
class Comment < Base
|
5
5
|
def call
|
6
|
-
|
6
|
+
return unless valid_user?
|
7
|
+
comment
|
7
8
|
rescue => e
|
8
9
|
message.reply(e.message)
|
9
10
|
end
|
@@ -11,7 +12,19 @@ module Ruboty
|
|
11
12
|
private
|
12
13
|
|
13
14
|
def comment
|
14
|
-
|
15
|
+
issue = find_issue(message[:issue])
|
16
|
+
return message.reply("The issue #{message[:issue]} is not found") if issue.nil?
|
17
|
+
comment = issue.comments.build
|
18
|
+
comment.save!(
|
19
|
+
body: format(message[:comment])
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def format(message)
|
24
|
+
<<-"EOF"
|
25
|
+
Commented by @#{associate_user[:name]}
|
26
|
+
#{message}
|
27
|
+
EOF
|
15
28
|
end
|
16
29
|
end
|
17
30
|
end
|
@@ -3,8 +3,8 @@ module Ruboty
|
|
3
3
|
module Actions
|
4
4
|
class CreateIssue < Base
|
5
5
|
def call
|
6
|
-
return unless valid_project
|
7
|
-
return unless valid_user
|
6
|
+
return unless valid_project?
|
7
|
+
return unless valid_user?
|
8
8
|
issue = create_issue
|
9
9
|
message.reply <<"EOF"
|
10
10
|
Create issue
|
@@ -16,24 +16,6 @@ EOF
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def valid_project
|
20
|
-
return true unless associate_project.nil?
|
21
|
-
message.reply <<ERROR
|
22
|
-
Please associate this channel with the jira project
|
23
|
-
ex: @Botname jira project associate <project_name>
|
24
|
-
ERROR
|
25
|
-
false
|
26
|
-
end
|
27
|
-
|
28
|
-
def valid_user
|
29
|
-
return true unless associate_user.nil?
|
30
|
-
message.reply <<ERROR
|
31
|
-
Please associate chat name with the jira account
|
32
|
-
ex: @Botname jira user #<jira_user_name> is @<chat_name>
|
33
|
-
ERROR
|
34
|
-
false
|
35
|
-
end
|
36
|
-
|
37
19
|
def create_issue
|
38
20
|
issue = client.Issue.build
|
39
21
|
issue.save(
|
data/lib/ruboty/jira/version.rb
CHANGED
data/ruboty-jira.gemspec
CHANGED
@@ -27,7 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'rake'
|
28
28
|
spec.add_development_dependency 'rspec'
|
29
29
|
spec.add_development_dependency 'simplecov'
|
30
|
-
spec.add_development_dependency 'coveralls'
|
31
30
|
spec.add_development_dependency 'codeclimate-test-reporter'
|
32
31
|
spec.add_development_dependency 'guard'
|
33
32
|
spec.add_development_dependency 'guard-rspec'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-jira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Takahashi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: coveralls
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: codeclimate-test-reporter
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|