puppet-syntax 1.3.0 → 1.4.0
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.
- data/.travis.yml +1 -0
- data/CHANGELOG +5 -0
- data/Rakefile +1 -1
- data/jenkins.sh +4 -1
- data/lib/puppet-syntax/manifests.rb +2 -3
- data/lib/puppet-syntax/version.rb +1 -1
- data/puppet-syntax.gemspec +1 -1
- data/spec/puppet-syntax/manifests_spec.rb +19 -18
- data/spec/puppet-syntax/tasks/puppet-syntax_spec.rb +10 -2
- data/spec/puppet-syntax/templates_spec.rb +11 -11
- data/spec/puppet-syntax_spec.rb +3 -3
- metadata +9 -9
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
2014-12-04 Release 1.4.0
|
2
|
+
- Rspec 3 is now supported, thanks @tuxmea
|
3
|
+
- Build error fixed where gem_publisher was used prematurely
|
4
|
+
- Lazy load Puppet only when it's required, thanks @logicminds
|
5
|
+
|
1
6
|
2014-08-07 Release 1.3.0
|
2
7
|
- Add the ability to pass hieradata_paths array of globs to check
|
3
8
|
- Check hieradata in modules ('**/data/**/*.yaml') by default
|
data/Rakefile
CHANGED
data/jenkins.sh
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
set -eu
|
3
3
|
|
4
|
+
# Avoid Psych bug in Ruby 1.9.3p0 on Ubuntu 12.04
|
5
|
+
export RBENV_VERSION="1.9.3"
|
6
|
+
|
4
7
|
rm -f Gemfile.lock
|
5
|
-
bundle install --path "${HOME}/bundles/${JOB_NAME}"
|
8
|
+
bundle install --path "${HOME}/bundles/${JOB_NAME}" --shebang ruby
|
6
9
|
bundle exec rake
|
7
10
|
bundle exec rake publish_gem
|
data/puppet-syntax.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'puppet'
|
2
3
|
|
3
4
|
describe PuppetSyntax::Manifests do
|
4
5
|
let(:subject) { PuppetSyntax::Manifests.new }
|
@@ -11,60 +12,60 @@ describe PuppetSyntax::Manifests do
|
|
11
12
|
files = fixture_manifests('pass.pp')
|
12
13
|
res = subject.check(files)
|
13
14
|
|
14
|
-
res.
|
15
|
+
expect(res).to eq([])
|
15
16
|
end
|
16
17
|
|
17
18
|
it 'should return an error from an invalid file' do
|
18
19
|
files = fixture_manifests('fail_error.pp')
|
19
20
|
res = subject.check(files)
|
20
21
|
|
21
|
-
res.
|
22
|
-
res.
|
22
|
+
expect(res.size).to eq(1)
|
23
|
+
expect(res[0]).to match(/Syntax error at .*:3$/)
|
23
24
|
end
|
24
25
|
|
25
26
|
it 'should return a warning from an invalid file' do
|
26
27
|
files = fixture_manifests('fail_warning.pp')
|
27
28
|
res = subject.check(files)
|
28
29
|
|
29
|
-
res.
|
30
|
-
res[0].
|
31
|
-
res[1].
|
30
|
+
expect(res.size).to eq(2)
|
31
|
+
expect(res[0]).to match(/Unrecognised escape sequence '\\\[' .* at line 3$/)
|
32
|
+
expect(res[1]).to match(/Unrecognised escape sequence '\\\]' .* at line 3$/)
|
32
33
|
end
|
33
34
|
|
34
35
|
it 'should ignore warnings about storeconfigs' do
|
35
36
|
files = fixture_manifests('pass_storeconfigs.pp')
|
36
37
|
res = subject.check(files)
|
37
38
|
|
38
|
-
res.
|
39
|
+
expect(res).to eq([])
|
39
40
|
end
|
40
41
|
|
41
42
|
it 'should read more than one valid file' do
|
42
43
|
files = fixture_manifests(['pass.pp', 'pass_storeconfigs.pp'])
|
43
44
|
res = subject.check(files)
|
44
45
|
|
45
|
-
res.
|
46
|
+
expect(res).to eq([])
|
46
47
|
end
|
47
48
|
|
48
49
|
it 'should continue after finding an error in the first file' do
|
49
50
|
files = fixture_manifests(['fail_error.pp', 'fail_warning.pp'])
|
50
51
|
res = subject.check(files)
|
51
52
|
|
52
|
-
res.
|
53
|
-
res[0].
|
54
|
-
res[1].
|
55
|
-
res[2].
|
53
|
+
expect(res.size).to eq(3)
|
54
|
+
expect(res[0]).to match(/Syntax error at '\}' .*:3$/)
|
55
|
+
expect(res[1]).to match(/Unrecognised escape sequence '\\\[' .* at line 3$/)
|
56
|
+
expect(res[2]).to match(/Unrecognised escape sequence '\\\]' .* at line 3$/)
|
56
57
|
end
|
57
58
|
|
58
59
|
describe 'future_parser' do
|
59
60
|
context 'future_parser = false (default)' do
|
60
61
|
it 'should fail without setting future option to true on future manifest' do
|
61
|
-
PuppetSyntax.future_parser.
|
62
|
+
expect(PuppetSyntax.future_parser).to eq(false)
|
62
63
|
|
63
64
|
files = fixture_manifests(['future_syntax.pp'])
|
64
65
|
res = subject.check(files)
|
65
66
|
|
66
|
-
res.
|
67
|
-
res[0].
|
67
|
+
expect(res.size).to eq(1)
|
68
|
+
expect(res[0]).to match(/Syntax error at '='; expected '\}' .*:2$/)
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
@@ -79,7 +80,7 @@ describe PuppetSyntax::Manifests do
|
|
79
80
|
files = fixture_manifests(['future_syntax.pp'])
|
80
81
|
res = subject.check(files)
|
81
82
|
|
82
|
-
res.
|
83
|
+
expect(res.size).to eq(0)
|
83
84
|
end
|
84
85
|
end
|
85
86
|
else
|
@@ -88,8 +89,8 @@ describe PuppetSyntax::Manifests do
|
|
88
89
|
files = fixture_manifests(['future_syntax.pp'])
|
89
90
|
res = subject.check(files)
|
90
91
|
|
91
|
-
res.
|
92
|
-
res[0].
|
92
|
+
expect(res.size).to eq(1)
|
93
|
+
expect(res[0]).to match("Attempt to assign a value to unknown configuration parameter :parser")
|
93
94
|
end
|
94
95
|
end
|
95
96
|
end
|
@@ -2,10 +2,18 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'PuppetSyntax rake tasks' do
|
4
4
|
it 'should generate FileList of manifests relative to Rakefile' do
|
5
|
-
|
5
|
+
if RSpec::Version::STRING < '3'
|
6
|
+
pending
|
7
|
+
else
|
8
|
+
skip('needs to be done')
|
9
|
+
end
|
6
10
|
end
|
7
11
|
|
8
12
|
it 'should generate FileList of templates relative to Rakefile' do
|
9
|
-
|
13
|
+
if RSpec::Version::STRING < '3'
|
14
|
+
pending
|
15
|
+
else
|
16
|
+
skip('needs to be done')
|
17
|
+
end
|
10
18
|
end
|
11
19
|
end
|
@@ -11,52 +11,52 @@ describe PuppetSyntax::Templates do
|
|
11
11
|
files = fixture_templates('pass.erb')
|
12
12
|
res = subject.check(files)
|
13
13
|
|
14
|
-
res.
|
14
|
+
expect(res).to match([])
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should ignore NameErrors from unbound variables' do
|
18
18
|
files = fixture_templates('pass_unbound_var.erb')
|
19
19
|
res = subject.check(files)
|
20
20
|
|
21
|
-
res.
|
21
|
+
expect(res).to match([])
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should catch SyntaxError' do
|
25
25
|
files = fixture_templates('fail_error.erb')
|
26
26
|
res = subject.check(files)
|
27
27
|
|
28
|
-
res.
|
29
|
-
res.
|
28
|
+
expect(res.size).to eq(1)
|
29
|
+
expect(res[0]).to match(/2: syntax error, unexpected/)
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should catch Ruby warnings' do
|
33
33
|
files = fixture_templates('fail_warning.erb')
|
34
34
|
res = subject.check(files)
|
35
35
|
|
36
|
-
res.
|
37
|
-
res.
|
36
|
+
expect(res.size).to eq(1)
|
37
|
+
expect(res[0]).to match(/2: warning: found = in conditional/)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'should read more than one valid file' do
|
41
41
|
files = fixture_templates(['pass.erb', 'pass_unbound_var.erb'])
|
42
42
|
res = subject.check(files)
|
43
43
|
|
44
|
-
res.
|
44
|
+
expect(res).to match([])
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should continue after finding an error in the first file' do
|
48
48
|
files = fixture_templates(['fail_error.erb', 'fail_warning.erb'])
|
49
49
|
res = subject.check(files)
|
50
50
|
|
51
|
-
res.
|
52
|
-
res[0].
|
53
|
-
res[1].
|
51
|
+
expect(res.size).to eq(2)
|
52
|
+
expect(res[0]).to match(/2: syntax error, unexpected/)
|
53
|
+
expect(res[1]).to match(/2: warning: found = in conditional/)
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should ignore a TypeError' do
|
57
57
|
files = fixture_templates('typeerror_shouldwin.erb')
|
58
58
|
res = subject.check(files)
|
59
59
|
|
60
|
-
res.
|
60
|
+
expect(res).to match([])
|
61
61
|
end
|
62
62
|
end
|
data/spec/puppet-syntax_spec.rb
CHANGED
@@ -2,17 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe PuppetSyntax do
|
4
4
|
it 'should default exclude_paths to empty array' do
|
5
|
-
PuppetSyntax.exclude_paths.
|
5
|
+
expect(PuppetSyntax.exclude_paths).to be_empty
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should support setting exclude_paths' do
|
9
9
|
PuppetSyntax.exclude_paths = ["foo", "bar/baz"]
|
10
|
-
PuppetSyntax.exclude_paths.
|
10
|
+
expect(PuppetSyntax.exclude_paths).to eq(["foo", "bar/baz"])
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should support future parser setting' do
|
14
14
|
PuppetSyntax.future_parser = true
|
15
|
-
PuppetSyntax.future_parser.
|
15
|
+
expect(PuppetSyntax.future_parser).to eq(true)
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-syntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -32,17 +32,17 @@ dependencies:
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: '0'
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: gem_publisher
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: 2107948252144902184
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
none: false
|
121
121
|
requirements:
|
@@ -124,10 +124,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash:
|
127
|
+
hash: 2107948252144902184
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.8.23
|
130
|
+
rubygems_version: 1.8.23.2
|
131
131
|
signing_key:
|
132
132
|
specification_version: 3
|
133
133
|
summary: Syntax checks for Puppet manifests, templates, and Hiera YAML
|