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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a3243d52cce5fabd30b55d8cce5d09e9ed647b2
4
- data.tar.gz: c6b02ff8fb29afc3afd054f2453004f9b82711e6
3
+ metadata.gz: ad999d51bcbcb0132b7b491cf2287af7aaaa29ee
4
+ data.tar.gz: 9ceeac0347f625aafa2e64fd72c74747243917bd
5
5
  SHA512:
6
- metadata.gz: a1f3ad5d5aed5c7ada06908b737fd7012066a3f6c5ff3b05752c971a1820f41b69de83c0d61ddd927ef4634d65e43430a5935680acdbcea1b40e4cd274f85f85
7
- data.tar.gz: 59476bc2fd010dcd504a4a6c328627bfbcf7b5dd4ab179df14644b0b3de31387b0e1b092a07b549850a00b7dce3f2b1dd02d027256c85835965001b04cb5aa35
6
+ metadata.gz: 4c20df46f34eb691981358dcf60b71a71225a8eea37ce7224cb8430da4400e2363f7bb8ca6e40313add1185e9c62c4354dd9c8655e668aaaec23a532e197fb51
7
+ data.tar.gz: de9965cc92c9f63bdefc04c3e84bfe22be211f45332eb6864cfac21a40ed0048873eb048a107cbbd6fe833f9ba610aae03d6cce6fa999480b1b352af71b3a392
@@ -3,4 +3,5 @@ language: ruby
3
3
  rvm:
4
4
  - 2.3.1
5
5
  - 2.4.0
6
+
6
7
  before_install: gem install bundler -v 1.13.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ruboty::Jira
1
+ # Ruboty::Jira [![Gem Version](https://badge.fury.io/rb/ruboty-jira.svg)](https://badge.fury.io/rb/ruboty-jira) [![Build Status](https://travis-ci.org/rike422/ruboty-jira.svg?branch=master)](https://travis-ci.org/rike422/ruboty-jira) [![Coverage Status](https://coveralls.io/repos/github/rike422/ruboty-jira/badge.svg?branch=master)](https://coveralls.io/github/rike422/ruboty-jira?branch=master) [![Code Climate](https://codeclimate.com/github/rike422/ruboty-jira/badges/gpa.svg)](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
@@ -1,6 +1,4 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
-
4
3
  RSpec::Core::RakeTask.new(:spec)
5
-
6
4
  task default: :spec
@@ -10,7 +10,7 @@ module Ruboty
10
10
  name: 'issue_detail',
11
11
  description: 'issue')
12
12
 
13
- on(/jira comment ?(?<issue>.+) ?(?<comment>.+) /,
13
+ on(/jira comment on (?<issue>\S+) (?<comment>.+)/,
14
14
  name: 'comment',
15
15
  description: 'comment to issue')
16
16
 
@@ -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
- message.reply(comment)
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
- # TODO: main logic
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(
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Jira
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
@@ -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.2.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-18 00:00:00.000000000 Z
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