diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..16f9cdb0 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--format documentation diff --git a/.travis.yml b/.travis.yml index 2f081f78..36a381ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,22 @@ --- sudo: false language: ruby +cache: bundler bundler_args: --without system_tests -script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" +before_install: rm Gemfile.lock || true +script: bundle exec rake validate lint spec matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.4.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3.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: 2.1.5 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 3.6.0" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.6 - env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" + - rvm: 2.1.6 + env: PUPPET_GEM_VERSION='~> 4.0' COVERAGE=yes STRICT_VARIABLES=yes + - rvm: 2.1.6 + env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#stable + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION='~> 3.0' FUTURE_PARSER=yes + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION='~> 3.0' + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION='~> 3.0' notifications: email: false diff --git a/Gemfile b/Gemfile index c3f05b2e..c709f5b0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,28 @@ -source 'https://rubygems.org' - -puppetversion = ENV.key?('PUPPET_GEM_VERSION') ? "#{ENV['PUPPET_GEM_VERSION']}" : ['>= 3.3'] -facterversion = ENV.key?('FACTER_GEM_VERSION') ? "#{ENV['FACTER_GEM_VERSION']}" : ['>= 1.7'] -gem 'puppet', puppetversion -gem 'puppetlabs_spec_helper', '>= 0.1.0' -gem 'puppet-lint', '>= 0.3.2' -gem 'facter', facterversion -gem 'rspec', '< 3.2.0' -# rubi <1.9 versus rake 11.0.0 workaround -gem 'rake', '< 11.0.0' +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +def location_for(place, version = nil) + if place =~ /^((?:git|https?)[:@][^#]*)#(.*)/ + [version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, version, { :require => false }].compact + end +end + +gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || '~> 4') +gem 'facter', '>= 2.0' +gem 'puppetlabs_spec_helper', '>= 0.1.0', :require => false +gem 'puppet-lint', '>= 0.3.2', :require => false +gem 'rspec-puppet', '>= 2.3.2', :require => false +gem 'metadata-json-lint', :require => false +gem 'rake', '< 11.0.0' # rubi <1.9 versus rake 11.0.0 workaround + +if ENV['COVERAGE'] == 'yes' + gem 'simplecov', :require => false + gem 'coveralls', :require => false +end + +if File.exists? "#{__FILE__}.local" + eval(File.read("#{__FILE__}.local"), binding) +end diff --git a/metadata.json b/metadata.json index c5dccd20..861b8425 100644 --- a/metadata.json +++ b/metadata.json @@ -8,7 +8,7 @@ "project_page": "https://github.com/echocat/puppet-graphite", "issues_url": "https://github.com/echocat/puppet-graphite/issues", "dependencies": [ - {"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0"} + {"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 5.0.0"} ], "operatingsystem_support": [ { @@ -58,11 +58,12 @@ "requirements": [ { "name": "pe", - "version_requirement": "3.x" + "version_requirement": ">= 3.0.0 < 2015.4.0" }, { "name": "puppet", - "version_requirement": ">=2.7.20 <5.0.0" + "version_requirement": ">= 3.0.0 < 5.0.0" } - ] + ], + "description": "Graphite module" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3d920052..b67e6bae 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,23 @@ -require 'puppetlabs_spec_helper/module_spec_helper' \ No newline at end of file +if ENV['COVERAGE'] == 'yes' + require 'simplecov' + require 'coveralls' + + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter + ] + + #Coveralls.wear! + SimpleCov.start do + add_filter '/spec/' + add_filter '/.vendor/' + end +end + +RSpec.configure do |c| + c.after(:suite) do + RSpec::Puppet::Coverage.report! + end +end + +require 'puppetlabs_spec_helper/module_spec_helper'