Skip to content

Commit a4bf717

Browse files
committed
Merge pull request #3 from adamcrews/spec_update
Spec update & Misc fixes
2 parents 6cce0ee + f615af6 commit a4bf717

File tree

10 files changed

+176
-78
lines changed

10 files changed

+176
-78
lines changed

.travis.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
---
22
language: ruby
3-
bundler_args: --without development
3+
bundler_args: --without development system_tests
44
before_install: rm Gemfile.lock || true
5-
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
5+
script: bundle exec rake test
66
rvm:
77
- 1.9.3
88
- 2.0.0
9+
- 2.1.0
910
env:
10-
- PUPPET_GEM_VERSION="~> 3.4.0"
11-
- PUPPET_GEM_VERSION="~> 3.5.0"
12-
- PUPPET_GEM_VERSION="~> 3.6.0"
11+
- PUPPET_VERSION="~> 3.2.0"
12+
- PUPPET_VERSION="~> 3.3.0"
13+
- PUPPET_VERSION="~> 3.4.0"
14+
- PUPPET_VERSION="~> 3.5.0" STRICT_VARIABLES=yes
15+
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
16+
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes
17+
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
18+
- PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=yes
19+
1320
matrix:
1421
exclude:
15-
- rvm: 2.0.0
16-
env: PUPPET_GEM_VERSION="~> 3.1.0"
17-
- rvm: 2.0.0
18-
env: PUPPET_GEM_VERSION="~> 2.7.0"
19-
- rvm: 1.9.3
20-
env: PUPPET_GEM_VERSION="~> 2.7.0"
22+
# Ruby 1.9.3
23+
- rvm: 1.9.3
24+
env: PUPPET_VERSION="~> 2.7.0"
25+
26+
# Ruby 2.0.0
27+
- rvm: 2.0.0
28+
env: PUPPET_VERSION="~> 2.7.0"
29+
30+
# Ruby 2.1.0
31+
- rvm: 2.1.0
32+
env: PUPPET_VERSION="~> 2.7.0"
33+
- rvm: 2.1.0
34+
env: PUPPET_VERSION="~> 3.2.0"
35+
- rvm: 2.1.0
36+
env: PUPPET_VERSION="~> 3.3.0"
37+
- rvm: 2.1.0
38+
env: PUPPET_VERSION="~> 3.4.0"
2139
notifications:
2240
email: false

CHANGELOG.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
1+
2015-05-26 08:41:12 -0700 Adam Crews
2+
3+
* Fixed quoting on param (HEAD, spec_update)
4+
5+
2015-05-26 08:40:55 -0700 Adam Crews
6+
7+
* Fixed tests to better check content
8+
9+
2015-05-26 06:32:19 -0700 Adam Crews
10+
11+
* Fix license name (origin/spec_update)
12+
13+
2015-05-26 06:28:34 -0700 Adam Crews
14+
15+
* Update spec tests, prep for a release
16+
17+
2015-05-26 14:01:10 +0200 Steve Traylen
18+
19+
* Eplicitly specify origin of class variables
20+
21+
2015-05-26 13:35:13 +0200 Steve Traylen
22+
23+
* Typo in error message
24+
25+
2015-05-26 13:33:23 +0200 Steve Traylen
26+
27+
* Ensure default works on redhat 5 systems. In particular it avoids the following error:
28+
29+
2015-05-26 13:25:10 +0200 Steve Traylen
30+
31+
* Tests on contents of updatedb.conf
32+
133
2014-12-02 12:03:15 -0800 Adam Crews
234

3-
* Fixed badge url (HEAD, master)
35+
* Fixed badge url
436

537
2014-12-02 12:01:23 -0800 Adam Crews
638

7-
* Added forge badge (origin/master)
39+
* Added forge badge
840

941
2014-07-30 13:55:24 -0700 Adam Crews
1042

Gemfile

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
source ENV['GEM_SOURCE'] || "https://rubygems.org"
1+
source "https://rubygems.org"
22

3-
group :development, :test do
4-
gem 'rake', :require => false
5-
gem 'rspec-puppet', :require => false
6-
gem 'puppetlabs_spec_helper', :require => false
7-
gem 'serverspec', :require => false
8-
gem 'puppet-lint', :require => false
9-
gem 'rspec', '< 2.99', :require => false
10-
gem 'simplecov', :require => false
3+
group :test do
4+
gem "rake"
5+
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
6+
gem "rspec", '< 3.2.0'
7+
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
8+
gem "puppetlabs_spec_helper"
9+
gem "metadata-json-lint"
10+
gem "rspec-puppet-facts"
1111
end
1212

13-
if facterversion = ENV['FACTER_GEM_VERSION']
14-
gem 'facter', facterversion, :require => false
15-
else
16-
gem 'facter', :require => false
13+
group :development do
14+
gem "travis"
15+
gem "travis-lint"
16+
gem "vagrant-wrapper"
17+
gem "puppet-blacksmith"
18+
gem "guard-rake"
1719
end
1820

19-
if puppetversion = ENV['PUPPET_GEM_VERSION']
20-
gem 'puppet', puppetversion, :require => false
21-
else
22-
gem 'puppet', :require => false
21+
group :system_tests do
22+
gem "beaker"
23+
gem "beaker-rspec"
2324
end
24-
25-
# vim:ft=ruby

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Install and manage the mlocate/updatedb package.
2929
## Module Description
3030

3131
Mlocate is a useful tool that does a find of your system and records the files present.
32-
It's a bit old, and not commonly used, irrelevant on dispisable systems, but I like it, so get off my lawn.
32+
It's a bit old, not commonly used, irrelevant on disposable systems, but I like it, so get off my lawn.
3333

