Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Ruby v2.3.1 #27

Merged
merged 1 commit into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
pkg/
Gemfile.lock
vendor/
spec/fixtures/
.vagrant/
.bundle/
# Default .gitignore for Ruby
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp

# YARD artifacts
.yardoc
_yardoc
doc/

# Vim
*.swp

# Eclipse
.project

# Visual Studio Code
.vscode/

# OS X
.DS_Store

# Puppet
coverage/
spec/fixtures/manifests/*
spec/fixtures/modules/*
Gemfile.lock
7 changes: 6 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ AllCops:
- 'pkg/**/*'
- 'spec/fixtures/**/*'
- 'vendor/**/*'
RunRailsCops: false
DisplayCopNames: true

Rails:
Enabled: false

Metrics/LineLength:
# Ruduce this... Max: 80
Max: 105
Expand All @@ -35,3 +37,6 @@ Style/HashSyntax:
Style/LeadingCommentSpace:
Exclude:
- Puppetfile

Style/TrailingCommaInLiteral:
Enabled: false
80 changes: 68 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,75 @@
---
language: ruby
cache: bundler
bundler_args: --without system_tests development
script: "bundle exec rake test SPEC_OPTS='--format documentation'"

rvm:
- 1.9.3
- 2.1.0
- 2.3.1

env:
matrix:
- PUPPET_GEM_VERSION="~> 3.1.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.2.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.3.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.4.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.5.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.6.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.7.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3.8.0" CHECK=test
- PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" CHECK=test
- PUPPET_GEM_VERSION="~> 4.0.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.1.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.2.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.3.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.4.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.5.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.6.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.7.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4.8.0" CHECK=test
- PUPPET_GEM_VERSION="~> 4" CHECK=test
- PUPPET_GEM_VERSION="~> 4" CHECK=rubocop

sudo: false

bundler_args: '--without system_tests development'

script: 'SPEC_OPTS="--format documentation" bundle exec rake $CHECK'

# only do rubocop tests with the newest version of ruby so that we are
# following the most up to date style requirements.
matrix:
fast_finish: true
include:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.7
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.7
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
exclude:
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.1.0" CHECK=test
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.2.0" CHECK=test
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.3.0" CHECK=test
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.4.0" CHECK=test
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.1.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.2.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.3.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.4.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.5.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.6.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.7.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.8.0" CHECK=test
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" CHECK=test

notifications:
email: false
28 changes: 11 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :unit_tests do
gem 'rubocop', '0.34.2', :require => false
gem 'rubocop', :require => false if RUBY_VERSION >= '2.0.0'
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet-lint-trailing_newline-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'puppet-lint-absolute_template_path', :require => false
Expand All @@ -21,6 +20,13 @@ group :unit_tests do
gem 'puppet-lint-appends-check', :require => false
end

gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9'
gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9'

group :development do
gem 'simplecov', :require => false
# gem 'guard-rake', :require => false
Expand All @@ -44,25 +50,13 @@ else
gem 'puppet', '~> 3.8', :require => false
end

# Fix Travis failures related to MRI <> Gem compatibilities.
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
# rspec must be v2 for ruby 1.8.7
gem 'rspec', '~> 2.0'
# rake >= 11 does not support ruby 1.8.7
gem 'rake', '~> 10.0'
end

if RUBY_VERSION < '2.0'
# json 2.x requires ruby 2.0. Lock to 1.8
gem 'json', '~> 1.8'
# json_pure 2.0.2 requires ruby 2.0. Lock to 2.0.1
gem 'json_pure', '= 2.0.1'
end

if RUBY_VERSION < '2.2.5'
# beaker 3.1+ requires ruby 2.2.5. Lock to 2.0
gem 'beaker', '~> 2.0', :require => false
# beaker-rspec 6.0.0 requires beaker 3.0. Lock to 5.6.0
gem 'beaker-rspec', '= 5.6.0', :require => false
end

gem 'public_suffix', '1.4.6', :require => false if RUBY_VERSION <= '1.9.3'
gem 'public_suffix', :require => false if RUBY_VERSION > '1.9.3'
# vim:ft=ruby
21 changes: 10 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
# require 'rubocop/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'metadata-json-lint/rake_task'

# RuboCop::RakeTask.new
if RUBY_VERSION >= '2.0'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end

exclude_paths = [
'modules/**/*',
Expand Down Expand Up @@ -50,11 +51,9 @@ task :all => [
:success
]

desc 'Run rubocop, syntax, lint, and spec tests'
task :test => [
:rubocop,
:syntax,
:lint,
:metadata_lint,
:spec
]
desc 'Run validate, lint and spec tests.'
task :test do
[:lint, :validate, :syntax, :spec].each do |test|
Rake::Task[test].invoke
end
end
9 changes: 1 addition & 8 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@
}
],
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.3.0 < 5.0.0"
},
{
"name": "puppet",
"version_requirement": ">= 3.0.0 < 5.0.0"
}
{"name":"puppet","version_requirement":">= 3.0.0 < 5.0.0" }
],
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 4.1.0 < 5.0.0"}
Expand Down
19 changes: 15 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts

# RSpec.configure do |c|
# c.formatter = :documentation
# end
RSpec.configure do |config|
config.formatter = :documentation
config.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
config.before :each do
# Ensure that we don't accidentally cache facts and environment between
# test cases. This requires each example group to explicitly load the
# facts being exercised with something like
# Facter.collection.loader.load(:ipaddress)
Facter.clear
Facter.clear_messages
end
config.default_facts = {
:environment => 'rp_env',
}
end