Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit 2bbaba4

Browse files
authored
Merge pull request #72 from ghoneycutt/ruby231
Support Puppet v4 AIO
2 parents 3bc10f3 + 83d58d2 commit 2bbaba4

24 files changed

+228
-116
lines changed

.fixtures.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
fixtures:
22
repositories:
3-
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
3+
stdlib:
4+
repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
5+
ref: '4.6.0'
46
symlinks:
5-
"ruby": "#{source_dir}"
7+
ruby: "#{source_dir}"

.gitignore

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
# Default .gitignore for Ruby
2+
*.gem
3+
*.rbc
4+
.bundle
5+
.config
6+
coverage
7+
InstalledFiles
8+
lib/bundler/man
9+
pkg
10+
rdoc
11+
spec/reports
12+
test/tmp
13+
test/version_tmp
14+
tmp
15+
16+
# YARD artifacts
17+
.yardoc
18+
_yardoc
19+
doc/
20+
21+
# Vim
22+
*.swp
23+
24+
# Eclipse
25+
.project
26+
27+
# OS X
28+
.DS_Store
29+
30+
# Puppet
31+
coverage/
32+
spec/fixtures/manifests/*
33+
spec/fixtures/modules/*
134
Gemfile.lock
2-
*.sw*
3-
spec/fixtures

.travis.yml

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,75 @@
11
---
2-
sudo: true
32
language: ruby
4-
bundler_args: --without development system_tests
5-
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
3+
4+
rvm:
5+
- 1.9.3
6+
- 2.0.0
7+
- 2.1.9
8+
- 2.3.1
9+
10+
env:
11+
matrix:
12+
- PUPPET_GEM_VERSION="~> 3.1.0"
13+
- PUPPET_GEM_VERSION="~> 3.2.0"
14+
- PUPPET_GEM_VERSION="~> 3.3.0"
15+
- PUPPET_GEM_VERSION="~> 3.4.0"
16+
- PUPPET_GEM_VERSION="~> 3.5.0"
17+
- PUPPET_GEM_VERSION="~> 3.6.0"
18+
- PUPPET_GEM_VERSION="~> 3.7.0"
19+
- PUPPET_GEM_VERSION="~> 3.8.0"
20+
- PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes"
21+
- PUPPET_GEM_VERSION="~> 4.0.0"
22+
- PUPPET_GEM_VERSION="~> 4.1.0"
23+
- PUPPET_GEM_VERSION="~> 4.2.0"
24+
- PUPPET_GEM_VERSION="~> 4.3.0"
25+
- PUPPET_GEM_VERSION="~> 4.4.0"
26+
- PUPPET_GEM_VERSION="~> 4.5.0"
27+
- PUPPET_GEM_VERSION="~> 4.6.0"
28+
- PUPPET_GEM_VERSION="~> 4.7.0"
29+
- PUPPET_GEM_VERSION="~> 4.8.0"
30+
- PUPPET_GEM_VERSION="~> 4"
31+
32+
sudo: false
33+
34+
bundler_args: '--without development system_tests'
35+
36+
before_install:
37+
- 'gem update --system'
38+
- 'gem update bundler'
39+
40+
script: 'SPEC_OPTS="--format documentation" bundle exec rake validate lint spec'
41+
642
matrix:
743
fast_finish: true
8-
include:
9-
- rvm: 1.9.3
10-
env: PUPPET_GEM_VERSION="~> 3.0"
11-
- rvm: 2.1.8
12-
env: PUPPET_GEM_VERSION="~> 3.0"
44+
exclude:
45+
- rvm: 2.0.0
46+
env: PUPPET_GEM_VERSION="~> 3.1.0"
47+
- rvm: 2.1.9
48+
env: PUPPET_GEM_VERSION="~> 3.1.0"
49+
- rvm: 2.1.9
50+
env: PUPPET_GEM_VERSION="~> 3.2.0"
51+
- rvm: 2.1.9
52+
env: PUPPET_GEM_VERSION="~> 3.3.0"
53+
- rvm: 2.1.9
54+
env: PUPPET_GEM_VERSION="~> 3.4.0"
55+
- rvm: 2.3.1
56+
env: PUPPET_GEM_VERSION="~> 3.1.0"
57+
- rvm: 2.3.1
58+
env: PUPPET_GEM_VERSION="~> 3.2.0"
59+
- rvm: 2.3.1
60+
env: PUPPET_GEM_VERSION="~> 3.3.0"
61+
- rvm: 2.3.1
62+
env: PUPPET_GEM_VERSION="~> 3.4.0"
63+
- rvm: 2.3.1
64+
env: PUPPET_GEM_VERSION="~> 3.5.0"
65+
- rvm: 2.3.1
66+
env: PUPPET_GEM_VERSION="~> 3.6.0"
67+
- rvm: 2.3.1
68+
env: PUPPET_GEM_VERSION="~> 3.7.0"
69+
- rvm: 2.3.1
70+
env: PUPPET_GEM_VERSION="~> 3.8.0"
71+
- rvm: 2.3.1
72+
env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes"
73+
1374
notifications:
1475
email: false

Gemfile

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

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
3+
if puppetversion = ENV['PUPPET_GEM_VERSION']
4+
gem 'puppet', puppetversion, :require => false
5+
else
6+
gem 'puppet', :require => false
117
end
128

13-
group :development, :unit_tests do
14-
gem 'rspec-puppet', '~> 2.1', :require => false
15-
gem 'rspec-core', '3.1.7', :require => false
16-
gem 'puppetlabs_spec_helper', :require => false
17-
gem 'simplecov', :require => false
18-
gem 'puppet_facts', :require => false
19-
end
9+
gem 'puppetlabs_spec_helper', '>= 1.2.0', :require => false
10+
gem 'facter', '>= 1.7.0', :require => false
11+
gem 'rspec-puppet', :require => false
12+
gem 'puppet-lint', '~> 2.0', :require => false
13+
gem 'puppet-lint-absolute_classname-check', :require => false
14+
gem 'puppet-lint-alias-check', :require => false
15+
gem 'puppet-lint-empty_string-check', :require => false
16+
gem 'puppet-lint-file_ensure-check', :require => false
17+
gem 'puppet-lint-file_source_rights-check', :require => false
18+
gem 'puppet-lint-leading_zero-check', :require => false
19+
gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false
20+
gem 'puppet-lint-trailing_comma-check', :require => false
21+
gem 'puppet-lint-undef_in_function-check', :require => false
22+
gem 'puppet-lint-unquoted_string-check', :require => false
23+
gem 'puppet-lint-variable_contains_upcase', :require => false
24+
25+
gem 'rspec','~> 2.0', :require => false if RUBY_VERSION < '1.9'
26+
gem 'rake', '~> 10.0', :require => false if RUBY_VERSION < '1.9'
27+
gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0'
28+
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
29+
gem 'json', :require => false if RUBY_VERSION >= '2.0.0'
30+
gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9'
31+
gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9'
2032

2133
group :system_tests do
2234
if beaker_version = ENV['BEAKER_VERSION']
@@ -25,40 +37,10 @@ group :system_tests do
2537
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
2638
gem 'beaker-rspec', *location_for(beaker_rspec_version)
2739
else
28-
gem 'beaker-rspec', :require => false
40+
gem 'beaker-rspec', :require => false
2941
end
30-
gem 'serverspec', :require => false
42+
gem 'serverspec', :require => false
3143
gem 'beaker-puppet_install_helper', :require => false
3244
end
3345

34-
35-
36-
if facterversion = ENV['FACTER_GEM_VERSION']
37-
gem 'facter', facterversion, :require => false
38-
else
39-
gem 'facter', :require => false
40-
end
41-
42-
if puppetversion = ENV['PUPPET_GEM_VERSION']
43-
gem 'puppet', puppetversion, :require => false
44-
else
45-
gem 'puppet', :require => false
46-
end
47-
48-
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
49-
# rspec must be v2 for ruby 1.8.7
50-
gem 'rspec', '~> 2.0'
51-
# rake must be v10 for ruby 1.8.7
52-
gem 'rake', '~> 10.0'
53-
end
54-
55-
if RUBY_VERSION < '2.0'
56-
# json 2.x requires ruby 2.0.
57-
gem 'json', '~> 1.0'
58-
# json_pure 2.0.2 requires ruby 2.0. Lock to 2.0.1
59-
gem 'json_pure', '= 2.0.1'
60-
else
61-
gem 'json'
62-
end
63-
6446
# vim:ft=ruby

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2012 Puppet Labs Inc
1+
Copyright (C) 2012-2016 Puppet Labs Inc
22

33
Puppet Labs can be contacted at: [email protected]
44

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
This module manages Ruby and Rubygems.
44

55
# Compatibility
6-
Puppet v3 with Ruby 1.9.x, 2.1.x on the following platforms.
6+
Puppet v3 with Ruby 1.9.3, 2.0.0, 2.1.9 and 2.3.1 on the following platforms.
77

8+
* Debian 6
9+
* Debian 7
810
* EL 5
911
* EL 6
1012
* EL 7
13+
* FreeBSD 10
1114
* SLES 11 SP1
1215

1316

Rakefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
require 'puppetlabs_spec_helper/rake_tasks'
22
require 'puppet-lint/tasks/puppet-lint'
3-
4-
PuppetLint.configuration.fail_on_warnings = true
5-
PuppetLint.configuration.send('relative')
63
PuppetLint.configuration.send('disable_80chars')
74
PuppetLint.configuration.send('disable_140chars')
8-
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
9-
PuppetLint.configuration.send('disable_documentation')
10-
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
5+
PuppetLint.configuration.relative = true
116
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
7+
8+
desc 'Validate manifests, templates, and ruby files'
9+
task :validate do
10+
Dir['manifests/**/*.pp'].each do |manifest|
11+
sh "puppet parser validate --noop #{manifest}"
12+
end
13+
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
14+
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
15+
end
16+
Dir['templates/**/*.erb'].each do |template|
17+
sh "erb -P -x -T '-' #{template} | ruby -c"
18+
end
19+
end

