ruboty-jira 0.1.0 → 0.2.0

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: 4f62bdc158583620aed6c98ca5c60d01c437f9ad
4
- data.tar.gz: e96c643f447edcd775b68dd94b05bb7e4e92be69
3
+ metadata.gz: 8a3243d52cce5fabd30b55d8cce5d09e9ed647b2
4
+ data.tar.gz: c6b02ff8fb29afc3afd054f2453004f9b82711e6
5
5
  SHA512:
6
- metadata.gz: 01ebf4775f89719150599a8596dc4e7d9fb52ca678d9022df20624a6056c1090856c889eef3527bc68bc7c566141953211c493bb388669d448d8a2067dd49586
7
- data.tar.gz: f83d8da400c95039d04e6e0954e343259a8e8fbca433cb71e5b1ddeed0b341c5017fead332a54baba36d95cba769225ed23bc948f83a7c04b4f34e3470d31151
6
+ metadata.gz: a1f3ad5d5aed5c7ada06908b737fd7012066a3f6c5ff3b05752c971a1820f41b69de83c0d61ddd927ef4634d65e43430a5935680acdbcea1b40e4cd274f85f85
7
+ data.tar.gz: 59476bc2fd010dcd504a4a6c328627bfbcf7b5dd4ab179df14644b0b3de31387b0e1b092a07b549850a00b7dce3f2b1dd02d027256c85835965001b04cb5aa35
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /vendor/bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
4
5
  /_yardoc/
data/.rubocop.yml ADDED
@@ -0,0 +1,44 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'vendor/**/*'
4
+ - 'spec/fixtures/**/*'
5
+ - 'tmp/**/*'
6
+ - 'templates/**/*'
7
+ ##################### Metrics ##################################
8
+
9
+ Metrics/MethodLength:
10
+ Max: 30
11
+
12
+ Metrics/LineLength:
13
+ Max: 130
14
+
15
+ Metrics/ClassLength:
16
+ CountComments: false
17
+ Max: 150
18
+
19
+ Metrics/LineLength:
20
+ Max: 150
21
+
22
+ ##################### Style ##################################
23
+
24
+ # Use nested module/class definitions instead of compact style.
25
+ # NG: module Gem::Search
26
+ Style/ClassAndModuleChildren:
27
+ Enabled: false
28
+
29
+ Style/AsciiComments:
30
+ Enabled: false
31
+
32
+ Style/Documentation:
33
+ Enabled: false
34
+
35
+ Style/DotPosition:
36
+ EnforcedStyle: trailing
37
+
38
+ Style/FrozenStringLiteralComment:
39
+ Enabled: false
40
+
41
+ Metrics/BlockLength:
42
+ Exclude:
43
+ - 'rounders.gemspec'
44
+ - 'spec/**/*'
data/.travis.yml CHANGED
@@ -2,4 +2,5 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.3.1
5
+ - 2.4.0
5
6
  before_install: gem install bundler -v 1.13.3
data/Guardfile ADDED
@@ -0,0 +1,38 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ group :red_green_refactor do
28
+ guard :rubocop, all_on_start: false, cli: ['--format', 'clang', '-D'] do
29
+ watch(/.+\.rb$/)
30
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
31
+ end
32
+
33
+ guard :rspec, cmd: 'bundle exec rspec --color --format documentation' do
34
+ watch(%r{^spec/.+_spec\.rb$})
35
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
36
+ watch('spec/spec_helper.rb') { 'spec' }
37
+ end
38
+ end
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "ruboty/jira"
3
+ require 'bundler/setup'
4
+ require 'ruboty/jira'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "ruboty/jira"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
@@ -2,19 +2,38 @@ module Ruboty
2
2
  module Handlers
3
3
  # Ruboty jira client
4
4
  class Jira < Base
