puppet-syntax 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 2014-07-31 Release 1.2.2
2
+ - Check and document conflicts with puppetlabs_spec_helper <= 0.7.0
3
+
4
+ 2014-07-23 Release 1.2.1
5
+ - Remove dependency on Puppet from Gemspec (for Puppet Entreprise users).
6
+
1
7
  2014-03-28 Release 1.2.0
2
8
  - Optional support for Puppet's future parser.
3
9
 
data/Gemfile CHANGED
@@ -4,6 +4,5 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  # Override gemspec for CI matrix builds.
7
- if ENV['PUPPET_VERSION']
8
- gem 'puppet', ENV['PUPPET_VERSION']
9
- end
7
+ puppet_version = ENV['PUPPET_VERSION'] || '>2.7.0'
8
+ gem 'puppet', puppet_version
data/README.md CHANGED
@@ -14,6 +14,13 @@ This should work on any version of:
14
14
  You can see the matrix of specific versions that we currently test against
15
15
  in the [TravisCI config](.travis.yml).
16
16
 
17
+ If you're using `puppetlabs_spec_helper/rake_tasks` and getting unexpected
18
+ non-zero exit codes then you should upgrade to [puppetlabs_spec_helper][psh]
19
+ \>= 0.8.0 which no longer has a conflicting rake task and now depends on
20
+ this project.
21
+
22
+ [psh]: https://github.com/puppetlabs/puppetlabs_spec_helper
23
+
17
24
  ## Usage
18
25
 
19
26
  Include the following in your `Rakefile`:
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
- require "bundler/gem_tasks"
2
-
3
1
  require 'rspec/core/rake_task'
4
2
  RSpec::Core::RakeTask.new('spec')
5
3
 
4
+ require 'gem_publisher'
5
+ task :publish_gem do
6
+ gem = GemPublisher.publish_if_updated('puppet-syntax.gemspec', :rubygems)
7
+ puts "Published #{gem}" if gem
8
+ end
9
+
6
10
  task :default => [:spec]
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ set -eu
3
+
4
+ rm -f Gemfile.lock
5
+ bundle install --path "${HOME}/bundles/${JOB_NAME}"
6
+ bundle exec rake
7
+ bundle exec rake publish_gem
@@ -7,12 +7,26 @@ module PuppetSyntax
7
7
  def initialize(*args)
8
8
  desc 'Syntax check Puppet manifests and templates'
9
9
  task :syntax => [
10
+ 'syntax:check_puppetlabs_spec_helper',
10
11
  'syntax:manifests',
11
12
  'syntax:templates',
12
13
  'syntax:hiera',
13
14
  ]
14
15
 
15
16
  namespace :syntax do
17
+ task :check_puppetlabs_spec_helper do
18
+ psh_present = Rake::Task[:syntax].actions.any? { |a|
19
+ a.source_location.first.end_with?('puppetlabs_spec_helper/rake_tasks.rb')
20
+ }
21
+ if psh_present
22
+ warn <<-EOS
23
+ [WARNING] A conflicting :syntax rake task has been defined by
24
+ puppetlabs_spec_helper/rake_tasks. You should either disable this or upgrade
25
+ to puppetlabs_spec_helper >= 0.8.0 which now uses puppet-syntax.
26
+ EOS
27
+ end
28
+ end
29
+
16
30
  desc 'Syntax check Puppet manifests'
17
31
  task :manifests do |t|
18
32
  $stderr.puts "---> #{t.name}"
@@ -18,6 +18,9 @@ module PuppetSyntax
18
18
  rescue NameError
19
19
  # This is normal because we don't have the variables that would
20
20
  # ordinarily be bound by the parent Puppet manifest.
21
+ rescue TypeError
22
+ # This is normal because we don't have the variables that would
23
+ # ordinarily be bound by the parent Puppet manifest.
21
24
  rescue SyntaxError => error
22
25
  errors << error
23
26
  end
@@ -1,3 +1,3 @@
1
1
  module PuppetSyntax
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Dan Carley"]
10
10
  spec.email = ["dan.carley@gmail.com"]
11
11
  spec.description = %q{Syntax checks for Puppet manifests and templates}
12
- spec.summary = spec.summary
13
- spec.homepage = ""
12
+ spec.summary = %q{Syntax checks for Puppet manifests, templates, and Hiera YAML}
13
+ spec.homepage = "https://github.com/gds-operations/puppet-syntax"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "rake"
22
- spec.add_dependency "puppet", ">= 2.7.0"
23
22
 
24
- spec.add_development_dependency "bundler", "~> 1.3"
25
- spec.add_development_dependency "rspec"
23
+ spec.add_development_dependency "rspec", "< 2.99.0"
24
+ spec.add_development_dependency "gem_publisher", "~> 1.3"
26
25
  end
@@ -0,0 +1,2 @@
1
+ #this is valid syntax
2
+ <%= File.dirname(@the_path_of_the_file_you_first_thought_of) %>
@@ -55,25 +55,45 @@ describe PuppetSyntax::Manifests do
55
55
  res[2].should match(/Unrecognised escape sequence '\\\]' .* at line 3$/)
56
56
  end
57
57
 
58
- if Puppet::Util::Package.versioncmp(Puppet.version, '3.2') >= 0
59
- it 'should fail without setting future option to true on future manifest' do
60
- PuppetSyntax.future_parser = false
61
- files = fixture_manifests(['future_syntax.pp'])
62
- res = subject.check(files)
63
-
64
- res.should have(1).items
65
- res[0].should match(/Syntax error at '='; expected '\}' .*:2$/)
66
- end
58
+ describe 'future_parser' do
59
+ context 'future_parser = false (default)' do
60
+ it 'should fail without setting future option to true on future manifest' do
61
+ PuppetSyntax.future_parser.should == false
67
62
 
