Skip to content

Commit 9efc71c

Browse files
Modulesync + minor changes
Modulesync and also: - Drop explicit TravisCI testing with Puppet 2.7 and Ruby 1.8.7 - Replace deprecated RSpec should syntax - Fix the mocha include and unpin the mocha version - Update links to point to voxpupuli namespace
1 parent dddb7fd commit 9efc71c

27 files changed

+492
-103
lines changed

.gitignore

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
.bundle
2-
Gemfile.lock
3-
*.orig
4-
*.patch
51
pkg/
6-
*.rej
7-
.rspec_system/
8-
spec/fixtures/manifests/
9-
spec/fixtures/modules/
10-
*.swp
11-
.vagrant
2+
Gemfile.lock
3+
vendor/
4+
spec/fixtures/
5+
.vagrant/
6+
.bundle/
7+
coverage/
8+
log/
9+
.idea/
10+
*.iml
11+
.*.sw

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--format documentation
2+
--color

.rubocop.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
AllCops:
2+
Include:
3+
- ./**/*.rb
4+
Exclude:
5+
- vendor/**/*
6+
- pkg/**/*
7+
- spec/fixtures/**/*
8+
9+
# Configuration parameters: AllowURI, URISchemes.
10+
Metrics/LineLength:
11+
Max: 328
12+
13+
# 'Complexity' is very relative
14+
Metrics/PerceivedComplexity:
15+
Enabled: false
16+
17+
# 'Complexity' is very relative
18+
Metrics/CyclomaticComplexity:
19+
Enabled: false
20+
21+
# 'Complexity' is very relative
22+
Metrics/AbcSize:
23+
Enabled: false
24+
25+
# Method length is not necessarily an indicator of code quality
26+
Metrics/MethodLength:
27+
Enabled: false
28+
29+
# Class length is not necessarily an indicator of code quality
30+
Metrics/ClassLength:
31+
Enabled: false
32+
33+
# dealbreaker:
34+
Style/TrailingComma:
35+
Enabled: false
36+
Style/ClosingParenthesisIndentation:
37+
Enabled: false
38+
39+
# we still support ruby 1.8
40+
Style/HashSyntax:
41+
Enabled: false
42+
43+
Lint/AmbiguousRegexpLiteral:
44+
Enabled: true
45+
Style/RegexpLiteral:
46+
Enabled: true
47+
Style/WordArray:
48+
Enabled: true
49+
50+
# this catches the cases of using `module` for parser functions, types, or
51+
# providers
52+
Style/ClassAndModuleChildren:
53+
Enabled: false
54+
55+
Style/Documentation:
56+
Description: 'Document classes and non-namespace modules.'
57+
Enabled: false
58+
59+
# More comfortable block layouts
60+
Style/BlockDelimiters:
61+
Enabled: False
62+
63+
Style/MultilineBlockLayout:
64+
Enabled: False

.sync.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
Gemfile:
3+
required:
4+
':test':
5+
- gem: rake
6+
- gem: rspec-puppet
7+
git: https://github.com/rodjek/rspec-puppet.git
8+
- gem: puppet-lint
9+
git: https://github.com/rodjek/puppet-lint.git
10+
- gem: metadata-json-lint
11+
- gem: rspec-puppet-facts
12+
- gem: rspec
13+
- gem: puppet-blacksmith
14+
git: https://github.com/voxpupuli/puppet-blacksmith.git
15+
- gem: voxpupuli-release
16+
git: https://github.com/voxpupuli/voxpupuli-release-gem.git
17+
- gem: rubocop
18+
version: '0.35.0'
19+
- gem: rspec-puppet-utils
20+
- gem: puppetlabs_spec_helper
21+
- gem: puppet-lint-absolute_classname-check
22+
- gem: puppet-lint-leading_zero-check
23+
- gem: puppet-lint-trailing_comma-check
24+
- gem: puppet-lint-version_comparison-check
25+
- gem: puppet-lint-classes_and_types_beginning_with_digits-check
26+
- gem: puppet-lint-unquoted_string-check
27+
- gem: puppet-lint-variable_contains_upcase
28+
- gem: mocha
29+
':development':
30+
- gem: travis
31+
- gem: travis-lint
32+
- gem: guard-rake
33+
':system_tests':
34+
- gem: beaker
35+
- gem: beaker-rspec
36+
- gem: beaker-puppet_install_helper
37+
require: false
38+
spec/spec_helper.rb:
39+
unmanaged: true

