Skip to content

Commit

Permalink
Use modulesync to manage meta files
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonn committed Nov 18, 2014
1 parent 9a359b2 commit 0fffc29
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
pkg/
Gemfile.lock
vendor/
spec/fixtures/
.vagrant/
.bundle/
coverage/
5 changes: 5 additions & 0 deletions .puppet-lint.rc
@@ -0,0 +1,5 @@
--fail-on-warnings
--relative
--no-80chars
--no-documentation
--no-class_inherits_from_params_class-check
31 changes: 17 additions & 14 deletions .travis.yml
@@ -1,23 +1,26 @@
---
language: ruby
bundler_args: --without development
script: bundle exec rake spec SPEC_OPTS='--format documentation'
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
env:
matrix:
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0.rc3" STRICT_VARIABLES="yes"
script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'", "bundle exec rake metadata"]
matrix:
fast_finish: true
exclude:
include:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0"
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
env: PUPPET_GEM_VERSION="~> 3.0"
notifications:
email: false
deploy:
provider: puppetforge
user: camptocamp
password:
secure: ""
on:
tags: true
# all_branches is required to use tags
all_branches: true
# Only publish if our main Ruby target builds
rvm: 1.9.3
13 changes: 10 additions & 3 deletions Gemfile
@@ -1,10 +1,17 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"

group :development, :test do
gem 'rake', '10.1.1'
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 1.0'
gem 'puppet-lint', '~> 0.3.2'
gem 'puppet-lint', :require => false
gem 'metadata-json-lint', :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']
Expand Down
14 changes: 7 additions & 7 deletions Rakefile
@@ -1,11 +1,11 @@
require 'rubygems'
require 'bundler/setup'

Bundler.require :default

require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'

task :default do
sh %{rake -T}
PuppetLint.configuration.fail_on_warnings
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Lint metadata.json file"
task :metadata do
sh "metadata-json-lint metadata.json"
end
6 changes: 6 additions & 0 deletions spec/spec.opts
@@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace
39 changes: 38 additions & 1 deletion spec/spec_helper.rb
@@ -1,9 +1,46 @@
require 'puppetlabs_spec_helper/module_spec_helper'

RSpec.configure do |c|
c.include PuppetlabsSpec::Files

c.before :each do
if ENV['STRICT_VARIABLES'] == 'yes'
# 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

0 comments on commit 0fffc29

Please sign in to comment.