hieracles 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9456a3fe61cef7f54210ecd5d1c0db375afce266
4
- data.tar.gz: 4d7563bd18c44b03267bf19bfecf6c8f90d5c7c4
3
+ metadata.gz: 9a85430681b128f7d7d677ced8d3a826b95ea42b
4
+ data.tar.gz: 7ada85e7170ed548503c90e42a857bda38770cc2
5
5
  SHA512:
6
- metadata.gz: dafdb9eb00ae8883c9a365724e86af97e819bcb70ea774a00342fb0d7cb2e6231eb1b9df1be562ef3bf88cd444524deebfb50e80c59d77335f8f0aa8935dfb16
7
- data.tar.gz: faf09ad63a05cd373e8fd7a1a2f13f772580dca3f1a3b34efe599b9d20d6f5493c268236c6c945798bd131bf040c60dbeea83deed892806d7ffbebfa9d2e6d3c
6
+ metadata.gz: 85178885c1f4a84dddf34f9e0bed2fbb70e688340360773ab99937c052c9f3bf96b16af6111fcb2acfd711d218b7253a76fed0add77f71aa6fb0278da27d9c8c
7
+ data.tar.gz: d7913dcc5d768381888148244e501d9a8c4e01b79f8fe7f6d31d3a1021e0a1ccc1167e4cb7e3b8114f81999b2b9e7e1f5f3b02c5307b1f94e379b3d74643d1f3
data/CHANGELOG.md CHANGED
@@ -1,7 +1,10 @@
1
1
  Hieracles Changelog
2
2
  =======================
3
3
 
4
- ### 0.0.2 - 2016-09-16
4
+ ### 0.0.3 - 2015-09-21
5
+ - preparing hieracles to be packageable for debian
6
+
7
+ ### 0.0.2 - 2015-09-16
5
8
  - added `yaml` format including comments about where the params is defined
6
9
  - the uncommented yaml is now the format `rawyaml`
7
10
 
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rspec/core/rake_task'
6
6
  desc 'launch rspec tests'
7
7
  task :spec do
8
8
  RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.rspec_opts = ['-c', '-f Fivemat', '-r ./spec/spec_helper.rb']
9
+ t.rspec_opts = ['-c', '-f progress', '-r ./spec/spec_helper.rb']
10
10
  t.pattern = 'spec/lib/**/*_spec.rb'
11
11
  end
12
12
  end
@@ -27,10 +27,6 @@ module Hieracles
27
27
  @node.params_tree(false).to_yaml
28
28
  end
29
29
 
30
- def modules(args)
31
- @node.modules.to_yaml
32
- end
33
-
34
30
  end
35
31
  end
36
32
  end
@@ -27,11 +27,6 @@ module Hieracles
27
27
  commented_yaml_tree(false)
28
28
  end
29
29
 
30
- def modules(args)
31
- @node.modules.to_yaml
32
- end
33
-
34
-
35
30
  def commented_yaml_tree(without_common = true)
36
31
  tree = @node.params_tree(without_common)
37
32
  params = Hash[@node.params(without_common)]
@@ -40,26 +35,31 @@ module Hieracles
40
35
 
41
36
  def mergetree(output, key, leaf, params)
42
37
  indent = ' ' * key.count
