nexpose_ticketing 1.5.1 → 1.5.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
  SHA1:
3
- metadata.gz: 5565130dee6d656e6dcf137e5b15292b463121a3
4
- data.tar.gz: 02b652f6921f322fba0b06a1318250dee45659f2
3
+ metadata.gz: 684b4c23181af744dd2a5dc0d1cc7fa2f8a0409a
4
+ data.tar.gz: 2f49abe91a7d79b6903f0641a0018c7d3c7696c4
5
5
  SHA512:
6
- metadata.gz: 01eed6d474199dd80e903d074e6d9d29023cf5f4df33336d28e7a07a1f2f4508ac1e2574637cc1bd148aed5308f22615c2006c763a6ee2ec488c3624b71419c9
7
- data.tar.gz: 74c9d16fe8097cbfb5baf30dd8190953ed3629a9ef08b41f7ccea40d54e886aa52147ca91bf296e1e563f8524d4429e8ea3c913301bc010fb25a58df779933c0
6
+ metadata.gz: 4ed8c8a8ff7d8f9e1be52c2cd4dc137ca8f49ab3d03a6b99aa9843a07398ad7d242703b936fb0ee3f8a2ae9bb24570a60abe3a81f690a75e3a8c74591cd858fb
7
+ data.tar.gz: b7cba80df97d006976e13b258948ef8c8248d879634ee97a842ac555e4958611d600c399592077e78f350e0d53265595a70f7a8d9c65cc0eaaaf977e7fe795b0
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nexpose_ticketing (1.3.0)
5
+ nexpose (~> 3.1, >= 3.1.0)
6
+ nokogiri (~> 1.6)
7
+ savon (~> 2.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ akami (1.2.2)
13
+ gyoku (>= 0.4.0)
14
+ nokogiri
15
+ builder (3.2.2)
16
+ diff-lcs (1.2.5)
17
+ gyoku (1.1.1)
18
+ builder (>= 2.1.2)
19
+ httpi (2.1.1)
20
+ rack
21
+ rubyntlm (~> 0.3.2)
22
+ macaddr (1.7.1)
23
+ systemu (~> 2.6.2)
24
+ mini_portile2 (2.0.0)
25
+ nexpose (3.3.0)
26
+ nokogiri (1.6.7.2)
27
+ mini_portile2 (~> 2.0.0.rc2)
28
+ nori (2.4.0)
29
+ rack (1.6.4)
30
+ rspec (3.4.0)
31
+ rspec-core (~> 3.4.0)
32
+ rspec-expectations (~> 3.4.0)
33
+ rspec-mocks (~> 3.4.0)
34
+ rspec-core (3.4.4)
35
+ rspec-support (~> 3.4.0)
36
+ rspec-expectations (3.4.0)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.4.0)
39
+ rspec-mocks (3.4.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.4.0)
42
+ rspec-support (3.4.1)
43
+ rubyntlm (0.3.4)
44
+ savon (2.5.1)
45
+ akami (~> 1.2.0)
46
+ builder (>= 2.1.2)
47
+ gyoku (~> 1.1.0)
48
+ httpi (~> 2.1.0)
49
+ nokogiri (>= 1.4.0)
50
+ nori (~> 2.4.0)
51
+ uuid (~> 2.3.7)
52
+ wasabi (~> 3.3.0)
53
+ systemu (2.6.5)
54
+ uuid (2.3.8)
55
+ macaddr (~> 1.0)
56
+ wasabi (3.3.1)
57
+ httpi (~> 2.0)
58
+ nokogiri (>= 1.4.0)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ nexpose_ticketing!
65
+ rspec (~> 3.2, >= 3.2.0)
66
+ rspec-mocks (~> 3.2, >= 3.2.0)
67
+
68
+ BUNDLED WITH
69
+ 1.12.5
data/README.md CHANGED
@@ -62,6 +62,18 @@ To set custom locations for the key and IV files, update the following values wi
62
62
 
63
63
  To set a custom path after the integration has already executed, the files must be moved to the new location manually.
64
64
 
65
+ #### Encrypting the Configuration without running the Integration
66
+ The Nexpose Ticketing integration can encrypt its configuration file without running the gem. This allows users to secure their login information for future use e.g for use in a cron-schedule.
67
+
68
+ The command to do so is:
69
+ ```
70
+ nexpose_ticketing servicename -e
71
+ ```
72
+ or
73
+ ```
74
+ nexpose_ticketing servicename --encrypt_config
75
+ ```
76
+
65
77
  ## Contributions
66
78
 
67
79
  To develop your own implementation for Ticketing service 'foo':
@@ -90,12 +102,16 @@ We welcome contributions to this package. We ask only that pull requests and pat
90
102
 
91
103
  ## Changelog
92
104
 
105
+ ### 1.5.2
106
+ 26-05-17
107
+ Command line options have been added to the gem. Several are common to all Nexpose gem integrations. Call the gem with '-h' or '--help' to view these options.
108
+
93
109
  ### 1.5.1
94
110
  16-05-17
95
111
  Minor update to change storage location of log files.
96
112
 
97
113
  ### 1.5.0
98
- 16-05-17
114
+ 16-05-17
99
115
  Added an encryption configuration file.
100
116
  Usernames and passwords within the configuration files are now encrypted when the application runs.
101
117
 
@@ -1,16 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'yaml'
3
3
  require 'nexpose_ticketing'
4
- require 'nexpose_ticketing/utilities/nx_logger'
5
4
  require 'nexpose_ticketing/version'
6
- require 'optparse'
5
+ require 'nexpose_ticketing/utilities/nx_logger'
7
6
  require_relative '../lib/nexpose_ticketing/utilities/config_parser'
