create_ticket 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/create_ticket.gemspec +1 -0
- data/lib/create_ticket/cli.rb +11 -2
- data/lib/create_ticket/could_not_create_ticket_error.rb +5 -0
- data/lib/create_ticket/version.rb +1 -1
- data/lib/create_ticket.rb +7 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25260f0f4dc288acb2027a10c2be1afe361a66ec
|
4
|
+
data.tar.gz: 99033ee879798834f415c1323c43f279ad9fcc81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5232da953a64edff3124d5bfb0fa5e5db9e3c9eccc67aa763ccb944b1bdad54921904d0ce692d1fc6a1b68bfb84b1079039a29e00a517508c28cd830cffe5b0
|
7
|
+
data.tar.gz: 463ba37b5ffe282409ceafd7979c8e11b6b8de57e04a35470f4a9d8e6603137346eba6e24ed10ae4d7dcb7755470b6c771609f2d528f499321be0de73e4dbc69
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
export JIRA_TOKEN="your JIRA token"
|
23
|
+
export JIRA_TOKEN="your JIRA token" # If this is unset, it will ask for your JIRA username and password
|
24
24
|
export TEMPLATE_FILENAME=a-template.md.erb
|
25
25
|
export JIRA_URL=https://jira.yourwebsite.com
|
26
26
|
export JIRA_PROJECT=YOURPROJECT
|
data/create_ticket.gemspec
CHANGED
data/lib/create_ticket/cli.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'base64'
|
4
|
+
require 'highline'
|
3
5
|
require 'create_ticket'
|
4
6
|
|
5
7
|
class CreateTicket
|
@@ -12,8 +14,15 @@ class CreateTicket
|
|
12
14
|
ENV.fetch('JIRA_PROJECT')
|
13
15
|
end
|
14
16
|
|
17
|
+
def prompt_for_jira_token
|
18
|
+
cli = HighLine.new
|
19
|
+
username = cli.ask('Username: ')
|
20
|
+
password = cli.ask('Password: ') { |q| q.echo = '*' }
|
21
|
+
Base64.encode64 "#{username}:#{password}"
|
22
|
+
end
|
23
|
+
|
15
24
|
def jira_token
|
16
|
-
ENV.fetch('JIRA_TOKEN')
|
25
|
+
ENV.fetch('JIRA_TOKEN') { prompt_for_jira_token }
|
17
26
|
end
|
18
27
|
|
19
28
|
def template_filename
|
@@ -40,7 +49,7 @@ class CreateTicket
|
|
40
49
|
def run!
|
41
50
|
ticket_url = CreateTicket.new(self).create_ticket!
|
42
51
|
puts ticket_url
|
43
|
-
rescue KeyError, JSON::ParserError => e
|
52
|
+
rescue CouldNotCreateTicketError, KeyError, JSON::ParserError => e
|
44
53
|
puts e.message
|
45
54
|
exit 1
|
46
55
|
end
|
data/lib/create_ticket.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'create_ticket/version'
|
4
|
+
require 'create_ticket/could_not_create_ticket_error'
|
4
5
|
require 'markdown2confluence'
|
5
6
|
require 'faraday'
|
6
7
|
require 'json'
|
@@ -38,7 +39,12 @@ class CreateTicket
|
|
38
39
|
req.body = jira_ticket_json
|
39
40
|
end
|
40
41
|
|
41
|
-
|
42
|
+
begin
|
43
|
+
key = JSON.parse(response.body).fetch('key')
|
44
|
+
rescue KeyError
|
45
|
+
raise CouldNotCreateTicketError, "Response from JIRA was: #{response.body}"
|
46
|
+
end
|
47
|
+
|
42
48
|
"#{jira_url}/browse/#{key}"
|
43
49
|
end
|
44
50
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: create_ticket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Marek-Spartz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: highline
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Create JIRA tickets
|
112
126
|
email:
|
113
127
|
- kyle.marekspartz@govdelivery.com
|
@@ -132,6 +146,7 @@ files:
|
|
132
146
|
- exe/create_ticket
|
133
147
|
- lib/create_ticket.rb
|
134
148
|
- lib/create_ticket/cli.rb
|
149
|
+
- lib/create_ticket/could_not_create_ticket_error.rb
|
135
150
|
- lib/create_ticket/version.rb
|
136
151
|
homepage: https://github.com/govdelivery/create_ticket
|
137
152
|
licenses:
|
@@ -153,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
168
|
version: '0'
|
154
169
|
requirements: []
|
155
170
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.6.13
|
157
172
|
signing_key:
|
158
173
|
specification_version: 4
|
159
174
|
summary: Create JIRA tickets
|