abide_dev_utils 0.2.1 → 0.2.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
  SHA256:
3
- metadata.gz: d9e993f8a435b4be58831bc98cf1658533c8c1084f14c96c1a12ecd73ff89da6
4
- data.tar.gz: 1120b6cc91eac28ff8168e808f13c16cf6c6d844b5928f04f4f4bb6d7cda0bcb
3
+ metadata.gz: 368f622d5a56407f757e47a212edaf4279afb6a5e36f075b0f1ce2e283463d53
4
+ data.tar.gz: 329f00503b626b086375c1b725d72758e90fb32a18cec37028348a1613d8bac3
5
5
  SHA512:
6
- metadata.gz: bcf0b6aa95f003e5402be98cc797202949368ceff62e6cdb778f4002e452716ef5ef833bc0bcd34bb797f628997e1c807d88f191048a5afec767bd8bcb7dc7a3
7
- data.tar.gz: 2ca0b4fb33d0329f13e3ce04d317427b4ba67c9937b4df739d991a1692871d19c17d1eeb24d5035573a676560795ae466e6df65148693258718aeda115c9e1d8
6
+ metadata.gz: 170f8389cc8a0c27e0bd6cb152ef3a1b314203b2e970ac838e2eb514728f1faec11ed0e057d81cbb8a26acccfc7a23299673bdf814e5e60f35eaddf91c6446b3
7
+ data.tar.gz: 5077c372590de6d0f40931f69f4d70a35be289440ad5e26f93730c4fab171f38262ec81d13616b2f7fba01ccba4c14cc6e82e2ca3a186f09207f7918e624aaca
data/README.md CHANGED
@@ -125,7 +125,7 @@ Install the gem:
125
125
  * `--root-dir`, `-r` - Path to the root directory of your module. Defaults to the current working directory
126
126
  * `--absolute-template-dir`, `-A` - Allows you to specify an absolute path with `--template-dir`. This is useful if your template directory is not relative to your module's root directory
127
127
  * `--template-name`, `-n` - Allows you to specify a template name if it is different than the `TYPE` parameter
128
- * `--vars`, `-v` - Comma-separated key=value pairs to pass in to the template renderer. This allows you to pass arbitrary values that can be used in your templates.
128
+ * `--vars`, `-V` - Comma-separated key=value pairs to pass in to the template renderer. This allows you to pass arbitrary values that can be used in your templates.
129
129
 
130
130
  `abide puppet new` exposes a few variables for you to use in your templates by default:
131
131
 
@@ -20,6 +20,7 @@ module Abide
20
20
  parser.main_options.version = AbideDevUtils::VERSION
21
21
  parser.main_options.banner = ROOT_CMD_BANNER
22
22
  parser.add_command(CmdParse::HelpCommand.new, default: true)
23
+ parser.add_command(CmdParse::VersionCommand.new(add_switches: true))
23
24
  parser.add_command(PuppetCommand.new)
24
25
  parser.add_command(XccdfCommand.new)
25
26
  parser.add_command(TestCommand.new)
@@ -9,7 +9,7 @@ module AbideDevUtils
9
9
  # the full namespace for all classes in that directory.
10
10
  # @param puppet_class_dir [String] path to a dir containing Puppet manifests
11
11
  # @return [String] The namespace for all classes in manifests in the dir
12
- def find_class_namespace(puppet_class_dir)
12
+ def self.find_class_namespace(puppet_class_dir)
13
13
  path = Pathname.new(puppet_class_dir)
14
14
  mod_root = nil
15
15
  ns_parts = []
@@ -34,7 +34,7 @@ module AbideDevUtils
34
34
  # metadata.json, if it exists, or by using the parent directory name.
35
35
  # @param pathname [Pathname] A Pathname object of the module's manifests dir
36
36
  # @return [String] The module's namespace root
37
- def find_mod_root(pathname)
37
+ def self.find_mod_root(pathname)
38
38
  metadata_file = nil
39
39
  pathname.entries.each do |e|
40
40
  metadata_file = "#{pathname}/metadata.json" if File.basename(e) == 'metadata.json'
@@ -52,7 +52,7 @@ module AbideDevUtils
52
52
 
53
53
  # @return [Array] An array of frozen arrays where each sub-array's
54
54
  # index 0 is class_name and index 1 is the full path to the file.
55
- def find_all_classes_and_paths(puppet_class_dir)
55
+ def self.find_all_classes_and_paths(puppet_class_dir)
56
56
  all_cap = []
57
57
  Dir.each_child(puppet_class_dir) do |c|
58
58
  path = "#{puppet_class_dir}/#{c}"
@@ -13,12 +13,14 @@ module AbideDevUtils
13
13
  def self.generate(puppet_class_dir, hiera_path, profile = nil)
14
14
  coverage = {}
15
15
  coverage['classes'] = {}
16
- all_cap = find_all_classes_and_paths(puppet_class_dir)
16
+ all_cap = AbideDevUtils::Ppt.find_all_classes_and_paths(puppet_class_dir)
17
17
  invalid_classes = find_invalid_classes(all_cap)
18
- valid_classes = all_cap.dup.transpose[0] - invalid_classes
18
+ valid_classes = find_valid_classes(all_cap, invalid_classes)
19
19
  coverage['classes']['invalid'] = invalid_classes
20
20
  coverage['classes']['valid'] = valid_classes
21
21
  hiera = YAML.safe_load(File.open(hiera_path))
22
+ profile&.gsub!(/^profile_/, '') unless profile.nil?
23
+
22
24
  matcher = profile.nil? ? /^profile_/ : /^profile_#{profile}/
23
25
  hiera.each do |k, v|
24
26
  key_base = k.split('::')[-1]
@@ -50,9 +52,13 @@ module AbideDevUtils
50
52
  out_hash
51
53
  end
52
54
 
53
- def self.find_valid_classes(all_cap)
55
+ def self.find_valid_classes(all_cap, invalid_classes)
54
56
  all_classes = all_cap.dup.transpose[0]
55
- all_classes - find_invalid_classes(all_cap)
57
+ return [] if all_classes.nil?
58
+
59
+ return all_classes - invalid_classes unless invalid_classes.nil?
60
+
61
+ all_classes
56
62
  end
57
63
 
58
64
  def self.find_invalid_classes(all_cap)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AbideDevUtils
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abide_dev_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heston Snodgrass