5
- on /jira project set ?(?<project>.+)\z/, name: 'set_project', description: 'set project'
6
- on /jira ?(?<issue>.+)/, name: 'issue', description: 'issue'
7
- on /jira details ?(?<issue>.+)/, name: 'issue_detail', description: 'issue'
8
- on /jira comment ?(?<issue>.+) ?(?<comment>.+) /, name: 'comment', description: 'comment to issue'
9
- on /#{ENV["JIRA_URL"]}\/browse\/?(?<issue>.+)/, all: true, name: 'issue_detail', description: 'comment to issue'
10
- env :JIRA_URL, "https://jira-domain.com:9090"
11
- env :JIRA_PASSWORD, "jira password"
12
- env :JIRA_USERNAME, "jira username"
13
- env :JIRA_CONTEXT_PATH, "jira context path", optional: true
14
- env :JIRA_USE_SSL, "jira context path", optional: true
15
-
16
- def set_project(message)
17
- Ruboty::Jira::Actions::SetProject.new(message).call
5
+ on(/jira project associate ?(?<project>.+)\z/,
6
+ name: 'associate_project',
7
+ description: 'Associate this channel with jira project')
8
+
9
+ on(/jira details ?(?<issue>.+)/,
10
+ name: 'issue_detail',
11
+ description: 'issue')
12
+
13
+ on(/jira comment ?(?<issue>.+) ?(?<comment>.+) /,
14
+ name: 'comment',
15
+ description: 'comment to issue')
16
+
17
+ on(%r{#{ENV['JIRA_URL']}\/browse\/?(?<issue>.+)},
18
+ all: true, name: 'issue_detail',
19
+ description: 'comment to issue')
20
+
21
+ on(/jira user #(?<jira_id>.+) is @(?<chat_name>.+)/,
22
+ name: 'associate_user',
23
+ description: 'Associate jira_id with chat_name')
24
+
25
+ on(/jira create (?<issue_type>\S+) (?<summary>\S+) ?(?<subject>.*)/,
26
+ name: 'create_issue',
27
+ description: 'Create issue to Jira project')
28
+
29
+ env :JIRA_URL, 'https://jira-domain.com:9090'
30
+ env :JIRA_PASSWORD, 'jira password'
31
+ env :JIRA_USERNAME, 'jira username'
32
+ env :JIRA_CONTEXT_PATH, 'jira context path', optional: true
33
+ env :JIRA_USE_SSL, 'jira context path', optional: true
34
+
35
+ def associate_project(message)
36
+ Ruboty::Jira::Actions::AssociateProject.new(message).call
18
37
  end
19
38
 
20
39
  def issue(message)
@@ -28,6 +47,14 @@ module Ruboty
28
47
  def comment(message)
29
48
  Ruboty::Jira::Actions::Comment.new(message).call
30
49
  end
50
+
51
+ def create_issue(message)
52
+ Ruboty::Jira::Actions::CreateIssue.new(message).call
53
+ end
54
+
55
+ def associate_user(message)
56
+ Ruboty::Jira::Actions::AssociateUser.new(message).call
57
+ end
31
58
  end
32
59
  end
33
60
  end
data/lib/ruboty/jira.rb CHANGED
@@ -1,15 +1,16 @@
1
- require "jira-ruby"
2
- require "ruboty/jira/version"
3
- require "ruboty/handlers/jira"
1
+ require 'jira-ruby'
2
+ require 'ruboty/jira/version'
3
+ require 'ruboty/handlers/jira'
4
4
 
5
- require "ruboty/jira/actions/base"
6
- require "ruboty/jira/actions/comment"
7
- require "ruboty/jira/actions/issue_detail"
8
- require "ruboty/jira/actions/issue"
9
- require "ruboty/jira/actions/set_project"
5
+ require 'ruboty/jira/actions/base'
6
+ require 'ruboty/jira/actions/comment'
7
+ require 'ruboty/jira/actions/issue_detail'
8
+ require 'ruboty/jira/actions/create_issue'
9
+ require 'ruboty/jira/actions/associate_project'
10
+ require 'ruboty/jira/actions/associate_user'
10
11
 
11
12
  module Ruboty
12
13
  module Jira
13
- NAME_SPACE = 'ruboty-jira'
14
+ NAME_SPACE = 'ruboty-jira'.freeze
14
15
  end
15
16
  end
@@ -0,0 +1,37 @@
1
+ module Ruboty
2
+ module Jira
3
+ module Actions
4
+ class AssociateProject < Base
5
+ def call
6
+ associate_project
7
+ replay_message
8
+ rescue => e
9
+ message.reply(e.message)
10
+ end
11
+
12
+ private
13
+
14
+ def associate_project
15
+ project = find_project(project_key)
16
+ return if project.nil?
17
+
18
+ projects[message.to] = {
19
+ id: project.id
20
+ }
21
+ end
22
+
23
+ def project_key
24
+ message[:project]
25
+ end
26
+
27
+ def replay_message
28
+ if associate_project.nil?
29
+ message.reply('The jira project is not found.')
30
+ else
31
+ message.reply('Registered.')
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ module Ruboty
2
+ module Jira
3
+ module Actions
4
+ class AssociateUser < Base
5
+ def call
6
+ associate
7
+ reply_message
8
+ rescue => e
9
+ message.reply(e.message)
10
+ end
11
+
12
+ private
13
+
14
+ def associate
15
+ user = find_user(message[:jira_id])
16
+ return if user.nil?
17
+ users[message[:chat_name]] = {
18
+ name: user.name
19
+ }
20
+ end
21
+
22
+ def reply_message
23
+ if associate_user.nil?
24
+ message.reply("The jira account #{message[:jira_id]} is not found")
25
+ else
26
+ message.reply('Registered.')
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -4,62 +4,83 @@ module Ruboty
4
4
  class Base < Ruboty::Actions::Base
5
5
  def client
6
6
  JIRA::Client.new(
7
- username: username,
8
- password: password,
9
- site: site,
10
- context_path: context,
11
- auth_type: :basic,
12
- use_ssl: use_ssl
7
+ username: jira_username,
8
+ password: jira_password,
9
+ site: jira_site,
10
+ context_path: jira_context,
11
+ auth_type: :basic,
12
+ use_ssl: use_ssl
13
13
  )
14
14
  end
15
15
 
16
- def fetch_project(key)
17
- client.Project.find(key)
18
- rescue
19
- log.error('JIRA HTTPError')
20
- nil
16
+ def jira_username
17
+ ENV['JIRA_USERNAME']
21
18
  end
22
19
 
23
- def username
24
- ENV["JIRA_USERNAME"]
20
+ def jira_password
21
+ ENV['JIRA_PASSWORD']
25
22
  end
26
23
 
27
- def password
28
- ENV["JIRA_PASSWORD"]
24
+ def jira_site
25
+ ENV['JIRA_URL']
29
26
  end
30
27
 
31
- def site
32
- ENV["JIRA_URL"]
33
- end
34
-
35
- def context
36
- ENV["JIRA_CONTEXT_PATH"] || ''
28
+ def jira_context
29
+ ENV['JIRA_CONTEXT_PATH'] || ''
37
30
  end
38
31
 
39
32
  def use_ssl
40
- ENV["JIRA_USE_SSL"] || true
33
+ value = ENV['JIRA_USE_SSL']
34
+ return value unless value.nil?
35
+ true
41
36
  end
42
37
 
43
38
  def memory
44
39
  message.robot.brain.data[Ruboty::Jira::NAME_SPACE] ||= {}
45
40
  end
46
41
 
42
+ def users
43
+ memory['USERS'] ||= {}
44
+ end
45
+
46
+ def projects
47
+ memory['PROJECTS'] ||= {}
48
+ end
49
+
50
+ def associate_user
51
+ user = users[message.from_name]
52
+ return if user.nil?
53
+ user
54
+ end
55
+
56
+ def associate_project
57
+ project = projects[message.to]
58
+ return if project.nil?
59
+ project
60
+ end
61
+
47
62
  def find_project(key)
48
63
  client.Project.find(key)
49
64
  rescue => e
50
65
  Ruboty.logger.error e
51
- Ruboty.logger.info('JIRA HTTPError')
52
66
  nil
53
67
  end
54
68
 
55
- def find_issue(key, expected = true)
69
+ def find_issue(key)
56
70
  client.Issue.find(key)
57
- rescue
58
- log.error('JIRA HTTPError') if expected
71
+ rescue => e
72
+ Ruboty.logger.error e
73
+ nil
74
+ end
75
+
76
+ def find_user(key)
77
+ client.User.find(key)
78
+ rescue => e
79
+ Ruboty.logger.error e
59
80
  nil
60
81
  end
61
82
 
62
- def quey_issues(jql)
83
+ def query_issue(jql)
63
84
  client.Issue.jql(jql)
64
85
  end
65
86
  end
@@ -9,6 +9,7 @@ module Ruboty
9
9
  end
10
10
 
11
11
  private
12
+
12
13
  def comment
13
14
  # TODO: main logic
14
15
  end
@@ -0,0 +1,53 @@
1
+ module Ruboty
2
+ module Jira
3
+ module Actions
4
+ class CreateIssue < Base
5
+ def call
6
+ return unless valid_project
7
+ return unless valid_user
8
+ issue = create_issue
9
+ message.reply <<"EOF"
10
+ Create issue
11
+ #{jira_site}#{jira_context}/browse/#{issue.key}
12
+ EOF
13
+ rescue => e
14
+ message.reply(e.message)
15
+ end
16
+
17
+ private
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
+ def create_issue
38
+ issue = client.Issue.build
39
+ issue.save(
40
+ fields: {
41
+ project: { id: associate_project[:id] },
42
+ reporter: associate_user,
43
+ summary: message[:summary],
44
+ issuetype: { name: message[:issue_type] }
45
+ }
46
+ )
47
+ issue.fetch
48
+ issue
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -9,6 +9,7 @@ module Ruboty
9
9
  end
10
10
 
11
11
  private
12
+
12
13
  def issue_detail
13
14
  issue = find_issue(message[:issue])
14
15
  return issue.summary unless issue.nil?
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Jira
3
- VERSION = "0.1.0"
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
data/ruboty-jira.gemspec CHANGED
@@ -4,25 +4,32 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'ruboty/jira/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "ruboty-jira"
7
+ spec.name = 'ruboty-jira'
8
8
  spec.version = Ruboty::Jira::VERSION
9
- spec.authors = ["Akira Takahashi"]
10
- spec.email = ["rike422@gmail.com"]
9
+ spec.authors = ['Akira Takahashi']
10
+ spec.email = ['rike422@gmail.com']
11
11
 
12
- spec.summary = %q{Ruboty jira client}
13
- spec.description = %q{Ruboty jira client}
14
- spec.homepage = "https://github.com/rike422/ruboty-jira"
15
- spec.license = "MIT"
12
+ spec.summary = 'Ruboty jira client'
13
+ spec.description = 'Ruboty jira client'
14
+ spec.homepage = 'https://github.com/rike422/ruboty-jira'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
18
  f.match(%r{^(test|spec|features)/})
19
19
  end
20
- spec.bindir = "exe"
20
+ spec.bindir = 'exe'
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
22
+ spec.require_paths = ['lib']
23
23
 
24
- spec.add_dependency "jira-ruby", "~> 1.2.0"
25
- spec.add_development_dependency "bundler"
26
- spec.add_development_dependency "rake"
27
- spec.add_development_dependency "rspec"
24
+ spec.add_runtime_dependency 'ruboty'
25
+ spec.add_dependency 'jira-ruby', '~> 1.2.0'
26
+ spec.add_development_dependency 'bundler'
27
+ spec.add_development_dependency 'rake'
28
+ spec.add_development_dependency 'rspec'
29
+ spec.add_development_dependency 'simplecov'
30
+ spec.add_development_dependency 'coveralls'
31
+ spec.add_development_dependency 'codeclimate-test-reporter'
32
+ spec.add_development_dependency 'guard'
33
+ spec.add_development_dependency 'guard-rspec'
34
+ spec.add_development_dependency 'guard-rubocop'
28
35
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-jira
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.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-16 00:00:00.000000000 Z
11
+ date: 2017-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: jira-ruby
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,90 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
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
+ - !ruby/object:Gem::Dependency
112
+ name: codeclimate-test-reporter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: guard-rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
69
167
  description: Ruboty jira client
70
168
  email:
71
169
  - rike422@gmail.com
@@ -75,9 +173,11 @@ extra_rdoc_files: []
75
173
  files:
76
174
  - ".gitignore"
77
175
  - ".rspec"
176
+ - ".rubocop.yml"
78
177
  - ".travis.yml"
79
178
  - CODE_OF_CONDUCT.md
80
179
  - Gemfile
180
+ - Guardfile
81
181
  - LICENSE.txt
82
182
  - README.md
83
183
  - Rakefile
@@ -85,11 +185,12 @@ files:
85
185
  - bin/setup
86
186
  - lib/ruboty/handlers/jira.rb
87
187
  - lib/ruboty/jira.rb
188
+ - lib/ruboty/jira/actions/associate_project.rb
189
+ - lib/ruboty/jira/actions/associate_user.rb
88
190
  - lib/ruboty/jira/actions/base.rb
89
191
  - lib/ruboty/jira/actions/comment.rb
90
- - lib/ruboty/jira/actions/issue.rb
192
+ - lib/ruboty/jira/actions/create_issue.rb
91
193
  - lib/ruboty/jira/actions/issue_detail.rb
92
- - lib/ruboty/jira/actions/set_project.rb
93
194
  - lib/ruboty/jira/version.rb
94
195
  - ruboty-jira.gemspec
95
196
  homepage: https://github.com/rike422/ruboty-jira
@@ -112,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
213
  version: '0'
113
214
  requirements: []
114
215
  rubyforge_project:
115
- rubygems_version: 2.5.1
216
+ rubygems_version: 2.6.6
116
217
  signing_key:
117
218
  specification_version: 4
118
219
  summary: Ruboty jira client
@@ -1,18 +0,0 @@
1
- module Ruboty
2
- module Jira
3
- module Actions
4
- class Issue < Base
5
- def call
6
- message.reply(issue)
7
- rescue => e
8
- message.reply(e.message)
9
- end
10
-
11
- private
12
- def issue
13
- # TODO: main logic
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,34 +0,0 @@
1
- module Ruboty
2
- module Jira
3
- module Actions
4
- class SetProject < Base
5
- attr_reader :project
6
-
7
- def call
8
- set_project
9
- message.reply(replay_message)
10
- rescue => e
11
- message.reply(e.message)
12
- end
13
-
14
- private
15
- def set_project
16
- @project = find_project(project_key)
17
- memory[message.to] = project.id unless project.nil?
18
- end
19
-
20
- def project_key
21
- message[:project]
22
- end
23
-
24
- def replay_message
25
- if project.nil?
26
- "#{project_key}"
27
- else
28
- "set to #{project.id} is #{message.to || 'default'}"
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end