43
- case leaf.class.name
44
- when 'Hash'
45
- leaf.each do |k, v|
46
- output += "\n" + indent + k + ': '
47
- output = mergetree(output, key + [k], v, params)
48
- end
49
- when 'Array'
50
- yaml = leaf.to_yaml[4..-1]
51
- aryaml = yaml.each_line.map do |l|
52
- indent + l
53
- end
54
- output += "\n" + indent + "# " + params[key.join('.')][0][:file]
55
- output += "\n" + aryaml.join().chomp
56
- when 'String'
57
- output += leaf
58
- if params["#{key.join('.')}"]
59
- output += " # " + params[key.join('.')][0][:file]
60
- else
61
- raise "#{key}"
62
- end
38
+ send("add_#{leaf.class.name.downcase}".to_sym, output, key, leaf, params, indent)
39
+ end
40
+
41
+ def add_hash(output, key, leaf, params, indent)
42
+ leaf.each do |k, v|
43
+ output += "\n" + indent + k + ': '
44
+ output = mergetree(output, key + [k], v, params)
45
+ end
46
+ output
47
+ end
48
+
49
+ def add_array(output, key, leaf, params, indent)
50
+ yaml = leaf.to_yaml[4..-1]
51
+ aryaml = yaml.each_line.map do |l|
52
+ indent + l
53
+ end
54
+ output += "\n" + indent + "# " + params[key.join('.')][0][:file]
55
+ output += "\n" + aryaml.join().chomp
56
+ output
57
+ end
58
+
59
+ def add_string(output, key, leaf, params, indent)
60
+ output += leaf
61
+ if params["#{key.join('.')}"]
62
+ output += " # " + params[key.join('.')][0][:file]
63
63
  end
64
64
  output
65
65
  end
@@ -14,9 +14,7 @@ describe Hieracles::Formats::Rawyaml do
14
14
  }
15
15
  )
16
16
  }
17
- it "outputs proper text" do
18
- expect(yaml_format.info nil).to eq expected
19
- end
17
+ it { expect(yaml_format.info nil).to eq expected }
20
18
  end
21
19
 
22
20
  describe ".files" do
@@ -24,9 +22,7 @@ describe Hieracles::Formats::Rawyaml do
24
22
  before {
25
23
  allow(node).to receive(:files).and_return(['path1', 'path2'])
26
24
  }
27
- it "outputs proper text" do
28
- expect(yaml_format.files nil).to eq expected
29
- end
25
+ it { expect(yaml_format.files nil).to eq expected }
30
26
  end
31
27
 
32
28
  describe ".paths" do
@@ -34,12 +30,11 @@ describe Hieracles::Formats::Rawyaml do
34
30
  before {
35
31
  allow(node).to receive(:paths).and_return(['path1', 'path2'])
36
32
  }
37
- it "outputs proper text" do
38
- expect(yaml_format.paths nil).to eq expected
39
- end
33
+ it { expect(yaml_format.paths nil).to eq expected }
40
34
  end
41
35
 
42
36
  describe ".modules" do
37
+ let(:expected) { "---\nmodule1: value\nlongmodule2: not found\n" }
43
38
  before {
44
39
  allow(node).to receive(:modules).and_return(
45
40
  {
@@ -48,13 +43,31 @@ describe Hieracles::Formats::Rawyaml do
48
43
  }
49
44
  )
50
45
  }
51
- let(:expected) { "---\nmodule1: value\nlongmodule2: not found\n" }
52
- it "outputs proper text" do
53
- expect(yaml_format.modules nil).to eq expected
54
- end
46
+ it { expect(yaml_format.modules nil).to eq expected }
55
47
  end
56
48
 
57
49
  describe ".params" do
50
+ let(:expected) {
51
+ "---\n" +
52
+ "params:\n" +
53
+ " this:\n" +
54
+ " var: value1\n"
55
+ }
56
+ before {
57
+ allow(node).to receive(:params_tree).and_return(
58
+ {
59
+ 'params' => {
60
+ 'this' => {
61
+ 'var' => 'value1'
62
+ }
63
+ }
64
+ }
65
+ )
66
+ }
67
+ it { expect(yaml_format.params nil).to eq expected }
68
+ end
69
+
70
+ describe ".allparams" do
58
71
  let(:expected) {
59
72
  "---\n"+
60
73
  "params:\n" +
@@ -72,8 +85,7 @@ describe Hieracles::Formats::Rawyaml do
72
85
  }
73
86
  )
74
87
  }
75
- it "outputs proper text" do
76
- expect(yaml_format.params nil).to eq expected
77
- end
88
+ it { expect(yaml_format.allparams nil).to eq expected }
78
89
  end