manifests/bundle.pp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
(
5353
$command = 'install',
5454
$option = undef,
55-
$rails_env = $ruby::params::rails_env,
55+
$rails_env = undef,
5656
$multicore = undef,
5757
$creates = undef,
5858
$cwd = undef,
@@ -70,7 +70,13 @@
7070
$unless = undef,
7171
) {
7272

73-
require ruby
73+
require ::ruby
74+
75+
if $rails_env == undef {
76+
$rails_env_real = $ruby::params::rails_env
77+
} else {
78+
$rails_env_real = $rails_env
79+
}
7480

7581
# ensure minimum path requirements for bundler
7682
if $path {
@@ -81,9 +87,9 @@
8187

8288
# merge the environment and rails_env parameters
8389
if $environment {
84-
$real_environment = unique(flatten([$environment, ["RAILS_ENV=${rails_env}"]]))
90+
$real_environment = unique(flatten([$environment, ["RAILS_ENV=${rails_env_real}"]]))
8591
} else {
86-
$real_environment = "RAILS_ENV=${rails_env}"
92+
$real_environment = "RAILS_ENV=${rails_env_real}"
8793
}
8894

8995
if $multicore {
@@ -93,7 +99,7 @@
9399
$multicore_str = " --jobs ${multicore}"
94100
}
95101
} else {
96-
$multicore_str = ''
102+
$multicore_str = undef
97103
}
98104

99105
case $command {
@@ -107,7 +113,7 @@
107113
'\s*--gemfile=[a-zA-Z0-9\/\\:\.]+\s*',
108114
'\s*--path=[a-zA-Z0-9\/\\:\.]+\s*',
109115
'\s*--no-prune\s*',
110-
'\s*--without [[a-z0-9]+ ]+\s*'
116+
'\s*--without [[a-z0-9]+ ]+\s*',
111117
],
112118
'Only bundler options supported for the install command are: clean, deployment, gemfile, path, without, and no-prune'
113119
)
@@ -160,7 +166,6 @@
160166
tries => $tries,
161167
try_sleep => $try_sleep,
162168
unless => $real_unless,
163-
require => Package['bundler']
169+
require => Package['bundler'],
164170
}
165-
166171
}

