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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7ea0efc3dfd86f41e1499971b8452215bc52492
4
- data.tar.gz: 1c47e481cd91abb6707fbf90c8f5282a1c2fb63e
3
+ metadata.gz: 4214636b9c7269a7938393d0fc276bb674a9f206
4
+ data.tar.gz: 2c12b0da63379b9b90464b55be0aed1408f42e11
5
5
  SHA512:
6
- metadata.gz: d4d7b6bfbac5270fb757b1134ca0df4219313cfd9c9cdd43a1c965803d70613ad16531facc1443a50d91b7443131506fc534d5c8f4b2889135a5affd5e664f37
7
- data.tar.gz: 3afb8c20df14297bfea66a11a7aca5bb02523c33ff91d4f99f2410140c43ace0c3007ce5cbc78e2324e23ee9818586a5db5f200ab66e31b03db13184fdb85b0b
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
  [![Dependency Status](https://gemnasium.com/darrenli/jira-cli.png)](https://gemnasium.com/darrenli/jira-cli)
10
10
  [![Code Climate](https://codeclimate.com/github/darrenli/jira-cli.png)](https://codeclimate.com/github/darrenli/jira-cli)
11
11
 
12
- ### Disclaimer
12
+ ### Available Commands
13
13
 
14
- This tool is in very early alpha and its architecture and commands
15
- are expected to change drastically. Please only use this tool for testing
16
- purposes.
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.
@@ -4,6 +4,7 @@ require 'thor'
4
4
  require 'jira/constants'
5
5
  require 'jira/core'
6
6
  require 'jira/api'
7
+ require 'jira/io'
7
8
  require 'jira/format'
8
9
  require 'jira/mixins'
9
10
  require 'jira/exceptions'
@@ -0,0 +1,10 @@
1
+ module Jira
2
+ class CLI < Thor
3
+
4
+ desc "clipboard", "Copies the url of the JIRA ticket into the clipboard"
5
+ def clipboard(ticket=Jira::Core.ticket)
6
+ `echo #{Jira::Core.url}/browse/#{ticket} | pbcopy`
7
+ end
8
+
9
+ end
10
+ end
@@ -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.cli.ask("Leave a comment for ticket #{ticket}:")
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 Jira::Core.url_path, nil, verbose:false do
12
- self.cli.ask("Enter your JIRA URL: ")
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 Jira::Core.auth_path, nil, verbose:false do
16
- username = self.cli.ask("Enter your JIRA username: ")
17
- password = self.cli.ask("Enter your JIRA password: ") do |q|
18
- q.echo = false
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
 
@@ -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.cli.ask("Time spent on #{ticket}: ")
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
@@ -13,8 +13,8 @@ module Jira
13
13
  return if issue_type.empty?
14
14
 
15
15
  # determine summary and description
16
- summary = self.cli.ask("\nSummary: ")
17
- description = self.cli.ask("Description:")
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.copy(ticket)
32
+ self.clipboard(ticket)
33
33
  puts "\nTicket #{Jira::Format.ticket(ticket)} created and copied"\
34
34
  " to your clipboard."
35
- if self.cli.agree("Create branch? (yes/no) ")
35
+ if self.io.agree("Create branch")
36
36
  `git branch #{ticket} 2> /dev/null`
37
- if self.cli.agree("Checkout branch? (yes/no) ")
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
- self.cli.choose do |menu|
69
- menu.index = :number
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
- self.cli.choose do |menu|
101
- menu.index = :number
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
@@ -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.cli.ask("What should the new ticket summary be?")
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.cli.choose do |menu|
14
- menu.index = :number
15
- menu.index_suffix = ") "
16
- menu.header = "Transition #{Jira::Format.ticket(ticket)} to"
17
- menu.prompt = "Transition to: "
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
@@ -1,5 +1,5 @@
1
1
  module Jira
2
2
 
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
 
5
5
  end
@@ -0,0 +1,17 @@
1
+ module Jira
2
+ class IO
3
+
4
+ def ask(prompt)
5
+ Ask.input(prompt)
6
+ end
7
+
8
+ def agree(prompt)
9
+ Ask.confirm(prompt, default: false)
10
+ end
11
+
12
+ def choose(prompt, options)
13
+ options[Ask.list(prompt, options)]
14
+ end
15
+
16
+ end
17
+ end
@@ -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 cli
16
- @highline ||= ::HighLine.new
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.3
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-01-31 00:00:00.000000000 Z
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: highline
34
+ name: faraday
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ~>
38
38
  - !ruby/object:Gem::Version
39
- version: 1.6.20
39
+ version: 0.9.0
40
40
  - - '>='
41
41
  - !ruby/object:Gem::Version
42
- version: 1.6.20
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: 1.6.20
49
+ version: 0.9.0
50
50
  - - '>='
51
51
  - !ruby/object:Gem::Version
52
- version: 1.6.20
52
+ version: 0.9.0
53
53
  - !ruby/object:Gem::Dependency
54
- name: faraday
54
+ name: inquirer
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ~>
58
58
  - !ruby/object:Gem::Version
59
- version: 0.9.0
59
+ version: 0.2.0
60
60
  - - '>='
61
61
  - !ruby/object:Gem::Version
62
- version: 0.9.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.9.0
69
+ version: 0.2.0
70
70
  - - '>='
71
71
  - !ruby/object:Gem::Version
72
- version: 0.9.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:
@@ -1,10 +0,0 @@
1
- module Jira
2
- class CLI < Thor
3
-
4
- desc "copy", "Copies the url of the JIRA ticket into the clipboard"
5
- def copy(ticket=Jira::Core.ticket)
6
- `echo #{Jira::Core.url}/browse/#{ticket} | pbcopy`
7
- end
8
-
9
- end
10
- end