.travis.yml

+37-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
11
---
2+
sudo: false
23
language: ruby
3-
bundler_args: --without development
4-
script: "bundle exec rspec --color --format documentation"
5-
rvm:
6-
- 1.8.7
7-
- 1.9.3
8-
- 2.0.0
9-
env:
10-
- PUPPET_GEM_VERSION="~> 2.7"
11-
- PUPPET_GEM_VERSION="~> 3.3"
4+
cache: bundler
5+
bundler_args: --without system_tests
6+
before_install: rm Gemfile.lock || true
7+
script:
8+
- 'bundle exec rake $CHECK'
129
matrix:
13-
exclude:
14-
- rvm: 1.9.3
15-
env: PUPPET_GEM_VERSION="~> 2.7"
16-
- rvm: 2.0.0
17-
env: PUPPET_GEM_VERSION="~> 2.7"
1810
fast_finish: true
11+
include:
12+
- rvm: 1.9.3
13+
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test
14+
- rvm: 2.1.8
15+
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test
16+
- rvm: 1.9.3
17+
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes
18+
- rvm: 2.1.8
19+
env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes
20+
- rvm: 2.1.8
21+
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test
22+
- rvm: 2.2.4
23+
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test
24+
- rvm: 2.2.4
25+
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=rubocop
26+
- rvm: 2.3.0
27+
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test
28+
allow_failures:
29+
- rvm: 2.3.0
30+
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test
1931
notifications:
2032
email: false
33+
deploy:
34+
provider: puppetforge
35+
user: puppet
36+
password:
37+
secure: ""
38+
on:
39+
tags: true
40+
# all_branches is required to use tags
41+
all_branches: true
42+
# Only publish if our main Ruby target builds
43+
rvm: 1.9.3

