From 336c86f4fa84c5e8e97e50e7bf0d03701dfa21c7 Mon Sep 17 00:00:00 2001 From: andrea-manzi Date: Tue, 28 Jul 2015 12:45:37 +0200 Subject: [PATCH] updated travis/gem/rakefile --- .travis.yml | 24 +++++++++++++++++------- Gemfile | 27 +++++++++++++++++++++++---- Rakefile | 20 +++++++++++++------- 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 86222c2..c863649 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,31 @@ --- language: ruby bundler_args: --without development -script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" +script: "bundle exec rake validate && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 4.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 4.0" notifications: email: false diff --git a/Gemfile b/Gemfile index c4ea2b3..bbec3fe 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,25 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" -puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7'] -gem 'puppet', puppetversion -gem 'puppet-lint', '>= 0.3.2' +# https://github.com/rspec/rspec-core/issues/1864 +gem 'rspec', '~> 3.1.0' gem 'puppetlabs_spec_helper', '>= 0.1.0' +gem 'puppet-lint', '>= 0.3.2' + +if RUBY_VERSION != '1.8.7' + gem 'beaker-rspec', :require => false + gem 'pry', :require => false +end + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby diff --git a/Rakefile b/Rakefile index 3c30d48..d1e11f7 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,18 @@ require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' - -PuppetLint.configuration.fail_on_warnings -PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_single_quote_string_with_variables') -PuppetLint.configuration.send('disable_only_variable_string') PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + +desc "Validate manifests, templates, and ruby files" +task :validate do + Dir['manifests/**/*.pp'].each do |manifest| + sh "puppet parser validate --noop #{manifest}" + end + Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file| + sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ + end + Dir['templates/**/*.erb'].each do |template| + sh "erb -P -x -T '-' #{template} | ruby -c" + end +end