jira_command 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
  SHA256:
3
- metadata.gz: de9b915ed2af20b1590e31703459e748ef701601eeb3dd5ecb0be0ba1eb87675
4
- data.tar.gz: 58664c3370e6ad144f03decdff7d43ad9c89a3dad494e51b2579a7cf24017d2c
3
+ metadata.gz: f88473d048a0a3f2a2f6a4a976d001cd163d85e2556b1b1f050fc19f65d0a47b
4
+ data.tar.gz: '0825ad1359e9394d91347541eccb74960f253d4ac0ee824d08bf48aaabcfd701'
5
5
  SHA512:
6
- metadata.gz: a802d9ee4afaf814ed424f1fe0a23823f7f998cedd96909f8f9ec2f826bd0360be61bde297330f1686e0cf03300a1b4f18f4f71cccdcbafa273e93d95a6910db
7
- data.tar.gz: c7af75ea99e6a674e0fbc9d9ce24220a35e771ac91f17ade1b20e5042c37f48f1ae75a7185b703822bc417d5d2891154814bfd2dc406e5fc6ea19c7e6d92c224
6
+ metadata.gz: ba4bf738f150e666aa5bd336995972cff39ad5690fd1be192d70f55f16f7884ecd2204f5a7f82018d0ba33c292e5e75afc73ce16b79dd3205b8a067c30368685
7
+ data.tar.gz: cb233b08e9b88c79b72ca0fbb6a94f05571124c3b4564e4d537e3427022089e2229722791c3ed30b6133f8469ab42ba6653f91ec710b65ff52041c5e6b32db8f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jira_command (0.1.0)
4
+ jira_command (0.1.1)
5
5
  thor
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -30,20 +30,55 @@ $ jira_command config create
30
30
  > Please input your registered email address: <example@xincere.jp>
31
31
  > Please input your token: <token got in jira>
32
32
 
33
- $ bundle exec exe/jira_command help
33
+ $ jira_command help
34
34
  Commands:
35
35
  jira_command assign # set or unset assign in issue
36
36
  jira_command config # create or clear configuration
37
37
  jira_command help [COMMAND] # Describe available commands or one specific command
38
+ jira_command issue # create a issue
38
39
  jira_command list # list up issues
39
40
  jira_command status # show all status in project
40
41
  jira_command transition # transition issues
41
42
  jira_command user # list all users
42
43
  ```
43
44
 
44
- <b>the most useful commands</b>
45
+ <b>if you want to cache items in your local to reduce api call, you can refer the following commands.</b>
46
+
47
+ ```bash
48
+ $ jira_command config help
49
+ Commands:
50
+ jira_command config clear # clear config file
51
+ jira_command config create # create config file
52
+ jira_command config help [COMMAND] # Describe subcommands or one specific subcommand
53
+ jira_command config update_it # update default issue_type in config file
54
+ jira_command config update_projects # update default projects in config file
55
+ jira_command config update_users p, --project=PROJECT # update default users in config file
56
+
57
+ $ jira_command config help update_it
58
+ Usage:
59
+ jira_command config update_it
60
+
61
+ update default issue_type in config file
62
+
63
+ $ bundle exec exe/jira_command config help update_projects
64
+ Usage:
65
+ jira_command config update_projects
66
+
67
+ update default projects in config file
45
68
 
69
+ $ bundle exec exe/jira_command config help update_users
70
+ Usage:
71
+ jira_command config update_users p, --project=PROJECT
72
+
73
+ Options:
74
+ p, --project=PROJECT
75
+
76
+ update default users in config file
46
77
  ```
78
+
79
+ <b>the most useful commands</b>
80
+
81
+ ```bash
47
82
  $ jira_command list help my
48
83
  Usage:
49
84
  jira_command list my
@@ -73,14 +108,15 @@ Options:
73
108
  c, [--current=CURRENT]
74
109
  m, [--mine=MINE]
75
110
 
76
- transite issue status
111
+ transit issue status
77
112
 
78
113
  $ jira_command assign help exec
79
114
  Usage:
80
- jira_command assign exec
115
+ jira_command assign exec i, --issue=ISSUE
81
116
 
82
117
  Options:
83
- i, [--issue=ISSUE]
118
+ i, --issue=ISSUE
119
+ ru, [--refresh-user=REFRESH-USER]
84
120
 
85
121
  assign to user