63
+ files = fixture_manifests(['future_syntax.pp'])
64
+ res = subject.check(files)
68
65
 
69
- it 'should pass with future option set to true on future manifest' do
70
- PuppetSyntax.future_parser = true
71
- files = fixture_manifests(['future_syntax.pp'])
72
- res = subject.check(files)
66
+ res.should have(1).items
67
+ res[0].should match(/Syntax error at '='; expected '\}' .*:2$/)
68
+ end
69
+ end
73
70
 
74
- res.should have(0).items
71
+ context 'future_parser = true' do
72
+ before(:each) {
73
+ PuppetSyntax.future_parser = true
74
+ }
75
+
76
+ if Puppet::Util::Package.versioncmp(Puppet.version, '3.2') >= 0
77
+ context 'Puppet >= 3.2' do
78
+ it 'should pass with future option set to true on future manifest' do
79
+ files = fixture_manifests(['future_syntax.pp'])
80
+ res = subject.check(files)
81
+
82
+ res.should have(0).items
83
+ end
84
+ end
85
+ else
86
+ context 'Puppet <= 3.2' do
87
+ it 'should return an error that the parser option is not supported' do
88
+ files = fixture_manifests(['future_syntax.pp'])
89
+ res = subject.check(files)
90
+
91
+ res.should have(1).items
92
+ res[0].should == "Attempt to assign a value to unknown configuration parameter :parser"
93
+ end
94
+ end
95
+ end
75
96
  end
76
97
  end
77
98
 
78
-
79
99
  end
@@ -52,4 +52,11 @@ describe PuppetSyntax::Templates do
52
52
  res[0].should match(/2: syntax error, unexpected/)
53
53
  res[1].should match(/2: warning: found = in conditional/)
54
54
  end
55
+
56
+ it 'should ignore a TypeError' do
57
+ files = fixture_templates('typeerror_shouldwin.erb')
58
+ res = subject.check(files)
59
+
60
+ res.should == []
61
+ end
55
62
  end
@@ -19,6 +19,6 @@ def fixture_files(list, path)
19
19
  end
20
20
 
21
21
  RSpec.configure do |config|
22
- config.color_enabled = true
23
- config.formatter = 'documentation'
22
+ config.color = true
23
+ config.formatter = 'documentation'
24
24
  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.2.0
4
+ version: 1.2.2
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-03-28 00:00:00.000000000 Z
12
+ date: 2014-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -28,23 +28,23 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: puppet
31
+ name: rspec
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.7.0
38
- type: :runtime
37
+ version: 2.99.0
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.7.0
45
+ version: 2.99.0
46
46
  - !ruby/object:Gem::Dependency
47
- name: bundler
47
+ name: gem_publisher
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
@@ -59,22 +59,6 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
- - !ruby/object:Gem::Dependency
63
- name: rspec
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
62
  description: Syntax checks for Puppet manifests and templates
79
63
  email:
80
64
  - dan.carley@gmail.com
@@ -89,6 +73,7 @@ files:
89
73
  - LICENSE.txt
90
74
  - README.md
91
75
  - Rakefile
76
+ - jenkins.sh
92
77
  - lib/puppet-syntax.rb
93
78
  - lib/puppet-syntax/hiera.rb
94
79
  - lib/puppet-syntax/manifests.rb
@@ -108,13 +93,14 @@ files:
108
93
  - spec/fixtures/test_module/templates/fail_warning.erb
109
94
  - spec/fixtures/test_module/templates/pass.erb
110
95
  - spec/fixtures/test_module/templates/pass_unbound_var.erb
96
+ - spec/fixtures/test_module/templates/typeerror_shouldwin.erb
111
97
  - spec/puppet-syntax/hiera_spec.rb
112
98
  - spec/puppet-syntax/manifests_spec.rb
113
99
  - spec/puppet-syntax/tasks/puppet-syntax_spec.rb
114
100
  - spec/puppet-syntax/templates_spec.rb
115
101
  - spec/puppet-syntax_spec.rb
116
102
  - spec/spec_helper.rb
117
- homepage: ''
103
+ homepage: https://github.com/gds-operations/puppet-syntax
118
104
  licenses:
119
105
  - MIT
120
106
  post_install_message:
@@ -129,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
115
  version: '0'
130
116
  segments:
131
117
  - 0
132
- hash: -2224316869698270261
118
+ hash: 3933301885653005104
133
119
  required_rubygems_version: !ruby/object:Gem::Requirement
134
120
  none: false
135
121
  requirements:
@@ -138,13 +124,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
124
  version: '0'
139
125
  segments:
140
126
  - 0
141
- hash: -2224316869698270261
127
+ hash: 3933301885653005104
142
128
  requirements: []
143
129
  rubyforge_project:
144
130
  rubygems_version: 1.8.23
145
131
  signing_key:
146
132
  specification_version: 3
147
- summary: ''
133
+ summary: Syntax checks for Puppet manifests, templates, and Hiera YAML
148
134
  test_files:
149
135
  - spec/fixtures/hiera/hiera_bad.yaml
150
136
  - spec/fixtures/hiera/hiera_bad_18.yaml
@@ -158,6 +144,7 @@ test_files:
158
144
  - spec/fixtures/test_module/templates/fail_warning.erb
159
145
  - spec/fixtures/test_module/templates/pass.erb
160
146
  - spec/fixtures/test_module/templates/pass_unbound_var.erb
147
+ - spec/fixtures/test_module/templates/typeerror_shouldwin.erb
161
148
  - spec/puppet-syntax/hiera_spec.rb
162
149
  - spec/puppet-syntax/manifests_spec.rb
163
150
  - spec/puppet-syntax/tasks/puppet-syntax_spec.rb