]> gitweb.fluxo.info Git - puppet-dhcp.git/commitdiff
Sync module
authorRaphaël Pinson <raphael.pinson@camptocamp.com>
Mon, 20 Oct 2014 07:43:30 +0000 (09:43 +0200)
committerRaphaël Pinson <raphael.pinson@camptocamp.com>
Mon, 20 Oct 2014 07:43:30 +0000 (09:43 +0200)
.gitignore [new file with mode: 0644]
.puppet-lint.rc [new file with mode: 0644]
.travis.yml
Gemfile
Rakefile
spec/spec.opts [new file with mode: 0644]
spec/spec_helper.rb

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..b5b7a00
--- /dev/null
@@ -0,0 +1,7 @@
+pkg/
+Gemfile.lock
+vendor/
+spec/fixtures/
+.vagrant/
+.bundle/
+coverage/
diff --git a/.puppet-lint.rc b/.puppet-lint.rc
new file mode 100644 (file)
index 0000000..d8f5c59
--- /dev/null
@@ -0,0 +1,5 @@
+--fail-on-warnings
+--relative
+--no-80chars
+--no-documentation
+--no-class_inherits_from_params_class-check
index 6d7c0f8497ebabfd8bcaa2ab566bca814cffee70..0e0b6c6c666b3435df0e44eae3cd695faf1ab1f9 100644 (file)
@@ -1,15 +1,17 @@
+---
 language: ruby
-rvm:
-  - 1.8.7
-  - 1.9.3
-  - 2.0.0
-  - ruby-head
-env:
-  - PUPPET_GEM_VERSION=">= 3.0.0"
+bundler_args: --without development
+script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
 matrix:
-  allow_failures:
-    - rvm: 2.0.0
-    - rvm: ruby-head
+  fast_finish: true
   include:
-    - rvm: 1.8.7
-      env: PUPPET_GEM_VERSION="~> 2.7"
+  - rvm: 1.8.7
+    env: PUPPET_GEM_VERSION="~> 2.7"
+  - rvm: 1.8.7
+    env: PUPPET_GEM_VERSION="~> 3.0"
+  - rvm: 1.9.3
+    env: PUPPET_GEM_VERSION="~> 3.0"
+  - rvm: 2.0.0
+    env: PUPPET_GEM_VERSION="~> 3.0"
+notifications:
+  email: false
diff --git a/Gemfile b/Gemfile
index a500d9ee2b7768e047333dd91113dacdfcd1e6d5..cff878d7a90a6f54b447a1a509ed4f65157bf029 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -1,13 +1,24 @@
-source :rubygems
+source ENV['GEM_SOURCE'] || "https://rubygems.org"
 
-if ENV.key?('PUPPET_VERSION')
-  puppetversion = "= #{ENV['PUPPET_VERSION']}"
+group :development, :test do
+  gem 'rake',                    :require => false
+  gem 'rspec-puppet',            :require => false
+  gem 'puppetlabs_spec_helper',  :require => false
+  gem 'puppet-lint',             :require => false
+  gem 'pry',                     :require => false
+  gem 'simplecov',               :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
-  puppetversion = ['>= 2.7']
+  gem 'puppet', :require => false
 end
 
-gem 'rake'
-gem 'puppet-lint'
-gem 'rspec-puppet'
-gem 'puppet', puppetversion
-gem 'puppetlabs_spec_helper', '>= 0.4.0'
+# vim:ft=ruby
index 4d31fec736c7c273a862a2fa1fb49ff4c5a9cbbe..ee78ce6ca5ca4f6b05a380f7162e77be894c4916 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,6 @@
-require 'puppet-lint/tasks/puppet-lint'
 require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
 
-task :default => [:spec, :lint]
-
+PuppetLint.configuration.fail_on_warnings
+PuppetLint.configuration.send('disable_80chars')
+PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
diff --git a/spec/spec.opts b/spec/spec.opts
new file mode 100644 (file)
index 0000000..91cd642
--- /dev/null
@@ -0,0 +1,6 @@
+--format
+s
+--colour
+--loadby
+mtime
+--backtrace
index 4edc9645f9162f416105ded5d20bd74dfd24113a..adbb1916ddee8e3b8130e3e74522f5974117779d 100644 (file)
@@ -1,4 +1,46 @@
-require 'mocha'
-require 'rspec-puppet'
 require 'puppetlabs_spec_helper/module_spec_helper'
 
+RSpec.configure do |c|
+  c.include PuppetlabsSpec::Files
+
+  c.before :each do
+    # Ensure that we don't accidentally cache facts and environment
+    # between test cases.
+    Facter::Util::Loader.any_instance.stubs(:load_all)
+    Facter.clear
+    Facter.clear_messages
+
+    # Store any environment variables away to be restored later
+    @old_env = {}
+    ENV.each_key {|k| @old_env[k] = ENV[k]}
+
+    if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5')
+      Puppet.settings[:strict_variables]=true
+    end
+  end
+
+  c.after :each do
+    PuppetlabsSpec::Files.cleanup
+  end
+end
+
+require 'pathname'
+dir = Pathname.new(__FILE__).parent
+Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules')
+
+# There's no real need to make this version dependent, but it helps find
+# regressions in Puppet
+#
+# 1. Workaround for issue #16277 where default settings aren't initialised from
+# a spec and so the libdir is never initialised (3.0.x)
+# 2. Workaround for 2.7.20 that now only loads types for the current node
+# environment (#13858) so Puppet[:modulepath] seems to get ignored
+# 3. Workaround for 3.5 where context hasn't been configured yet,
+# ticket https://tickets.puppetlabs.com/browse/MODULES-823
+#
+ver = Gem::Version.new(Puppet.version.split('-').first)
+if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver
+  puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading"
+  # libdir is only a single dir, so it can only workaround loading of one external module
+  Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib"
+end