86
122
  ```
@@ -8,13 +8,21 @@ module JiraCommand
8
8
  module Command
9
9
  class Assign < Thor
10
10
  desc 'exec', 'assign to user'
11
- option 'issue', aliases: 'i', required: false
11
+ option 'issue', aliases: 'i', required: true
12
+ option 'refresh-user', aliases: 'ru', required: false
12
13
  def exec
13
14
  config = JiraCommand::Config.new.read
14
15
 
15
16
  user_api = JiraCommand::Jira::User.new(config)
16
17
  user_list = user_api.all_list(project: options['issue'].split('-').first)
17
18
 
19
+ user_list = if options['refresh-user'].nil?
20
+ config['users']
21
+ else
22
+ user_api = JiraCommand::Jira::User.new(config)
23
+ user_api.all_list(project: project[:key])
24
+ end
25
+
18
26
  prompt = TTY::Prompt.new
19
27
 
20
28
  assignee = prompt.select('Who do you want to assign?') do |menu|
@@ -3,6 +3,9 @@ require 'thor'
3
3
  require 'optparse'
4
4
  require 'tty-prompt'
5
5
  require_relative '../config'
6
+ require_relative '../jira/issuetype'
7
+ require_relative '../jira/project'
8
+ require_relative '../jira/user'
6
9
  require 'base64'
7
10
 
8
11
  module JiraCommand
@@ -27,9 +30,42 @@ module JiraCommand
27
30
  JiraCommand::Config.new.write(config)
28
31
  end
29
32
 
33
+ desc 'update_projects', 'update default projects in config file'
34
+ def update_projects
35
+ config = JiraCommand::Config.new.read
36
+
37
+ jira_project = JiraCommand::Jira::Project.new(config)
38
+ config.merge!({
39
+ projects: jira_project.list
40
+ })
41
+ JiraCommand::Config.new.write(config)
42
+ end
43
+
44
+ desc 'update_users', 'update default users in config file'
45
+ option 'project', aliases: 'p', required: true
46
+ def update_users
47
+ config = JiraCommand::Config.new.read
48
+ user_api = JiraCommand::Jira::User.new(config)
49
+ config.merge!({
50
+ users: user_api.all_list(project: options[:project])
51
+ })
52
+ JiraCommand::Config.new.write(config)
53
+ end
54
+
55
+ desc 'update_it', 'update default issue_type in config file'
56
+ def update_it
57
+ config = JiraCommand::Config.new.read
58
+ jira_issue_type = JiraCommand::Jira::IssueType.new(config)
59
+ config.merge!({
60
+ issue_types: jira_issue_type.list
61
+ })
62
+ JiraCommand::Config.new.write(config)
63
+ end
64
+
30
65
  desc 'clear', 'clear config file'
31
66
  def clear
32
- JiraCommand::Config.new.clear
67
+ prompt = TTY::Prompt.new
68
+ JiraCommand::Config.new.clear if prompt.yes?('Are you sure to clear?')
33
69
  end
34
70
  end
35
71
  end
@@ -8,40 +8,56 @@ module JiraCommand
8
8
  module Command
9
9
  class Issue < Thor
10
10
  desc 'create', 'create new issue'
11
+ option 'refresh-project', aliases: 'rp', required: false
12
+ option 'refresh-issue-type', aliases: 'rit', required: false
13
+ option 'refresh-user', aliases: 'ru', required: false
11
14
  def create
12
15
  config = JiraCommand::Config.new.read
13
- jira_issue_type = JiraCommand::Jira::IssueType.new(config)
14
- issue_types = jira_issue_type.list
16
+
17
+ issue_types = if options['refresh-issue-type'].nil?
18
+ config['issue_types']
19
+ else
20
+ jira_issue_type = JiraCommand::Jira::IssueType.new(config)
21
+ jira_issue_type.list
22
+ end
15
23
 
16
24
  prompt = TTY::Prompt.new
17
25
 
18
26
  issue_type = prompt.select('Which issue type do you want to create?') do |menu|
19
27
  issue_types.each do |item|
20
- menu.choice name: item[:name], value: item[:id]
28
+ menu.choice name: item['name'], value: item['id']
21
29
  end
22
30
  end
23
31
 
24
- jira_project = JiraCommand::Jira::Project.new(config)
25
- projects = jira_project.list
32
+ projects = if options['refresh-project'].nil?
33
+ config['projects']
34
+ else
35
+ jira_project = JiraCommand::Jira::Project.new(config)
36
+ jira_project.list
37
+ end
26
38
 
27
39
  project = prompt.select('Which project does the issue belong to?') do |menu|
28
40
  projects.each do |item|
29
- menu.choice name: item[:name], value: { id: item[:id], key: item[:key] }
41
+ menu.choice name: item['name'], value: { id: item['id'], key: item['key'] }
30
42
  end
31
43
  end
32
44
 
33
- user_api = JiraCommand::Jira::User.new(config)
34
- user_list = user_api.all_list(project: project[:key])
45
+ user_list = if options['refresh-user'].nil?
46
+ config['users']
47
+ else
48
+ user_api = JiraCommand::Jira::User.new(config)
49
+ user_api.all_list(project: project[:key])
50
+ end
35
51
 
36
52
  assignee = prompt.select('Who do you want to assign?') do |menu|
37
53
  user_list.each do |user|
38
- menu.choice name: user[:name], value: user[:account_id]
54
+ menu.choice name: user['name'], value: user['account_id']
39
55
  end
40
56
  end
41
57
 
42
58
  reporter = prompt.select('Who are you?') do |menu|
43
59
  user_list.each do |user|
44
- menu.choice name: user[:name], value: user[:account_id]
60
+ menu.choice name: user['name'], value: user['account_id']
45
61
  end
46
62
  end
47
63
 
@@ -9,7 +9,7 @@ module JiraCommand
9
9
  class Transition < Thor
10
10
  default_command :exec
11
11
 
12
- desc 'exec', 'transite issue status'
12
+ desc 'exec', 'transit issue status'
13
13
  option 'issue', aliases: 'i', required: true
14
14
  def exec
15
15
  config = JiraCommand::Config.new.read
@@ -1,3 +1,3 @@
1
1
  module JiraCommand
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira_command
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
  - shengbo.xu