jira-cli 0.1.3 → 0.1.4
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/README.md +46 -4
- data/lib/jira.rb +1 -0
- data/lib/jira/commands/clipboard.rb +10 -0
- data/lib/jira/commands/comment.rb +1 -1
- data/lib/jira/commands/install.rb +6 -7
- data/lib/jira/commands/log.rb +1 -1
- data/lib/jira/commands/new.rb +11 -37
- data/lib/jira/commands/rename.rb +1 -1
- data/lib/jira/commands/transition.rb +5 -15
- data/lib/jira/constants.rb +1 -1
- data/lib/jira/io.rb +17 -0
- data/lib/jira/mixins.rb +3 -3
- metadata +14 -13
- data/lib/jira/commands/copy.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4214636b9c7269a7938393d0fc276bb674a9f206
|
4
|
+
data.tar.gz: 2c12b0da63379b9b90464b55be0aed1408f42e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f57685970220ef829e128c376f0d14a62199a1eb800e79e38e3c770a05dd843c66a0c7a93e60eeb32cb7aa100a29ca34633f8b875a0d7a9edc932a8935478d67
|
7
|
+
data.tar.gz: f0d6981cfac1d5f6affe7a0be5d836e74897e69cb0b125188e457ccc1281e3ce989f7bf4094ddcd4871a7d884ad3509a30f3219ff7ed0fefbb8fb4f6e881c7ad
|
data/README.md
CHANGED
@@ -9,11 +9,23 @@ Ruby gem CLI tool used to manage JIRA workflows leveraging git
|
|
9
9
|
[](https://gemnasium.com/darrenli/jira-cli)
|
10
10
|
[](https://codeclimate.com/github/darrenli/jira-cli)
|
11
11
|
|
12
|
-
###
|
12
|
+
### Available Commands
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
jira all # Describes all local branches that match JIRA ticketing syntax
|
15
|
+
jira browse # Opens the current input ticket in your browser
|
16
|
+
jira comment # Add a comment to the input ticket
|
17
|
+
jira comments # Lists the comments of the input ticket
|
18
|
+
jira commit # Commits uncommitted work with the ticket name and summary.
|
19
|
+
jira clipboard # Copies the url of the JIRA ticket into the clipboard
|
20
|
+
jira describe # Describes the input ticket
|
21
|
+
jira install # Guides the user through JIRA installation
|
22
|
+
jira log # Logs work against the input ticket
|
23
|
+
jira new # Creates a new ticket in JIRA and checks out the git branch
|
24
|
+
jira rename # Updates the summary of the input ticket
|
25
|
+
jira sprint # Lists all tickets in active sprint
|
26
|
+
jira transition # Transitions the input ticket to the next state
|
27
|
+
jira version # Displays the version
|
28
|
+
jira help [COMMAND] # Describe available commands or one specific command
|
17
29
|
|
18
30
|
### Gem Installation
|
19
31
|
|
@@ -37,3 +49,33 @@ git repository that you're managing via JIRA.
|
|
37
49
|
|
38
50
|
Note: Authentication files are expected to drastically change. Currently, they
|
39
51
|
are completely unencrypted. Use are your own risk... (see disclaimer above)
|
52
|
+
|
53
|
+
### Disclaimer
|
54
|
+
|
55
|
+
This tool is in very early alpha and its architecture and commands
|
56
|
+
are expected to change drastically. Please only use this tool for testing
|
57
|
+
purposes.
|
58
|
+
|
59
|
+
### License
|
60
|
+
|
61
|
+
(The MIT License)
|
62
|
+
|
63
|
+
Copyright © 2014 Darren Cheng
|
64
|
+
|
65
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
66
|
+
this software and associated documentation files (the "Software"), to deal in
|
67
|
+
the Software without restriction, including without limitation the rights to
|
68
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
69
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
70
|
+
so, subject to the following conditions:
|
71
|
+
|
72
|
+
The above copyright notice and this permission notice shall be included in all
|
73
|
+
copies or substantial portions of the Software.
|
74
|
+
|
75
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
76
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
77
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
78
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
79
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
80
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
81
|
+
SOFTWARE.
|
data/lib/jira.rb
CHANGED
@@ -3,7 +3,7 @@ module Jira
|
|
3
3
|
|
4
4
|
desc "comment", "Add a comment to the input ticket"
|
5
5
|
def comment(ticket=Jira::Core.ticket)
|
6
|
-
comment = self.
|
6
|
+
comment = self.io.ask("Leave a comment for ticket #{ticket}")
|
7
7
|
if comment.strip.empty?
|
8
8
|
puts "No comment posted."
|
9
9
|
else
|
@@ -8,15 +8,14 @@ module Jira
|
|
8
8
|
desc "install", "Guides the user through JIRA installation"
|
9
9
|
def install
|
10
10
|
|
11
|
-
create_file
|
12
|
-
self.
|
11
|
+
create_file(Jira::Core.url_path, nil, verbose:false) do
|
12
|
+
self.io.ask("Enter your JIRA URL")
|
13
13
|
end
|
14
14
|
|
15
|
-
create_file
|
16
|
-
username = self.
|
17
|
-
|
18
|
-
|
19
|
-
end
|
15
|
+
create_file(Jira::Core.auth_path, nil, verbose:false) do
|
16
|
+
username = self.io.ask("Enter your JIRA username")
|
17
|
+
# TODO - hide password input
|
18
|
+
password = self.io.ask("Enter your JIRA password")
|
20
19
|
"#{username}:#{password}"
|
21
20
|
end
|
22
21
|
|
data/lib/jira/commands/log.rb
CHANGED
@@ -3,7 +3,7 @@ module Jira
|
|
3
3
|
|
4
4
|
desc "log", "Logs work against the input ticket"
|
5
5
|
def log(ticket=Jira::Core.ticket)
|
6
|
-
time_spent = self.
|
6
|
+
time_spent = self.io.ask("Time spent on #{ticket}")
|
7
7
|
self.api.post("issue/#{ticket}/worklog", { timeSpent: time_spent }) do |json|
|
8
8
|
puts "Successfully logged #{time_spent} on #{ticket}."
|
9
9
|
end
|
data/lib/jira/commands/new.rb
CHANGED
@@ -13,8 +13,8 @@ module Jira
|
|
13
13
|
return if issue_type.empty?
|
14
14
|
|
15
15
|
# determine summary and description
|
16
|
-
summary = self.
|
17
|
-
description = self.
|
16
|
+
summary = self.io.ask("Summary")
|
17
|
+
description = self.io.ask("Description")
|
18
18
|
|
19
19
|
# determine api parameters
|
20
20
|
params = {
|
@@ -29,12 +29,12 @@ module Jira
|
|
29
29
|
# post issue to server
|
30
30
|
self.api.post("issue", params) do |json|
|
31
31
|
ticket = json['key']
|
32
|
-
self.
|
32
|
+
self.clipboard(ticket)
|
33
33
|
puts "\nTicket #{Jira::Format.ticket(ticket)} created and copied"\
|
34
34
|
" to your clipboard."
|
35
|
-
if self.
|
35
|
+
if self.io.agree("Create branch")
|
36
36
|
`git branch #{ticket} 2> /dev/null`
|
37
|
-
if self.
|
37
|
+
if self.io.agree("Check-out branch")
|
38
38
|
`git checkout #{ticket} 2> /dev/null`
|
39
39
|
end
|
40
40
|
end
|
@@ -64,22 +64,9 @@ module Jira
|
|
64
64
|
projects[project['name']] = data
|
65
65
|
end
|
66
66
|
projects['Cancel'] = nil
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
menu.index_suffix = ") "
|
71
|
-
menu.header = "Select a project to create issue under"
|
72
|
-
menu.prompt = "Project: "
|
73
|
-
projects.keys.each do |choice|
|
74
|
-
menu.choice choice do
|
75
|
-
project_data = projects[choice]
|
76
|
-
if !project_data.nil?
|
77
|
-
return project_data
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
return {}
|
67
|
+
choice = self.io.choose("Select a project", projects.keys)
|
68
|
+
return {} if choice == 'Cancel'
|
69
|
+
return projects[choice]
|
83
70
|
end
|
84
71
|
|
85
72
|
#
|
@@ -96,22 +83,9 @@ module Jira
|
|
96
83
|
issue_types[issue_type['name']] = issue_type['id']
|
97
84
|
end
|
98
85
|
issue_types['Cancel'] = nil
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
menu.index_suffix = ") "
|
103
|
-
menu.header = "\nSelect an issue type"
|
104
|
-
menu.prompt = "Issue type: "
|
105
|
-
issue_types.keys.each do |choice|
|
106
|
-
menu.choice choice do
|
107
|
-
issue_type_id = issue_types[choice]
|
108
|
-
if !issue_type_id.nil?
|
109
|
-
return issue_type_id
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
return ""
|
86
|
+
choice = self.io.choose("Select an issue type", issue_types.keys)
|
87
|
+
return '' if choice == 'Cancel'
|
88
|
+
return issue_types[choice]
|
115
89
|
end
|
116
90
|
|
117
91
|
end
|
data/lib/jira/commands/rename.rb
CHANGED
@@ -4,7 +4,7 @@ module Jira
|
|
4
4
|
desc "rename", "Updates the summary of the input ticket"
|
5
5
|
def rename(ticket=Jira::Core.ticket)
|
6
6
|
self.describe(ticket)
|
7
|
-
summary = self.
|
7
|
+
summary = self.io.ask("New ticket summary?")
|
8
8
|
if !summary.strip.empty?
|
9
9
|
params = { fields: { summary: summary } }
|
10
10
|
self.api.put("issue/#{ticket}", params) do |json|
|
@@ -10,21 +10,11 @@ module Jira
|
|
10
10
|
end
|
11
11
|
options['Cancel'] = nil
|
12
12
|
|
13
|
-
self.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
options.keys.each do |choice|
|
19
|
-
menu.choice choice do
|
20
|
-
transition_id = options[choice]
|
21
|
-
if transition_id.nil?
|
22
|
-
puts "No transition was performed on #{ticket}."
|
23
|
-
else
|
24
|
-
self.api_transition(ticket, transition_id, choice)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
13
|
+
choice = self.io.choose("Transition to", options.keys)
|
14
|
+
if options[choice].nil?
|
15
|
+
puts "No transition was performed on #{ticket}."
|
16
|
+
else
|
17
|
+
self.api_transition(ticket, transition_id, choice)
|
28
18
|
end
|
29
19
|
end
|
30
20
|
end
|
data/lib/jira/constants.rb
CHANGED
data/lib/jira/io.rb
ADDED
data/lib/jira/mixins.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Jira
|
2
2
|
class CLI < Thor
|
3
3
|
|
4
|
-
require 'highline/import'
|
5
4
|
require 'json'
|
6
5
|
require 'faraday'
|
7
6
|
require 'pry-remote' rescue nil
|
7
|
+
require 'inquirer'
|
8
8
|
include Thor::Actions
|
9
9
|
|
10
10
|
protected
|
@@ -12,8 +12,8 @@ module Jira
|
|
12
12
|
#
|
13
13
|
# @return [Highline] HighLine instance for handling input
|
14
14
|
#
|
15
|
-
def
|
16
|
-
@
|
15
|
+
def io
|
16
|
+
@io ||= Jira::IO.new
|
17
17
|
end
|
18
18
|
|
19
19
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Lin Cheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -31,45 +31,45 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.18.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: faraday
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 0.9.0
|
40
40
|
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 0.9.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 0.9.0
|
50
50
|
- - '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 0.9.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: inquirer
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ~>
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.
|
59
|
+
version: 0.2.0
|
60
60
|
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 0.2.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.2.0
|
70
70
|
- - '>='
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
72
|
+
version: 0.2.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: pry-remote
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,9 +142,9 @@ files:
|
|
142
142
|
- lib/jira.rb
|
143
143
|
- lib/jira/api.rb
|
144
144
|
- lib/jira/commands/browse.rb
|
145
|
+
- lib/jira/commands/clipboard.rb
|
145
146
|
- lib/jira/commands/comment.rb
|
146
147
|
- lib/jira/commands/commit.rb
|
147
|
-
- lib/jira/commands/copy.rb
|
148
148
|
- lib/jira/commands/describe.rb
|
149
149
|
- lib/jira/commands/install.rb
|
150
150
|
- lib/jira/commands/log.rb
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/jira/core.rb
|
158
158
|
- lib/jira/exceptions.rb
|
159
159
|
- lib/jira/format.rb
|
160
|
+
- lib/jira/io.rb
|
160
161
|
- lib/jira/mixins.rb
|
161
162
|
homepage: https://github.com/darrenli/jira-cli
|
162
163
|
licenses:
|