manifests/dev.pp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
$bundler_package = $ruby::params::bundler_package,
4545
$bundler_provider = $ruby::params::bundler_provider,
4646
) inherits ruby::params {
47-
require ruby
47+
require ::ruby
4848

4949
# as the package ensure covers _multiple_ packages
5050
# specifying a version may cause issues.
@@ -64,28 +64,28 @@
6464
$ruby_dev = [
6565
'ruby1.8-dev',
6666
'ri1.8',
67-
'pkg-config'
67+
'pkg-config',
6868
]
6969
}
7070
/^1\.9.*$/:{
7171
$ruby_dev = [
7272
'ruby1.9.1-dev',
7373
'ri1.9.1',
74-
'pkg-config'
74+
'pkg-config',
7575
]
7676
}
7777
/^2\.0.*$/:{
7878
$ruby_dev = [
7979
'ruby2.0-dev',
8080
'ri',
81-
'pkg-config'
81+
'pkg-config',
8282
]
8383
}
8484
/^2\.1.*$/:{
8585
$ruby_dev = [
8686
'ruby2.1-dev',
8787
'ri',
88-
'pkg-config'
88+
'pkg-config',
8989
]
9090
}
9191
default: {

manifests/init.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
case $::osfamily {
115115
'Debian': {
116116
case $ruby_package {
117-
installed: {
117+
'installed': {
118118
$real_ruby_package = $ruby_package
119119
}
120120
default:{
@@ -287,7 +287,7 @@
287287

288288
if $gem_integration {
289289
case $::osfamily {
290-
Debian: {
290+
'Debian': {
291291
if ! $suppress_warnings and $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '13.04') < 0 {
292292
warning('No package for rubygems_integration available from default repositories')
293293
}

0 commit comments

Comments
 (0)