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 +4 -4
- data/README.md +1 -1
- data/lib/abide_dev_utils/cli.rb +1 -0
- data/lib/abide_dev_utils/ppt.rb +3 -3
- data/lib/abide_dev_utils/ppt/coverage.rb +10 -4
- data/lib/abide_dev_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 368f622d5a56407f757e47a212edaf4279afb6a5e36f075b0f1ce2e283463d53
|
4
|
+
data.tar.gz: 329f00503b626b086375c1b725d72758e90fb32a18cec37028348a1613d8bac3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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`, `-
|
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
|
|
data/lib/abide_dev_utils/cli.rb
CHANGED
@@ -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)
|
data/lib/abide_dev_utils/ppt.rb
CHANGED
@@ -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
|
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
|
-
|
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)
|