3434
## Setup
3535

Rakefile

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,56 @@
11
require 'puppetlabs_spec_helper/rake_tasks'
2+
require 'puppet/version'
3+
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
24
require 'puppet-lint/tasks/puppet-lint'
3-
PuppetLint.configuration.send('disable_80chars')
4-
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
5-
6-
desc "Validate manifests, templates, and ruby files"
7-
task :validate do
8-
Dir['manifests/**/*.pp'].each do |manifest|
9-
sh "puppet parser validate --noop #{manifest}"
10-
end
11-
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
12-
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
13-
end
14-
Dir['templates/**/*.erb'].each do |template|
15-
sh "erb -P -x -T '-' #{template} | ruby -c"
16-
end
5+
require 'puppet-syntax/tasks/puppet-syntax'
6+
7+
# These gems aren't always present, for instance
8+
# on Travis with --without development
9+
begin
10+
require 'puppet_blacksmith/rake_tasks'
11+
rescue LoadError
12+
end
13+
14+
Rake::Task[:lint].clear
15+
16+
PuppetLint.configuration.relative = true
17+
PuppetLint.configuration.send("disable_80chars")
18+
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
19+
PuppetLint.configuration.fail_on_warnings = true
20+
21+
# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
22+
# http://puppet-lint.com/checks/class_parameter_defaults/
23+
PuppetLint.configuration.send('disable_class_parameter_defaults')
24+
# http://puppet-lint.com/checks/class_inherits_from_params_class/
25+
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
26+
27+
exclude_paths = [
28+
"bundle/**/*",
29+
"pkg/**/*",
30+
"vendor/**/*",
31+
"spec/**/*",
32+
]
33+
PuppetLint.configuration.ignore_paths = exclude_paths
34+
PuppetSyntax.exclude_paths = exclude_paths
35+
36+
desc "Run acceptance tests"
37+
RSpec::Core::RakeTask.new(:acceptance) do |t|
38+
t.pattern = 'spec/acceptance'
39+
end
40+
41+
desc "Populate CONTRIBUTORS file"
42+
task :contributors do
43+
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
1744
end
45+
46+
task :metadata do
47+
sh "metadata-json-lint metadata.json"
48+
end
49+
50+
desc "Run syntax, lint, and spec tests."
51+
task :test => [
52+
:syntax,
53+
:lint,
54+
:spec,
55+
:metadata,
56+
]

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
$update_on_install = true
77
$conf_file = '/etc/updatedb.conf'
88
$cron_ensure = 'present'
9-
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == 5 {
9+
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' {
1010
$prune_bind_mounts = undef
1111
$prunenames = undef
1212
} else {

metadata.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
{
22
"name": "adamcrews-mlocate",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"author": "Adam Crews",
55
"summary": "Manage the mlocate package for updatedb/locate.",
6-
"license": "Apache 2.0",
6+
"license": "Apache-2.0",
77
"source": "https://github.com/adamcrews/puppet-mlocate.git",
88
"project_page": "https://github.com/adamcrews/puppet-mlocate",
99
"issues_url": "https://github.com/adamcrews/puppet-mlocate/issues",
1010
"requirements": [
1111
{
1212
"name": "pe",
13-
"version_requirement": ">=3.2.0 <3.4.0"
13+
"version_requirement": ">=3.2.0 <4.0.0"
1414
},
1515
{
1616
"name": "puppet",
17-
"version_requirement": ">=3.0.0 <4.0.0"
17+
"version_requirement": ">=3.0.0 <4.2.0"
1818
}
1919
],
2020
"operatingsystem_support": [
2121
{
2222
"operatingsystem": "RedHat",
23-
"operatingsystem_release": [
23+
"operatingsystemrelease": [
2424
"5",
2525
"6"
2626
]
2727
},
2828
{
2929
"operatingsystem": "CentOS",
30-
"operatingsystem_release": [
30+
"operatingsystemrelease": [
3131
"5",
3232
"6"
3333
]

spec/classes/init_spec.rb

Lines changed: 0 additions & 24 deletions
This file was deleted.

spec/classes/mlocate_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'spec_helper'
2+
3+
describe 'mlocate' do
4+
5+
context 'supported operating systems' do
6+
on_supported_os.each do |os, facts|
7+
context "on #{os}" do
8+
let(:facts) do
9+
facts
10+
end
11+
12+
context 'with defaults for all parameters' do
13+
it { should contain_class('mlocate') }
14+
it { should contain_class('mlocate::install') }
15+
it { should contain_class('mlocate::cron') }
16+
17+
it { should contain_file('updatedb.conf').with_path('/etc/updatedb.conf') }
18+
it { should contain_file('updatedb.conf').with_content(/^PRUNEPATHS = \"\/afs .*$/) }
19+
it { should contain_file('updatedb.conf').with_content(/^PRUNEFS = \"9p afs .*$/) }
20+
21+
if facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease] == '5' then
22+
it { should contain_file('updatedb.conf').without_content(/^PRUNE_BIND_MOUNTS.*$/) }
23+
it { should contain_file('updatedb.conf').without_content(/^PRUNENAMES.*$/) }
24+
else
25+
it { should contain_file('updatedb.conf').with_content(/^PRUNE_BIND_MOUNTS = "yes"$/) }
26+
it { should contain_file('updatedb.conf').with_content(/^PRUNENAMES = ".git .hg .svn"$/) }
27+
end
28+
end
29+
end
30+
end
31+
end
32+
end

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
require 'puppetlabs_spec_helper/module_spec_helper'
2+
require 'rspec-puppet-facts'
3+
include RspecPuppetFacts

0 commit comments

Comments
 (0)