CONTRIBUTING.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
This module has grown over time based on a range of contributions from
2+
people using it. If you follow these contributing guidelines your patch
3+
will likely make it into a release a little quicker.
4+
5+
6+
## Contributing
7+
8+
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/).
9+
10+
1. Fork the repo.
11+
12+
1. Create a separate branch for your change.
13+
14+
1. Run the tests. We only take pull requests with passing tests, and
15+
documentation.
16+
17+
1. Add a test for your change. Only refactoring and documentation
18+
changes require no new tests. If you are adding functionality
19+
or fixing a bug, please add a test.
20+
21+
1. Squash your commits down into logical components. Make sure to rebase
22+
against the current master.
23+
24+
1. Push the branch to your fork and submit a pull request.
25+
26+
Please be prepared to repeat some of these steps as our contributors review
27+
your code.
28+
29+
## Dependencies
30+
31+
The testing and development tools have a bunch of dependencies,
32+
all managed by [bundler](http://bundler.io/) according to the
33+
[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions).
34+
35+
By default the tests use a baseline version of Puppet.
36+
37+
If you have Ruby 2.x or want a specific version of Puppet,
38+
you must set an environment variable such as:
39+
40+
export PUPPET_VERSION="~> 4.2.0"
41+
42+
Install the dependencies like so...
43+
44+
bundle install
45+
46+
## Syntax and style
47+
48+
The test suite will run [Puppet Lint](http://puppet-lint.com/) and
49+
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
50+
check various syntax and style things. You can run these locally with:
51+
52+
bundle exec rake lint
53+
bundle exec rake validate
54+
55+
## Running the unit tests
56+
57+
The unit test suite covers most of the code, as mentioned above please
58+
add tests if you're adding new functionality. If you've not used
59+
[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask
60+
about how best to test your new feature.
61+
62+
To run your all the unit tests
63+
64+
bundle exec rake spec SPEC_OPTS='--format documentation'
65+
66+
To run a specific spec test set the `SPEC` variable:
67+
68+
bundle exec rake spec SPEC=spec/foo_spec.rb
69+
70+
To run the linter, the syntax checker and the unit tests:
71+
72+
bundle exec rake test
73+
74+
75+
## Integration tests
76+
77+
The unit tests just check the code runs, not that it does exactly what
78+
we want on a real machine. For that we're using
79+
[beaker](https://github.com/puppetlabs/beaker).
80+
81+
This fires up a new virtual machine (using vagrant) and runs a series of
82+
simple tests against it after applying the module. You can run this
83+
with:
84+
85+
bundle exec rake acceptance
86+
87+
This will run the tests on an Ubuntu 12.04 virtual machine. You can also
88+
run the integration tests against Centos 6.5 with.
89+
90+
RS_SET=centos-64-x64 bundle exec rake acceptances
91+
92+
If you don't want to have to recreate the virtual machine every time you
93+
can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will
94+
at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile
95+
for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`.
96+

Gemfile

+60-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,65 @@
1-
source "https://rubygems.org"
1+
source ENV['GEM_SOURCE'] || "https://rubygems.org"
22

3-
group :development, :test do
4-
gem 'rake'
5-
gem 'rspec', "~> 2.11.0", :require => false
6-
gem 'mocha', "~> 0.10.5", :require => false
3+
def location_for(place, fake_version = nil)
4+
if place =~ /^(git[:@][^#]*)#(.*)/
5+
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
6+
elsif place =~ /^file:\/\/(.*)/
7+
['>= 0', { :path => File.expand_path($1), :require => false }]
8+
else
9+
[place, { :require => false }]
10+
end
711
end
812

9-
if puppetversion = ENV['PUPPET_GEM_VERSION']
10-
gem 'puppet', puppetversion, :require => false
13+
group :test do
14+
gem 'rake', :require => false
15+
gem 'rspec-puppet', :require => false, :git => 'https://github.com/rodjek/rspec-puppet.git'
16+
gem 'puppet-lint', :require => false, :git => 'https://github.com/rodjek/puppet-lint.git'
17+
gem 'metadata-json-lint', :require => false
18+
gem 'rspec-puppet-facts', :require => false
19+
gem 'rspec', :require => false
20+
gem 'puppet-blacksmith', :require => false, :git => 'https://github.com/voxpupuli/puppet-blacksmith.git'
21+
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git'
22+
gem 'rubocop', '0.35.0', :require => false
23+
gem 'rspec-puppet-utils', :require => false
24+
gem 'puppetlabs_spec_helper', :require => false
25+
gem 'puppet-lint-absolute_classname-check', :require => false
26+
gem 'puppet-lint-leading_zero-check', :require => false
27+
gem 'puppet-lint-trailing_comma-check', :require => false
28+
gem 'puppet-lint-version_comparison-check', :require => false
29+
gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
30+
gem 'puppet-lint-unquoted_string-check', :require => false
31+
gem 'puppet-lint-variable_contains_upcase', :require => false
32+
gem 'mocha', :require => false
33+
end
34+
35+
group :development do
36+
gem 'travis', :require => false
37+
gem 'travis-lint', :require => false
38+
gem 'guard-rake', :require => false
39+
end
40+
41+
group :system_tests do
42+
gem 'beaker', :require => false
43+
if beaker_version = ENV['BEAKER_VERSION']
44+
gem 'beaker', *location_for(beaker_version)
45+
end
46+
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
47+
gem 'beaker-rspec', *location_for(beaker_rspec_version)
48+
else
49+
gem 'beaker-rspec', :require => false
50+
end
51+
gem 'beaker-puppet_install_helper', :require => false
52+
end
53+
54+
55+
56+
if facterversion = ENV['FACTER_GEM_VERSION']
57+
gem 'facter', facterversion.to_s, :require => false, :groups => [:test]
1158
else
12-
gem 'puppet', :require => false
59+
gem 'facter', :require => false, :groups => [:test]
1360
end
61+
62+
ENV['PUPPET_VERSION'].nil? ? puppetversion = '3.8.4' : puppetversion = ENV['PUPPET_VERSION'].to_s
63+
gem 'puppet', puppetversion, :require => false, :groups => [:test]
64+
65+
# vim:ft=ruby

README.markdown README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ This module should work on any Debian and RHEL based distribution.
8484
Contact
8585
-------
8686

87-
* Source code: https://github.com/puppet-community/puppet-alternatives
88-
* Issue tracker: https://github.com/puppet-community/puppet-alternatives/issues
87+
* [Source code](https://github.com/voxpupuli/puppet-alternatives)
88+
* [Issue tracker](https://github.com/voxpupuli/puppet-alternatives/issues)

0 commit comments

Comments
 (0)