diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .rspec | 2 | ||||
-rw-r--r-- | .sync.yml | 6 | ||||
-rw-r--r-- | .travis.yml | 18 | ||||
-rw-r--r-- | CONTRIBUTING.md | 6 | ||||
-rw-r--r-- | Gemfile | 23 | ||||
-rwxr-xr-x | Rakefile | 85 | ||||
-rw-r--r-- | metadata.json | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 17 | ||||
-rw-r--r-- | spec/spec_helper_local.rb | 7 |
10 files changed, 45 insertions, 122 deletions
@@ -5,5 +5,6 @@ spec/fixtures/ .vagrant/ .bundle/ coverage/ +log/ .idea/ *.iml @@ -0,0 +1,2 @@ +--color +--format documentation diff --git a/.sync.yml b/.sync.yml deleted file mode 100644 index f4b637c..0000000 --- a/.sync.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -.travis.yml: -Rakefile: - unmanaged: true -spec/spec_helper.rb: - unmanaged: true diff --git a/.travis.yml b/.travis.yml index 1155a2d..e6314a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,19 @@ --- sudo: false language: ruby +cache: bundler bundler_args: --without system_tests -script: "bundle exec rake spec SPEC_OPTS='--format documentation'" +script: "bundle exec rake validate lint spec" matrix: fast_finish: true include: - - rvm: 1.8.7 + - rvm: 2.1.6 + env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" + - 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" - - 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.6 - env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" - allow_failures: - - rvm: 2.1.6 - env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" notifications: email: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f1cbde4..bfeaa70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -159,7 +159,7 @@ If you already have those gems installed, make sure they are up-to-date: With all dependencies in place and up-to-date we can now run the tests: ```shell -% rake spec +% bundle exec rake spec ``` This will execute all the [rspec tests](http://rspec-puppet.com/) tests @@ -178,8 +178,8 @@ installed on your system. You can run them by issuing the following command ```shell -% rake spec_clean -% rspec spec/acceptance +% bundle exec rake spec_clean +% bundle exec rspec spec/acceptance ``` This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), @@ -1,7 +1,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" def location_for(place, fake_version = nil) - if place =~ /^(git:[^#]*)#(.*)/ + if place =~ /^(git[:@][^#]*)#(.*)/ [fake_version, { :git => $1, :branch => $2, :require => false }].compact elsif place =~ /^file:\/\/(.*)/ ['>= 0', { :path => File.expand_path($1), :require => false }] @@ -11,15 +11,16 @@ def location_for(place, fake_version = nil) end group :development, :unit_tests do - gem 'rspec-core', '3.1.7', :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'simplecov', :require => false - gem 'puppet_facts', :require => false - gem 'json', :require => false - gem 'pry', :require => false + gem 'json', :require => false + gem 'metadata-json-lint', :require => false + gem 'puppet_facts', :require => false + gem 'puppet-blacksmith', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'rspec-puppet', '>= 2.3.2', :require => false + gem 'simplecov', :require => false end - group :system_tests do + gem 'beaker-puppet_install_helper', :require => false if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) end @@ -28,12 +29,10 @@ group :system_tests do else gem 'beaker-rspec', :require => false end - gem 'serverspec', :require => false - gem 'beaker-puppet_install_helper', :require => false + gem 'master_manipulator', :require => false + gem 'serverspec', :require => false end - - if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion, :require => false else @@ -1,78 +1,11 @@ +require 'puppet_blacksmith/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' require 'puppetlabs_spec_helper/rake_tasks' -require 'rake' -desc "Run beaker-rspec and beaker tests" -task 'beaker:test:all',[:host,:type] => ["rake:beaker:rspec:test", "rake:beaker:test"] do |t,args| -end - -desc "Run beaker-rspec tests" -task 'beaker:rspec:test',[:host,:type] => [:set_beaker_variables] do |t,args| - Rake::Task['beaker-rspec:test'].invoke(args) -end - -desc "Run beaker tests" -task 'beaker:test',[:host,:type] => [:set_beaker_variables] do |t,args| - sh(build_beaker_command args) -end - -desc "Run beaker rspec tasks against pe" -RSpec::Core::RakeTask.new('beaker-rspec:test',[:host,:type]=>:set_beaker_variables) do |t,args| - t.pattern = 'spec/acceptance' - t.rspec_opts = '--color' - t.verbose = true -end - -desc "Run beaker and beaker-rspec tasks" -task 'beaker:test:pe',:host do |t,args| - args.with_defaults(:type=> 'pe') - Rake::Task['beaker:test'].invoke(args[:host],args[:type]) -end - -task 'beaker:test:git',:host do |t,args| - args.with_defaults({:type=> 'git'}) - Rake::Task['beaker:test'].invoke(args[:host],args[:type]) -end - -task :set_beaker_variables do |t,args| - puts 'Setting environment variables for testing' - if args[:host] - ENV['BEAKER_set'] = args[:host] - puts "Host to test #{ENV['BEAKER_set']}" - end - ENV['BEAKER_IS_PE'] = args[:type] == 'pe'? "true": "false" - if ENV['BEAKER_setfile'] - @hosts_config = ENV['BEAKER_setfile'] - end - if File.exists?(check_args_for_keyfile(args.extras)) - ENV['BEAKER_keyfile'] = check_args_for_keyfile(args.extras) - end -end - -def build_beaker_command(args) - cmd = ["beaker"] - cmd << "--type #{args[:type]}" unless !args[:type] - if File.exists?("./.beaker-#{args[:type]}.cfg") - cmd << "--options-file ./.beaker-#{args[:type]}.cfg" - end - if File.exists?(@hosts_config) - cmd << "--hosts #{@hosts_config}" - end - if File.exists?('./spec/acceptance/beaker_helper.rb') - cmd << "--pre-suite ./spec/acceptance/beaker_helper.rb" - end - if File.exists?("./spec/acceptance/beaker") - cmd << "--tests ./spec/acceptance/beaker" - end - if File.exists?(check_args_for_keyfile(args.extras)) - cmd << "--keyfile #{check_args_for_keyfile(args.extras)}" - end - cmd.join(" ") -end - -def check_args_for_keyfile(extra_args) - keyfile = '' - extra_args.each do |a| - keyfile = a unless (`ssh-keygen -l -f #{a}`.gsub(/\n/,"").match(/is not a .*key file/)) - end - return keyfile -end +PuppetLint.configuration.fail_on_warnings = true +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.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] diff --git a/metadata.json b/metadata.json index 8612a98..660953b 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "version": "1.3.2", "author": "Puppet Labs", "summary": "Puppet module providing a type to manage repositories from various version control systems", - "license": "GPLv2", + "license": "GPL-2.0+", "source": "https://github.com/puppetlabs/puppetlabs-vcsrepo", "project_page": "https://github.com/puppetlabs/puppetlabs-vcsrepo", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ccd305b..a7f5b4e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' -require 'support/filesystem_helpers' -require 'support/fixture_helpers' -# SimpleCov does not run on Ruby 1.8.7 -unless RUBY_VERSION.to_f < 1.9 - require 'simplecov' - SimpleCov.start do - add_filter '/spec/' - end -end - -RSpec.configure do |c| - c.include FilesystemHelpers - c.include FixtureHelpers +# put local configuration and setup into spec_helper_local +begin + require 'spec_helper_local' +rescue LoadError end diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb new file mode 100644 index 0000000..c7d27b5 --- /dev/null +++ b/spec/spec_helper_local.rb @@ -0,0 +1,7 @@ +require 'support/filesystem_helpers' +require 'support/fixture_helpers' + +RSpec.configure do |c| + c.include FilesystemHelpers + c.include FixtureHelpers +end |