Skip to content

Commit 2caf374

Browse files
committed
Add support for Ruby 2.3.1
This is needed to support the new Puppet v4 AIO.
1 parent c986a94 commit 2caf374

7 files changed

+147
-59
lines changed

.gitignore

+36-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,37 @@
1-
pkg/
2-
Gemfile.lock
3-
vendor/
4-
spec/fixtures/
5-
.vagrant/
6-
.bundle/
1+
# Default .gitignore for Ruby
2+
*.gem
3+
*.rbc
4+
.bundle
5+
.config
6+
coverage
7+
InstalledFiles
8+
lib/bundler/man
9+
pkg
10+
rdoc
11+
spec/reports
12+
test/tmp
13+
test/version_tmp
14+
tmp
15+
16+
# YARD artifacts
17+
.yardoc
18+
_yardoc
19+
doc/
20+
21+
# Vim
22+
*.swp
23+
24+
# Eclipse
25+
.project
26+
27+
# Visual Studio Code
28+
.vscode/
29+
30+
# OS X
31+
.DS_Store
32+
33+
# Puppet
734
coverage/
35+
spec/fixtures/manifests/*
36+
spec/fixtures/modules/*
37+
Gemfile.lock

.rubocop.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ AllCops:
1818
- 'pkg/**/*'
1919
- 'spec/fixtures/**/*'
2020
- 'vendor/**/*'
21-
RunRailsCops: false
2221
DisplayCopNames: true
2322

23+
Rails:
24+
Enabled: false
25+
2426
Metrics/LineLength:
2527
# Ruduce this... Max: 80
2628
Max: 105
@@ -35,3 +37,6 @@ Style/HashSyntax:
3537
Style/LeadingCommentSpace:
3638
Exclude:
3739
- Puppetfile
40+
41+
Style/TrailingCommaInLiteral:
42+
Enabled: false

.travis.yml

+68-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,75 @@
11
---
22
language: ruby
3-
cache: bundler
4-
bundler_args: --without system_tests development
5-
script: "bundle exec rake test SPEC_OPTS='--format documentation'"
3+
4+
rvm:
5+
- 1.9.3
6+
- 2.1.0
7+
- 2.3.1
8+
9+
env:
10+
matrix:
11+
- PUPPET_GEM_VERSION="~> 3.1.0" CHECK=test
12+
- PUPPET_GEM_VERSION="~> 3.2.0" CHECK=test
13+
- PUPPET_GEM_VERSION="~> 3.3.0" CHECK=test
14+
- PUPPET_GEM_VERSION="~> 3.4.0" CHECK=test
15+
- PUPPET_GEM_VERSION="~> 3.5.0" CHECK=test
16+
- PUPPET_GEM_VERSION="~> 3.6.0" CHECK=test
17+
- PUPPET_GEM_VERSION="~> 3.7.0" CHECK=test
18+
- PUPPET_GEM_VERSION="~> 3.8.0" CHECK=test
19+
- PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" CHECK=test
20+
- PUPPET_GEM_VERSION="~> 4.0.0" CHECK=test
21+
- PUPPET_GEM_VERSION="~> 4.1.0" CHECK=test
22+
- PUPPET_GEM_VERSION="~> 4.2.0" CHECK=test
23+
- PUPPET_GEM_VERSION="~> 4.3.0" CHECK=test
24+
- PUPPET_GEM_VERSION="~> 4.4.0" CHECK=test
25+
- PUPPET_GEM_VERSION="~> 4.5.0" CHECK=test
26+
- PUPPET_GEM_VERSION="~> 4.6.0" CHECK=test
27+
- PUPPET_GEM_VERSION="~> 4.7.0" CHECK=test
28+
- PUPPET_GEM_VERSION="~> 4.8.0" CHECK=test
29+
- PUPPET_GEM_VERSION="~> 4" CHECK=test
30+
- PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
31+
632
sudo: false
33+
34+
bundler_args: '--without system_tests development'
35+
36+
script: 'SPEC_OPTS="--format documentation" bundle exec rake $CHECK'
37+
38+
# only do rubocop tests with the newest version of ruby so that we are
39+
# following the most up to date style requirements.
740
matrix:
841
fast_finish: true
9-
include:
10-
- rvm: 1.9.3
11-
env: PUPPET_GEM_VERSION="~> 3.0"
12-
- rvm: 1.9.3
13-
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
14-
- rvm: 2.1.7
15-
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
16-
- rvm: 2.1.7
17-
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
42+
exclude:
43+
- rvm: 2.1.0
44+
env: PUPPET_GEM_VERSION="~> 3.1.0" CHECK=test
45+
- rvm: 2.1.0
46+
env: PUPPET_GEM_VERSION="~> 3.2.0" CHECK=test
47+
- rvm: 2.1.0
48+
env: PUPPET_GEM_VERSION="~> 3.3.0" CHECK=test
49+
- rvm: 2.1.0
50+
env: PUPPET_GEM_VERSION="~> 3.4.0" CHECK=test
51+
- rvm: 1.9.3
52+
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
53+
- rvm: 2.1.0
54+
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
55+
- rvm: 2.3.1
56+
env: PUPPET_GEM_VERSION="~> 3.1.0" CHECK=test
57+
- rvm: 2.3.1
58+
env: PUPPET_GEM_VERSION="~> 3.2.0" CHECK=test
59+
- rvm: 2.3.1
60+
env: PUPPET_GEM_VERSION="~> 3.3.0" CHECK=test
61+
- rvm: 2.3.1
62+
env: PUPPET_GEM_VERSION="~> 3.4.0" CHECK=test
63+
- rvm: 2.3.1
64+
env: PUPPET_GEM_VERSION="~> 3.5.0" CHECK=test
65+
- rvm: 2.3.1
66+
env: PUPPET_GEM_VERSION="~> 3.6.0" CHECK=test
67+
- rvm: 2.3.1
68+
env: PUPPET_GEM_VERSION="~> 3.7.0" CHECK=test
69+
- rvm: 2.3.1
70+
env: PUPPET_GEM_VERSION="~> 3.8.0" CHECK=test
71+
- rvm: 2.3.1
72+
env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" CHECK=test
73+
1874
notifications:
1975
email: false