7
+ require 'nexpose_ticketing/utilities/gem_options'
8
8
 
9
9
  options = {}
10
- OptionParser.new do |opts|
11
- opts.banner = 'Usage: nexpose_ticketing [service name]'
12
- end.parse!
13
-
14
10
  if ARGV.count == 0
15
11
  puts 'Ticketing system name required.'
16
12
  exit -1
@@ -32,6 +28,14 @@ end
32
28
  ticket_service = YAML.load_file(service_config_path)
33
29
  enc_path = ticket_service[:encryption_options][:directory]
34
30
 
31
+ # Setup CLI Options
32
+ config_paths = [config_path, service_config_path]
33
+ GemOptions.create_parser
34
+ .with_banner_and_options('nexpose_ticketing service_name')
35
+ .with_configuration_encryption(config_paths, enc_path)
36
+ .with_help_and_version('Nexpose Ticketing', NexposeTicketing::VERSION)
37
+ .parse
38
+
35
39
  # Now we can load the config as normal
36
40
  service_options = ConfigParser.get_config(config_path, enc_path)
37
41
 
@@ -0,0 +1,91 @@
1
+ require 'optparse'
2
+
3
+ class GemOptions
4
+
5
+ @parser
6
+
7
+ def self.create_parser
8
+ @parser = OptionParser.new
9
+ self
10
+ end
11
+
12
+ # How the gem is used e.g 'nexpose ticketing jira [options]'
13
+ def self.with_banner(gem_usage_string)
14
+ @parser.banner = "Usage: #{gem_usage_string} [options]"
15
+ @parser.separator ''
16
+ self
17
+ end
18
+
19
+ # Header for options list
20
+ def self.with_options
21
+ @parser.separator 'Options:'
22
+ self
23
+ end
24
+
25
+ # Creates banner and options
26
+ def self.with_banner_and_options(gem_usage_string)
27
+ with_banner(gem_usage_string)
28
+ with_options
29
+ self
30
+ end
31
+
32
+ # For setting encryption switch. Can be set to work with two configurations
33
+ # Config_paths is an array
34
+ def self.with_configuration_encryption(config_paths, enc_path = nil)
35
+ @parser.on('-e',
36
+ '--encrypt_config',
37
+ 'Encrypt the configuration file(s) without running the gem') do |e|
38
+ ConfigParser.get_config(config_paths.first, enc_path) unless enc_path.nil?
39
+ ConfigParser.get_config(config_paths.last)
40
+ puts "\nConfiguration File(s) Encrypted"
41
+ exit
42
+ end
43
+ self
44
+ end
45
+
46
+ def self.with_help
47
+ @parser.on_tail('-h', '--help', 'Show this message') do |h|
48
+ puts @parser
49
+ exit
50
+ end
51
+ self
52
+ end
53
+
54
+ def self.with_version(gem, version)
55
+ @parser.on_tail('--version', 'Version Information') do |v|
56
+ puts "#{gem} #{version}"
57
+ exit
58
+ end
59
+ self
60
+ end
61
+
62
+ def self.with_help_and_version(gem, version)
63
+ with_help
64
+ with_version(gem, version)
65
+ self
66
+ end
67
+
68
+ # Method to allow integrations to create own options, with both short and long
69
+ # switches and description.
70
+ # Handler is the block to run when option is called.
71
+ def self.with_other_option(short_switch, long_switch, description, &handler)
72
+ @parser.on("-#{short_switch}", "--#{long_switch}", description) do |opt|
73
+ handler.call
74
+ end
75
+ end
76
+
77
+ # Method to allow integrations to create own options, with only one size of
78
+ # switch and description.
79
+ # '-' for short switches and '--' for long switches is required.
80
+ # Handler is the block to run when option is called.
81
+ def self.with_single_switch_option(identifier, switch, description, &handler)
82
+ @parser.on("#{identifier}#{switch}", description) do |opt|
83
+ handler.call
84
+ end
85
+ end
86
+
87
+ # Parses the options to make them available
88
+ def self.parse
89
+ @parser.parse!
90
+ end
91
+ end
@@ -1,3 +1,3 @@
1
1
  module NexposeTicketing
2
- VERSION = '1.5.1'
2
+ VERSION = '1.5.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexpose_ticketing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Finol
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-05-16 00:00:00.000000000 Z
14
+ date: 2017-05-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nexpose
@@ -152,6 +152,7 @@ extra_rdoc_files:
152
152
  - README.md
153
153
  files:
154
154
  - Gemfile
155
+ - Gemfile.lock
155
156
  - README.md
156
157
  - bin/nexpose_ticketing
157
158
  - lib/nexpose_ticketing.rb
@@ -180,6 +181,7 @@ files:
180
181
  - lib/nexpose_ticketing/ticket_repository.rb
181
182
  - lib/nexpose_ticketing/ticket_service.rb
182
183
  - lib/nexpose_ticketing/utilities/config_parser.rb
184
+ - lib/nexpose_ticketing/utilities/gem_options.rb
183
185
  - lib/nexpose_ticketing/utilities/nx_logger.rb
184
186
  - lib/nexpose_ticketing/version.rb
185
187
  homepage: https://github.com/rapid7/nexpose_ticketing
@@ -202,8 +204,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
204
  version: '0'
203
205
  requirements: []
204
206
  rubyforge_project:
205
- rubygems_version: 2.6.7
207
+ rubygems_version: 2.4.3
206
208
  signing_key:
207
209
  specification_version: 4
208
210
  summary: Ruby Nexpose Ticketing Engine.
209
211
  test_files: []
212
+ has_rdoc: