-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreate_jira_summary_index.rb
executable file
·82 lines (54 loc) · 1.6 KB
/
create_jira_summary_index.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env ruby
# encoding: utf-8
##########################################################
###
## File: create_jira_summary_index.rb
## Desc: Extract the summary component from JIRA *.json files
## By: Dewayne VanHoozer ([email protected])
#
require 'amazing_print' # Pretty print Ruby objects with proper indentation and colors
require 'json' # STDLIB
require 'debug_me' # A tool to print the labeled value of variables.
include DebugMe
require 'cli_helper' # An encapsulation of an integration of slop, nenv, inifile and configatron.
include CliHelper
configatron.version = '0.0.1'
HELP = <<EOHELP
Important:
Put important stuff here.
EOHELP
cli_helper("__file_description__") do |o|
end
# Display the usage info
if ARGV.empty?
show_usage
exit
end
# Error check your stuff; use error('some message') and warning('some message')
configatron.input_files = get_pathnames_from( configatron.arguments, '.json')
if configatron.input_files.empty?
error 'No json files were provided'
end
abort_if_errors
######################################################
# Local methods
######################################################
# Main
at_exit do
puts
puts "Done."
puts
end
ap configatron.to_h if verbose? || debug?
summaries = []
configatron.input_files.each do |filename|
stuff = JSON.parse(filename.read)
key = stuff["key"]
summary = stuff["fields"]["summary"]
desc = stuff["fields"]["description"]
status = stuff["fields"]["status"]["name"]
summaries << "#{key} - #{status} - #{summary}"
end
summaries.sort.each do |ticket|
puts ticket
end