Gemfile

+11-17
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
22

33
group :unit_tests do
4-
gem 'rubocop', '0.34.2', :require => false
4+
gem 'rubocop', :require => false if RUBY_VERSION >= '2.0.0'
55
gem 'puppetlabs_spec_helper', :require => false
66
gem 'rspec-puppet-facts', :require => false
7-
gem 'metadata-json-lint', :require => false
87
gem 'puppet-lint-trailing_newline-check', :require => false
98
gem 'puppet-lint-variable_contains_upcase', :require => false
109
gem 'puppet-lint-absolute_template_path', :require => false
@@ -21,6 +20,13 @@ group :unit_tests do
2120
gem 'puppet-lint-appends-check', :require => false
2221
end
2322

23+
gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
24+
gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
25+
gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0'
26+
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
27+
gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9'
28+
gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9'
29+
2430
group :development do
2531
gem 'simplecov', :require => false
2632
# gem 'guard-rake', :require => false
@@ -44,25 +50,13 @@ else
4450
gem 'puppet', '~> 3.8', :require => false
4551
end
4652

47-
# Fix Travis failures related to MRI <> Gem compatibilities.
48-
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
49-
# rspec must be v2 for ruby 1.8.7
50-
gem 'rspec', '~> 2.0'
51-
# rake >= 11 does not support ruby 1.8.7
52-
gem 'rake', '~> 10.0'
53-
end
54-
55-
if RUBY_VERSION < '2.0'
56-
# json 2.x requires ruby 2.0. Lock to 1.8
57-
gem 'json', '~> 1.8'
58-
# json_pure 2.0.2 requires ruby 2.0. Lock to 2.0.1
59-
gem 'json_pure', '= 2.0.1'
60-
end
61-
6253
if RUBY_VERSION < '2.2.5'
6354
# beaker 3.1+ requires ruby 2.2.5. Lock to 2.0
6455
gem 'beaker', '~> 2.0', :require => false
6556
# beaker-rspec 6.0.0 requires beaker 3.0. Lock to 5.6.0
6657
gem 'beaker-rspec', '= 5.6.0', :require => false
6758
end
59+
60+
gem 'public_suffix', '1.4.6', :require => false if RUBY_VERSION <= '1.9.3'
61+
gem 'public_suffix', :require => false if RUBY_VERSION > '1.9.3'
6862
# vim:ft=ruby

Rakefile

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
2-
# require 'rubocop/rake_task'
31
require 'puppetlabs_spec_helper/rake_tasks'
42
require 'puppet-lint/tasks/puppet-lint'
53
require 'puppet-syntax/tasks/puppet-syntax'
64
require 'metadata-json-lint/rake_task'
75

8-
# RuboCop::RakeTask.new
6+
if RUBY_VERSION >= '2.0'
7+
require 'rubocop/rake_task'
8+
RuboCop::RakeTask.new
9+
end
910

1011
exclude_paths = [
1112
'modules/**/*',
@@ -50,11 +51,9 @@ task :all => [
5051
:success
5152
]
5253

53-
desc 'Run rubocop, syntax, lint, and spec tests'
54-
task :test => [
55-
:rubocop,
56-
:syntax,
57-
:lint,
58-
:metadata_lint,
59-
:spec
60-
]
54+
desc 'Run validate, lint and spec tests.'
55+
task :test do
56+
[:lint, :validate, :syntax, :spec].each do |test|
57+
Rake::Task[test].invoke
58+
end
59+
end

metadata.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,7 @@
3131
}
3232
],
3333
"requirements": [
34-
{
35-
"name": "pe",
36-
"version_requirement": ">= 3.3.0 < 5.0.0"
37-
},
38-
{
39-
"name": "puppet",
40-
"version_requirement": ">= 3.0.0 < 5.0.0"
41-
}
34+
{"name":"puppet","version_requirement":">= 3.0.0 < 5.0.0" }
4235
],
4336
"dependencies": [
4437
{"name":"puppetlabs/stdlib","version_requirement":">= 4.1.0 < 5.0.0"}

spec/spec_helper.rb

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
require 'rubygems' if RUBY_VERSION < '1.9.0'
21
require 'puppetlabs_spec_helper/module_spec_helper'
32
require 'rspec-puppet-facts'
43
include RspecPuppetFacts
54

6-
# RSpec.configure do |c|
7-
# c.formatter = :documentation
8-
# end
5+
RSpec.configure do |config|
6+
config.formatter = :documentation
7+
config.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
8+
config.before :each do
9+
# Ensure that we don't accidentally cache facts and environment between
10+
# test cases. This requires each example group to explicitly load the
11+
# facts being exercised with something like
12+
# Facter.collection.loader.load(:ipaddress)
13+
Facter.clear
14+
Facter.clear_messages
15+
end
16+
config.default_facts = {
17+
:environment => 'rp_env',
18+
}
19+
end

0 commit comments

Comments
 (0)