puppet-syntax 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,7 @@ env:
10
10
  - PUPPET_VERSION="~> 3.1.0"
11
11
  - PUPPET_VERSION="~> 3.2.0"
12
12
  - PUPPET_VERSION="~> 3.4.0"
13
+ - PUPPET_VERSION="~> 3.7.3"
13
14
  - PUPPET_VERSION=">= 0"
14
15
  matrix:
15
16
  allow_failures:
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
@@ -1,8 +1,8 @@
1
1
  require 'rspec/core/rake_task'
2
2
  RSpec::Core::RakeTask.new('spec')
3
3
 
4
- require 'gem_publisher'
5
4
  task :publish_gem do
5
+ require 'gem_publisher'
6
6
  gem = GemPublisher.publish_if_updated('puppet-syntax.gemspec', :rubygems)
7
7
  puts "Published #{gem}" if gem
8
8
  end
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
@@ -1,10 +1,9 @@
1
- require 'puppet'
2
- require 'puppet/face'
3
-
4
1
  module PuppetSyntax
5
2
  class Manifests
6
3
  def check(filelist)
7
4
  raise "Expected an array of files" unless filelist.is_a?(Array)
5
+ require 'puppet'
6
+ require 'puppet/face'
8
7
 
9
8
  errors = []
10
9
 
@@ -1,3 +1,3 @@
1
1
  module PuppetSyntax
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "rake"
22
22
 
23
- spec.add_development_dependency "rspec", "< 2.99.0"
23
+ spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "gem_publisher", "~> 1.3"
25
25
  end
@@ -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.should == []
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.should have(1).items
22
- res.first.should match(/Syntax error at '\}' .*:3$/)
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.should have(2).items
30
- res[0].should match(/Unrecognised escape sequence '\\\[' .* at line 3$/)
31
- res[1].should match(/Unrecognised escape sequence '\\\]' .* at line 3$/)
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.should == []
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.should == []
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.should have(3).items
53
- res[0].should match(/Syntax error at '\}' .*:3$/)
54
- res[1].should match(/Unrecognised escape sequence '\\\[' .* at line 3$/)
55
- res[2].should match(/Unrecognised escape sequence '\\\]' .* at line 3$/)
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.should == false
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.should have(1).items
67
- res[0].should match(/Syntax error at '='; expected '\}' .*:2$/)
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.should have(0).items
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.should have(1).items
92
- res[0].should == "Attempt to assign a value to unknown configuration parameter :parser"
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
- pending
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
- pending
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.should == []
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.should == []
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.should have(1).items
29
- res.first.should match(/2: syntax error, unexpected/)
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.should have(1).items
37
- res.first.should match(/2: warning: found = in conditional/)
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.should == []
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.should have(2).items
52
- res[0].should match(/2: syntax error, unexpected/)
53
- res[1].should match(/2: warning: found = in conditional/)
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.should == []
60
+ expect(res).to match([])
61
61
  end
62
62
  end
@@ -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.should be_empty
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.should == ["foo", "bar/baz"]
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.should == true
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.3.0
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-08-07 00:00:00.000000000 Z
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: 2.99.0
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: 2.99.0
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: 2583985716201075116
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: 2583985716201075116
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