90
+
79
91
  end
@@ -14,9 +14,7 @@ describe Hieracles::Formats::Yaml do
14
14
  }
15
15
  )
16
16
  }
17
- it "outputs proper text" do
18
- expect(yaml_format.info nil).to eq expected
19
- end
17
+ it { expect(yaml_format.info nil).to eq expected }
20
18
  end
21
19
 
22
20
  describe ".files" do
@@ -24,9 +22,7 @@ describe Hieracles::Formats::Yaml do
24
22
  before {
25
23
  allow(node).to receive(:files).and_return(['path1', 'path2'])
26
24
  }
27
- it "outputs proper text" do
28
- expect(yaml_format.files nil).to eq expected
29
- end
25
+ it { expect(yaml_format.files nil).to eq expected }
30
26
  end
31
27
 
32
28
  describe ".paths" do
@@ -34,12 +30,11 @@ describe Hieracles::Formats::Yaml do
34
30
  before {
35
31
  allow(node).to receive(:paths).and_return(['path1', 'path2'])
36
32
  }
37
- it "outputs proper text" do
38
- expect(yaml_format.paths nil).to eq expected
39
- end
33
+ it { expect(yaml_format.paths nil).to eq expected }
40
34
  end
41
35
 
42
36
  describe ".modules" do
37
+ let(:expected) { "---\nmodule1: value\nlongmodule2: not found\n" }
43
38
  before {
44
39
  allow(node).to receive(:modules).and_return(
45
40
  {
@@ -48,13 +43,39 @@ describe Hieracles::Formats::Yaml do
48
43
  }
49
44
  )
50
45
  }
51
- let(:expected) { "---\nmodule1: value\nlongmodule2: not found\n" }
52
- it "outputs proper text" do
53
- expect(yaml_format.modules nil).to eq expected
54
- end
46
+ it { expect(yaml_format.modules nil).to eq expected }
55
47
  end
56
48
 
57
49
  describe ".params" do
50
+ let(:expected) {
51
+ "---\n" +
52
+ "params: \n" +
53
+ " this: \n" +
54
+ " var: value1 # some/file"
55
+ }
56
+ before {
57
+ allow(node).to receive(:params).and_return(
58
+ {
59
+ 'params.this.var' => [{
60
+ file: 'some/file',
61
+ value: 'value1'
62
+ }]
63
+ }
64
+ )
65
+ allow(node).to receive(:params_tree).and_return(
66
+ {
67
+ 'params' => {
68
+ 'this' => {
69
+ 'var' => 'value1'
70
+ }
71
+ }
72
+ }
73
+ )
74
+ }
75
+ it { expect(yaml_format.params nil).to eq expected }
76
+ end
77
+
78
+ describe ".allparams" do
58
79
  let(:expected) {
59
80
  "---\n"+
60
81
  "params: \n" +
@@ -80,9 +101,7 @@ describe Hieracles::Formats::Yaml do
80
101
  }
81
102
  )
82
103
  }
83
- it "outputs proper text" do
84
- expect(yaml_format.params nil).to eq expected
85
- end
104
+ it { expect(yaml_format.allparams nil).to eq expected }
86
105
  end
87
106
 
88
107
  describe '.mergetree' do
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hieracles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -127,7 +127,6 @@ files:
127
127
  - README.md
128
128
  - Rakefile
129
129
  - bin/hc
130
- - bin/nodeinfo
131
130
  - hieracles.gemspec
132
131
  - lib/hieracles.rb
133
132
  - lib/hieracles/config.rb
@@ -175,6 +174,7 @@ files:
175
174
  - spec/lib/utils_spec.rb
176
175
  - spec/spec_helper.rb
177
176
  - tools/completion/_hc
177
+ - tools/nodeinfo
178
178
  homepage: https://github.com/Gandi/hieracles
179
179
  licenses:
180
180
  - MIT
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.4.7
199
+ rubygems_version: 2.4.8
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: CLI tool for Hiera parameters visualisation.