puppetlabs_spec_helper 2.12.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 45bf89e508fd4e7455ff251a5aa2743007ffe4f3
4
- data.tar.gz: 9152f0a0445f9ddeb10555e35ab1b5e29f138aff
2
+ SHA256:
3
+ metadata.gz: ef8655a96bfce5e47b0a0c1691cc79033fb8c0257ae329f1f133bcfcf950cb51
4
+ data.tar.gz: 6422a905001992ce256ce6102e59feffb1853c37f6997b5a2deb439e77721e98
5
5
  SHA512:
6
- metadata.gz: 1446edba63e86631ea5cc121440e92834ea150a59df692d445d3c4225b10d8141a0e662acb457b44e4ce3c7892e1342dbdd4b8b6436117bbd67dd1fd25d2809b
7
- data.tar.gz: 6ab7060e156d08fbaf6e15e54fa3d670c39ae05d0ab8bb844014e41d03fbb88d1b08d55141b2265e1995b6597175b9f05f02460557b0975568eae62b9c616542
6
+ metadata.gz: 6b1ede292272b8999f9d0c2775dc9796cea623062dc482b1ed5f3c8e9d7b204b2c171b4a9c582eb0a72a0ef73c1c604c33255e7a234bfedc45435dc9a87f1a0e
7
+ data.tar.gz: d90acb664b74a454610637f5363ab6d975290272aff8f9b6dc0195104493a7d66c6e9c0d646d4d1f877d06244646dae95fa9e70a036f3f4f8a995c296444e1a4
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --format documentation
2
- --color
3
2
  --order rand
@@ -136,3 +136,7 @@ Style/SymbolArray:
136
136
  Description: Using percent style obscures symbolic intent of array's contents.
137
137
  Enabled: true
138
138
  EnforcedStyle: brackets
139
+
140
+ # Enforce LF line endings, even when on Windows
141
+ Layout/EndOfLine:
142
+ EnforcedStyle: lf
@@ -89,6 +89,7 @@ Style/Documentation:
89
89
  - 'lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb'
90
90
  - 'lib/puppetlabs_spec_helper/tasks/beaker.rb'
91
91
  - 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
92
+ - 'lib/puppetlabs_spec_helper/tasks/check_symlinks.rb'
92
93
 
93
94
  # Offense count: 1
94
95
  Style/DoubleNegation:
@@ -1,13 +1,22 @@
1
- sudo: false
1
+ os: linux
2
+ dist: xenial
2
3
  language: ruby
3
4
  cache: bundler
4
- before_install:
5
- # https://github.com/bundler/bundler/issues/3558
6
- gem update bundler
5
+ before_install: bundle -v
7
6
  script: env COVERAGE=yes bundle exec rake
8
- matrix:
7
+ jobs:
9
8
  fast_finish: true
10
9
  include:
10
+ - rvm: '2.7'
11
+ env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#master' # TODO: change to 7 once it becomes available
12
+ - rvm: '2.6'
13
+ env: PUPPET_GEM_VERSION='~> 6.0'
14
+ - rvm: '2.5'
15
+ env: PUPPET_GEM_VERSION='~> 6.0'
16
+ - rvm: '2.4'
17
+ env: PUPPET_GEM_VERSION='~> 6.0'
18
+ - rvm: '2.3'
19
+ env: PUPPET_GEM_VERSION='~> 6.0'
11
20
  - rvm: '2.4'
12
21
  env: PUPPET_GEM_VERSION='~> 5.0'
13
22
  - rvm: '2.3'
@@ -20,11 +29,5 @@ matrix:
20
29
  env: PUPPET_GEM_VERSION='~> 4.0'
21
30
  - rvm: '2.1'
22
31
  env: PUPPET_GEM_VERSION='~> 4.0'
23
- - rvm: '2.1'
24
- env: PUPPET_GEM_VERSION='~> 3.0'
25
- - rvm: '2.0'
26
- env: PUPPET_GEM_VERSION='~> 3.0'
27
- - rvm: '1.9'
28
- env: PUPPET_GEM_VERSION='~> 3.0'
29
32
  notifications:
30
33
  email: false
@@ -3,6 +3,89 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v2.15.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.15.0) (2020-06-11)
7
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.14.1...v2.15.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - Add Ruby 2.6/Puppet6 to CI matrix [\#311](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/311) ([bastelfreak](https://github.com/bastelfreak))
12
+ - \(GH-297\) Don't allow git refs with forward slashes [\#299](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/299) ([glennsarti](https://github.com/glennsarti))
13
+ - Accept `:tag` for consistency with r10k [\#296](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/296) ([binford2k](https://github.com/binford2k))
14
+ - \(maint\) migrate the changelog task from pdk-templates [\#278](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/278) ([DavidS](https://github.com/DavidS))
15
+
16
+ **Fixed bugs:**
17
+
18
+ - \(MAINT\) Fix initialize of Gettext call [\#292](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/292) ([ThoughtCrhyme](https://github.com/ThoughtCrhyme))
19
+
20
+ **Merged pull requests:**
21
+
22
+ - \(IAC-859\) Update all the gems and ruby to 2.7 [\#316](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/316) ([DavidS](https://github.com/DavidS))
23
+ - Support git fixture branches containing slashes [\#297](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/297) ([trevor-vaughan](https://github.com/trevor-vaughan))
24
+ - \(maint\) Require pdk/util in build:pdk rake task [\#295](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/295) ([rodjek](https://github.com/rodjek))
25
+ - Ignore plans folder and any subfolder [\#294](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/294) ([cyberious](https://github.com/cyberious))
26
+ - \(maint\) add codeowners file [\#293](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/293) ([tphoney](https://github.com/tphoney))
27
+ - \(MAINT\) Removes old rubies and puppet versions [\#290](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/290) ([logicminds](https://github.com/logicminds))
28
+ - Remove coveralls docs [\#289](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/289) ([DavidS](https://github.com/DavidS))
29
+ - Download forge modules in parallel [\#284](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/284) ([logicminds](https://github.com/logicminds))
30
+
31
+ ## [v2.14.1](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.14.1) (2019-03-26)
32
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.14.0...v2.14.1)
33
+
34
+ **Fixed bugs:**
35
+
36
+ - Revert "\(feat\) dont load the beaker if litmus is there" [\#286](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/286) ([pmcmaw](https://github.com/pmcmaw))
37
+
38
+ **Merged pull requests:**
39
+
40
+ - \(MODULES-8778\) - Release Prep 2.14.1 [\#287](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/287) ([pmcmaw](https://github.com/pmcmaw))
41
+
42
+ ## [v2.14.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.14.0) (2019-03-25)
43
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.13.1...v2.14.0)
44
+
45
+ **Implemented enhancements:**
46
+
47
+ - \(feat\) dont load the beaker if litmus is there [\#281](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/281) ([tphoney](https://github.com/tphoney))
48
+ - \(maint\) load rake tasks from optional libraries [\#279](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/279) ([DavidS](https://github.com/DavidS))
49
+ - Document how to set default values for fixture loading [\#277](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/277) ([Felixoid](https://github.com/Felixoid))
50
+
51
+ **Fixed bugs:**
52
+
53
+ - Remove `--color` from everywhere, use RSpec default detection instead [\#280](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/280) ([DavidS](https://github.com/DavidS))
54
+
55
+ **Merged pull requests:**
56
+
57
+ - \(MODULES-8771\) - Release Prep 2.14.0 [\#282](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/282) ([pmcmaw](https://github.com/pmcmaw))
58
+
59
+ ## [v2.13.1](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.13.1) (2019-01-15)
60
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.13.0...v2.13.1)
61
+
62
+ **Fixed bugs:**
63
+
64
+ - Revert "\(MODULES-8242\) - Fix CI\_SPEC\_OPTIONS failing" [\#275](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/275) ([rodjek](https://github.com/rodjek))
65
+
66
+ **Merged pull requests:**
67
+
68
+ - Release Prep 2.13.1 [\#276](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/276) ([bmjen](https://github.com/bmjen))
69
+
70
+ ## [v2.13.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.13.0) (2019-01-11)
71
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.12.0...v2.13.0)
72
+
73
+ **Implemented enhancements:**
74
+
75
+ - \(PDK-1199\) Honour .{pdk,git}ignore in check:symlinks rake task [\#267](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/267) ([rodjek](https://github.com/rodjek))
76
+ - \(PDK-1137\) Determine module name from metadata when possible [\#265](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/265) ([rodjek](https://github.com/rodjek))
77
+
78
+ **Fixed bugs:**
79
+
80
+ - \(MODULES-8242\) - Fix CI\_SPEC\_OPTIONS failing [\#268](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/268) ([stamm](https://github.com/stamm))
81
+ - \(PDK-997\) Remove Dir.chdir call from check:test\_file task [\#266](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/266) ([rodjek](https://github.com/rodjek))
82
+
83
+ **Merged pull requests:**
84
+
85
+ - \(MODULES-8448\) - Release Prep 2.13.0 [\#273](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/273) ([pmcmaw](https://github.com/pmcmaw))
86
+ - \(maint\) - Resolving bundler ruby version failure, updating tests to include puppet 6 [\#271](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/271) ([pmcmaw](https://github.com/pmcmaw))
87
+ - \(MAINT\) Add Plans Path Exclusion [\#270](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/270) ([RandomNoun7](https://github.com/RandomNoun7))
88
+
6
89
  ## [v2.12.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.12.0) (2018-11-08)
7
90
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.11.0...v2.12.0)
8
91
 
@@ -16,6 +99,10 @@ All significant changes to this repo will be summarized in this file.
16
99
  - \(bugfix\) ignore bundle directory, for symlinks [\#263](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/263) ([tphoney](https://github.com/tphoney))
17
100
  - \(MODULES-7273\) - Raise error when fixture ref invalid [\#262](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/262) ([eimlav](https://github.com/eimlav))
18
101
 
102
+ **Merged pull requests:**
103
+
104
+ - 2.12.0 Release Prep [\#264](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/264) ([tphoney](https://github.com/tphoney))
105
+
19
106
  ## [v2.11.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.11.0) (2018-09-26)
20
107
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.10.0...v2.11.0)
21
108
 
@@ -0,0 +1,2 @@
1
+ # Default owners.
2
+ * @puppetlabs/pdk @puppetlabs/modules
data/Gemfile CHANGED
@@ -1,24 +1,46 @@
1
- source 'https://rubygems.org'
1
+ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
+
3
+ def location_for(place_or_version, fake_version = nil)
4
+ git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5
+ file_url_regex = %r{\Afile:\/\/(?<path>.*)}
6
+
7
+ if place_or_version && (git_url = place_or_version.match(git_url_regex))
8
+ [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
9
+ elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
10
+ ['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
11
+ else
12
+ [place_or_version, { require: false }]
13
+ end
14
+ end
2
15
 
3
16
  # Specify the global dependencies in puppetlabs_spec_helper.gemspec
4
17
  # Note that only ruby 1.9 compatible dependencies may go there, everything else needs to be documented and pulled in manually, and optionally by everyone who wants to use the extended features.
5
18
  gemspec
6
19
 
20
+ def infer_puppet_version
21
+ # Infer the Puppet Gem version based on the Ruby Version
22
+ ruby_ver = Gem::Version.new(RUBY_VERSION.dup)
23
+ return '~> 6.0' if ruby_ver >= Gem::Version.new('2.5.0')
24
+ return '~> 5.0' if ruby_ver >= Gem::Version.new('2.4.0')
25
+ '~> 4.0'
26
+ end
27
+
7
28
  group :development do
8
29
  gem 'codecov'
9
30
  gem 'github_changelog_generator' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.0')
10
- gem 'puppet', ENV['PUPPET_GEM_VERSION'] || ENV['PUPPET_VERSION'] || '~> 4.0'
31
+ gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || ENV['PUPPET_VERSION'] || infer_puppet_version)
11
32
  gem 'simplecov', '~> 0'
12
33
  gem 'simplecov-console'
13
34
  if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
14
- gem 'rubocop', '< 0.50'
35
+ gem 'rubocop', '= 0.49'
15
36
  gem 'rubocop-rspec', '~> 1'
16
37
  end
17
38
  end
18
39
 
19
- # json_pure 2.0.2 added a requirement on ruby >= 2. We pin to json_pure 2.0.1
20
- # if using ruby 1.x
21
- gem 'json_pure', '<=2.0.1' if RUBY_VERSION =~ %r{^1\.}
22
- gem 'rack', '~> 1'
40
+ # pin some gems for older ruby versions
41
+ gem 'fakefs', '<= 0.13.3' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.4.0')
42
+ gem 'json_pure', '<=2.0.1' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
43
+ gem 'puppet-syntax', '<= 3' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.4.0')
44
+ gem 'rack', '~> 1' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.2.0')
23
45
 
24
46
  # vim:filetype=ruby
data/README.md CHANGED
@@ -59,7 +59,7 @@ Host github.com
59
59
 
60
60
  ```
61
61
 
62
- Note: parallel downloads is only available for repositories and not forge modules.
62
+ Note: parallel downloads are available for repositories and forge modules.
63
63
 
64
64
  ### Parallel tests
65
65
  It is also possible to use the `parallel_tests` Gem via the `:parallel_spec` Rake task to run rspec commands in parallel on groups of spec files.
@@ -156,7 +156,7 @@ variables for the spec run. These are:
156
156
  * ``TRUSTED_NODE_DATA`` _(Puppet 3.x, starting with 3.4)_ - set to "yes" to enable [the $facts hash and trusted node data](https://puppet.com/docs/puppet/3.8/lang_facts_and_builtin_vars.html#trusted-facts),
157
157
  which enabled ``$facts`` and ``$trusted`` hashes. This is equivalent to setting
158
158
  [trusted_node_data=true](https://puppet.com/docs/puppet/3.8/configuration.html#trustednodedata)
159
- in puppet.conf.
159
+ in puppet.conf.
160
160
  * ``STRINGIFY_FACTS`` _(Puppet 3.x, starting with 3.5)_ - set to "no" to enable [structured facts](http://docs.puppetlabs.com/facter/2.0/fact_overview.html#writing-structured-facts),
161
161
  otherwise leave unset to retain the current default behavior. This is equivalent to setting
162
162
  [stringify_facts=false](https://puppet.com/docs/puppet/3.8/configuration.html#stringifyfacts)
@@ -193,35 +193,38 @@ working directory is `/spec/fixtures/work-dir`.
193
193
 
194
194
  When specifying the repo source of the fixture you have a few options as to which revision of the codebase you wish to use, and optionally, the puppet versions where the fixture is needed.
195
195
 
196
- * repo - the url to the repo
197
- * scm - options include git or hg. This is an optional step as the helper code will figure out which scm is used.
196
+ * `repo` - the url to the repo
197
+ * `scm` - options include git or hg. This is an optional step as the helper code will figure out which scm is used.
198
198
 
199
199
  ```yaml
200
200
  scm: git
201
201
  scm: hg
202
202
  ```
203
203
 
204
- * target - the directory name to clone the repo into ie. `target: mymodule` defaults to the repo name (Optional)
205
- * subdir - directory to be removed from the cloned repo. Its contents will be moved to the root directory (Optional)
206
- * ref - used to specify the tag name like version hash of commit (Optional)
204
+ * `target` - the directory name to clone the repo into ie. `target: mymodule` defaults to the repo name (Optional)
205
+ * `subdir` - directory to be removed from the cloned repo. Its contents will be moved to the root directory (Optional)
206
+ * `ref` - used to specify the tag name (like version) or commit hash to be checked out (Optional). Branch names should use the `branch` option instead.
207
207
 
208
208
  ```yaml
209
209
  ref: 1.0.0
210
210
  ref: 880fca52c
211
211
  ```
212
- * branch - used to specify the branch name you want to use ie. `branch: development`
213
- * flags - additional flags passed to the module installer (both puppet and scm)
212
+ * `branch` - used to specify the branch name you want to use ie. `branch: development`
213
+ * `flags` - additional flags passed to the module installer (both puppet and scm)
214
214
 
215
215
  ```yaml
216
216
  flags: --verbose
217
217
  ```
218
- * puppet_version - versions of puppet for which the fixture should be installed. Ruby version constraints are supported. Only works when the `semantic_puppet` gem is available (shipped with puppet 4.0 and up, by default).
218
+ * `puppet_version` - versions of puppet for which the fixture should be installed. Ruby version constraints are supported. Only works when the `semantic_puppet` gem is available (shipped with puppet 4.0 and up, by default).
219
219
 
220
220
  ```yaml
221
221
  puppet_version: '>= 6.0.0'
222
222
  ```
223
223
 
224
- **Note:** ref and branch can be used together to get a specific revision on a specific branch
224
+ **Notes:**
225
+
226
+ * `ref` and `branch` can be used together to get a specific revision on a specific branch
227
+ * Top level `defaults` option could be used to set global options
225
228
 
226
229
  Fixtures Examples
227
230
  -----------------
@@ -257,7 +260,7 @@ fixtures:
257
260
  target: "spec/fixtures/control_repos"
258
261
  ```
259
262
 
260
- Specify that the git tag `2.4.2` of `stdlib' should be checked out:
263
+ Specify that the git tag `2.4.2` of `stdlib` should be checked out:
261
264
 
262
265
  ```yaml
263
266
  fixtures:
@@ -315,6 +318,23 @@ fixtures:
315
318
  flags: "--verbose"
316
319
  ```
317
320
 
321
+ Use `defaults` to define global parameters:
322
+
323
+ ```yaml
324
+ defaults:
325
+ forge_modules:
326
+ flags: "--module_repository https://my_repo.com"
327
+ fixtures:
328
+ forge_modules:
329
+ stdlib:
330
+ repo: "puppetlabs/stdlib"
331
+ ref: "2.6.0"
332
+ repositories:
333
+ firewall:
334
+ repo: "git://github.com/puppetlabs/puppetlabs-firewall"
335
+ ref: "2.6.0"
336
+ ```
337
+
318
338
  Testing Parser Functions
319
339
  ========================
320
340
 
@@ -369,7 +389,7 @@ environment variable``TEST_TIERS=high,medium``
369
389
 
370
390
  By default ``TEST_TIERS`` only accepts low, medium and high as valid tiers. If you would like to use your own keywords to set the environment variable ``TEST_TIERS_ALLOWED``.
371
391
 
372
- For example: to use the keywords dev, rnd, staging and production you can set
392
+ For example: to use the keywords dev, rnd, staging and production you can set
373
393
  ``TEST_TIERS_ALLOWED=dev,rnd,staging,production``. Then you would be able to run tests marked ``tier_dev => true``, ``tier_production => true`` with ``TEST_TIERS=dev,production``
374
394
 
375
395
  Note, if the ``TEST_TIERS`` environment variable is set to empty string or nil, all tiers will be executed.
@@ -396,34 +416,7 @@ You can enable it, set the following environment variable:s
396
416
 
397
417
  ``SIMPLECOV=yes``
398
418
 
399
- Remember to add the simplecov-console and codecov gems to your `Gemfile`.
400
-
401
- Using Coveralls
402
- ---------------
403
-
404
- You can also use [Coveralls](https://coveralls.io/) together with SimpleCov:
405
-
406
- ```Ruby
407
- # First line of spec/spec_helper.rb
408
- require 'simplecov'
409
- require 'coveralls'
410
-
411
- SimpleCov.formatters = [
412
- SimpleCov::Formatter::HTMLFormatter,
413
- Coveralls::SimpleCov::Formatter
414
- ]
415
-
416
- SimpleCov.start do
417
- add_filter '/spec/'
418
- # Exclude bundled Gems in `/.vendor/`
419
- add_filter '/.vendor/'
420
- end
421
-
422
- require 'puppetlabs_spec_helper/module_spec_helper'
423
- # Further content
424
- ```
425
-
426
- Remember to add `gem 'coveralls', require: false` to your `Gemfile`.
419
+ Remember to add the simplecov-console and codecov gems to your `Gemfile`. If you run `spec:simplecov` on Travis-CI or any of the other supported CI services, reports gets automatically uploaded to https://codecov.io/ .
427
420
 
428
421
  Some Notes for Windows Users
429
422
  ============================
@@ -6,6 +6,7 @@ require 'pathname'
6
6
  require 'puppetlabs_spec_helper/version'
7
7
  require 'puppetlabs_spec_helper/tasks/beaker'
8
8
  require 'puppetlabs_spec_helper/tasks/fixtures'
9
+ require 'puppetlabs_spec_helper/tasks/check_symlinks'
9
10
  require 'English'
10
11
 
11
12
  # optional gems
@@ -15,6 +16,24 @@ rescue LoadError
15
16
  # ignore
16
17
  end
17
18
 
19
+ begin
20
+ require 'puppet_blacksmith/rake_tasks'
21
+ rescue LoadError
22
+ # ignore
23
+ end
24
+
25
+ begin
26
+ require 'github_changelog_generator/task'
27
+ rescue LoadError
28
+ # ignore
29
+ end
30
+
31
+ begin
32
+ require 'puppet-strings/tasks'
33
+ rescue LoadError
34
+ # ignore
35
+ end
36
+
18
37
  parallel_tests_loaded = false
19
38
  begin
20
39
  require 'parallel_tests'
@@ -28,7 +47,7 @@ task default: [:help]
28
47
  pattern = 'spec/{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit}/**/*_spec.rb'
29
48
 
30
49
  RSpec::Core::RakeTask.new(:spec_standalone) do |t, args|
31
- t.rspec_opts = ['--color']
50
+ t.rspec_opts = []
32
51
  t.rspec_opts << ENV['CI_SPEC_OPTIONS'] unless ENV['CI_SPEC_OPTIONS'].nil?
33
52
  if ENV['CI_NODE_TOTAL'] && ENV['CI_NODE_INDEX']
34
53
  ci_total = ENV['CI_NODE_TOTAL'].to_i
@@ -123,6 +142,7 @@ namespace :build do
123
142
  desc 'Build Puppet module with PDK'
124
143
  task :pdk do
125
144
  begin
145
+ require 'pdk/util'
126
146
  require 'pdk/module/build'
127
147
 
128
148
  path = PDK::Module::Build.invoke(:force => true, :'target-dir' => File.join(Dir.pwd, 'pkg'))
@@ -201,6 +221,8 @@ PuppetSyntax.exclude_paths ||= []
201
221
  PuppetSyntax.exclude_paths << 'spec/fixtures/**/*'
202
222
  PuppetSyntax.exclude_paths << 'pkg/**/*'
203
223
  PuppetSyntax.exclude_paths << 'vendor/**/*'
224
+ PuppetSyntax.exclude_paths << '.vendor/**/*'
225
+ PuppetSyntax.exclude_paths << 'plans/**/*'
204
226
  if Puppet.version.to_f < 4.0
205
227
  PuppetSyntax.exclude_paths << 'types/**/*'
206
228
  end
@@ -284,7 +306,7 @@ end
284
306
  namespace :check do
285
307
  desc 'Fails if symlinks are present in directory'
286
308
  task :symlinks do
287
- symlinks = check_directory_for_symlinks
309
+ symlinks = PuppetlabsSpecHelper::Tasks::CheckSymlinks.new.check
288
310
  unless symlinks.empty?
289
311
  symlinks.each { |r| puts "Symlink found: #{r} => #{r.readlink}" }
290
312
  raise 'Symlink(s) exist within this directory'
@@ -293,13 +315,10 @@ namespace :check do
293
315
 
294
316
  desc 'Fails if .pp files present in tests folder'
295
317
  task :test_file do
296
- if Dir.exist?('tests')
297
- Dir.chdir('tests')
298
- ppfiles = Dir['*.pp']
299
- unless ppfiles.empty?
300
- puts ppfiles
301
- raise '.pp files present in tests folder; Move them to an examples folder following the new convention'
302
- end
318
+ ppfiles = Dir[File.join('tests', '**', '*.pp')]
319
+ unless ppfiles.empty?
320
+ puts ppfiles
321
+ raise '.pp files present in tests folder; Move them to an examples folder following the new convention'
303
322
  end
304
323
  end
305
324
 
@@ -350,7 +369,7 @@ if File.exist? locales_dir
350
369
  spec = Gem::Specification.find_by_name 'gettext-setup'
351
370
  load "#{spec.gem_dir}/lib/tasks/gettext.rake"
352
371
  # Initialization requires a valid locales directory
353
- GettextSetup.initialize_config(locales_dir)
372
+ GettextSetup.initialize(locales_dir)
354
373
  namespace :module do
355
374
  desc 'Runs all tasks to build a modules POT file for internationalization'
356
375
  task :pot_gen do
@@ -362,3 +381,79 @@ if File.exist? locales_dir
362
381
  puts 'No gettext-setup gem found, skipping GettextSetup config initialization' if Rake.verbose == true
363
382
  end
364
383
  end
384
+
385
+ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_since_tag = nil, changelog_tag_pattern = 'v%s')
386
+ if Bundler.rubygems.find_name('github_changelog_generator').any?
387
+ # needed a place to hide these methods
388
+ # rubocop:disable Lint/NestedMethodDefinition
389
+ def changelog_user_from_metadata
390
+ result = JSON.parse(File.read('metadata.json'))['author']
391
+ raise 'unable to find the changelog_user in .sync.yml, or the author in metadata.json' if result.nil?
392
+ puts "GitHubChangelogGenerator user:#{result}"
393
+ result
394
+ end
395
+
396
+ def changelog_project_from_metadata
397
+ result = JSON.parse(File.read('metadata.json'))['name']
398
+ raise 'unable to find the changelog_project in .sync.yml or the name in metadata.json' if result.nil?
399
+ puts "GitHubChangelogGenerator project:#{result}"
400
+ result
401
+ end
402
+
403
+ def changelog_future_release
404
+ return unless Rake.application.top_level_tasks.include? 'changelog'
405
+ result = JSON.parse(File.read('metadata.json'))['version']
406
+ raise 'unable to find the future_release (version) in metadata.json' if result.nil?
407
+ puts "GitHubChangelogGenerator future_release:#{result}"
408
+ result
409
+ end
410
+ # rubocop:enable Lint/NestedMethodDefinition
411
+
412
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
413
+ if ENV['CHANGELOG_GITHUB_TOKEN'].nil?
414
+ raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'"
415
+ end
416
+ config.user = changelog_user || changelog_user_from_metadata
417
+ config.project = changelog_project || changelog_project_from_metadata
418
+ config.since_tag = changelog_since_tag if changelog_since_tag
419
+ config.future_release = changelog_tag_pattern % changelog_future_release.to_s
420
+ config.exclude_labels = ['maintenance']
421
+ config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. " \
422
+ 'The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres ' \
423
+ 'to [Semantic Versioning](https://semver.org).'
424
+ config.add_pr_wo_labels = true
425
+ config.issues = false
426
+ config.merge_prefix = '### UNCATEGORIZED PRS; GO LABEL THEM'
427
+ config.configure_sections = {
428
+ 'Changed' => {
429
+ 'prefix' => '### Changed',
430
+ 'labels' => ['backwards-incompatible'],
431
+ },
432
+ 'Added' => {
433
+ 'prefix' => '### Added',
434
+ 'labels' => %w[feature enhancement],
435
+ },
436
+ 'Fixed' => {
437
+ 'prefix' => '### Fixed',
438
+ 'labels' => ['bugfix'],
439
+ },
440
+ }
441
+ end
442
+ else
443
+ desc 'Generate a Changelog from GitHub'
444
+ task :changelog do
445
+ raise <<EOM
446
+ The changelog tasks depends on unreleased features of the github_changelog_generator gem.
447
+ Please manually add it to your .sync.yml for now, and run `pdk update`:
448
+ ---
449
+ Gemfile:
450
+ optional:
451
+ ':development':
452
+ - gem: 'github_changelog_generator'
453
+ git: 'https://github.com/skywinder/github-changelog-generator'
454
+ ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
455
+ condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
456
+ EOM
457
+ end
458
+ end
459
+ end
@@ -59,7 +59,7 @@ end
59
59
 
60
60
  class SetupBeaker
61
61
  def self.setup_beaker(t)
62
- t.rspec_opts = ['--color']
62
+ t.rspec_opts = []
63
63
  t.pattern = 'spec/acceptance'
64
64
  # TEST_TIERS env variable is a comma separated list of tiers to run. e.g. low, medium, high
65
65
  if ENV['TEST_TIERS']
@@ -0,0 +1,49 @@
1
+ require 'pathspec'
2
+
3
+ module PuppetlabsSpecHelper; end
4
+ module PuppetlabsSpecHelper::Tasks; end
5
+
6
+ class PuppetlabsSpecHelper::Tasks::CheckSymlinks
7
+ DEFAULT_IGNORED = [
8
+ '/.git/',
9
+ '/.bundle/',
10
+ '/vendor/',
11
+ ].freeze
12
+
13
+ IGNORE_LIST_FILES = [
14
+ '.pdkignore',
15
+ '.gitignore',
16
+ ].freeze
17
+
18
+ def check(dir = Dir.pwd)
19
+ dir = Pathname.new(dir) unless dir.is_a?(Pathname)
20
+ results = []
21
+
22
+ dir.each_child(true) do |child|
23
+ next if ignored?(child.to_s)
24
+
25
+ if child.symlink?
26
+ results << child
27
+ elsif child.directory? && child.basename.to_s !~ %r{^(\.git|\.?bundle)$}
28
+ results.concat(check(child))
29
+ end
30
+ end
31
+
32
+ results
33
+ end
34
+
35
+ def ignored?(path)
36
+ path = path.to_s + '/' if File.directory?(path)
37
+
38
+ !ignore_pathspec.match_paths([path], Dir.pwd).empty?
39
+ end
40
+
41
+ def ignore_pathspec
42
+ @ignore_pathspec ||= PathSpec.new(DEFAULT_IGNORED).tap do |pathspec|
43
+ IGNORE_LIST_FILES.each do |f|
44
+ next unless File.file?(f) && File.readable?(f)
45
+ File.open(f, 'r') { |fd| pathspec.add(fd) }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,24 +1,61 @@
1
1
  require 'yaml'
2
2
  require 'open3'
3
+ require 'json'
3
4
 
4
5
  module PuppetlabsSpecHelper; end
5
6
  module PuppetlabsSpecHelper::Tasks; end
7
+
6
8
  module PuppetlabsSpecHelper::Tasks::FixtureHelpers
7
9
  # This is a helper for the self-symlink entry of fixtures.yml
8
10
  def source_dir
9
11
  Dir.pwd
10
12
  end
11
13
 
12
- # cache the repositories and return a hash object
14
+ # @return [String] - the name of current module
15
+ def module_name
16
+ raise ArgumentError unless File.file?('metadata.json') && File.readable?('metadata.json')
17
+
18
+ metadata = JSON.parse(File.read('metadata.json'))
19
+ metadata_name = metadata.fetch('name', nil) || ''
20
+
21
+ raise ArgumentError if metadata_name.empty?
22
+
23
+ metadata_name.split('-').last
24
+ rescue JSON::ParserError, ArgumentError
25
+ File.basename(Dir.pwd).split('-').last
26
+ end
27
+
28
+ # @return [Hash] - returns a hash of all the fixture repositories
29
+ # @example
30
+ # {"puppetlabs-stdlib"=>{"target"=>"https://gitlab.com/puppetlabs/puppet-stdlib.git",
31
+ # "ref"=>nil, "branch"=>"master", "scm"=>nil,
32
+ # }}
13
33
  def repositories
14
- unless @repositories
15
- @repositories = fixtures('repositories')
16
- end
17
- @repositories
34
+ @repositories ||= fixtures('repositories') || {}
35
+ end
36
+
37
+ # @return [Hash] - returns a hash of all the fixture forge modules
38
+ # @example
39
+ # {"puppetlabs-stdlib"=>{"target"=>"spec/fixtures/modules/stdlib",
40
+ # "ref"=>nil, "branch"=>nil, "scm"=>nil,
41
+ # "flags"=>"--module_repository=https://myforge.example.com/", "subdir"=>nil}}
42
+ def forge_modules
43
+ @forge_modules ||= fixtures('forge_modules') || {}
44
+ end
45
+
46
+ # @return [Hash] - a hash of symlinks specified in the fixtures file
47
+ def symlinks
48
+ @symlinks ||= fixtures('symlinks') || {}
18
49
  end
19
50
 
51
+ # @return [Hash] - returns a hash with the module name and the source directory
20
52
  def auto_symlink
21
- { File.basename(Dir.pwd).split('-').last => '#{source_dir}' }
53
+ { module_name => '#{source_dir}' }
54
+ end
55
+
56
+ # @return [Boolean] - true if the os is a windows system
57
+ def windows?
58
+ !!File::ALT_SEPARATOR
22
59
  end
23
60
 
24
61
  def fixtures(category)
@@ -63,7 +100,6 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
63
100
 
64
101
  result = {}
65
102
  if fixtures.include?(category) && !fixtures[category].nil?
66
-
67
103
  defaults = { 'target' => 'spec/fixtures/modules' }
68
104
 
69
105
  # load defaults from the `.fixtures.yml` `defaults` section
@@ -89,19 +125,29 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
89
125
  real_target = eval('"' + opts['target'] + '"')
90
126
  real_source = eval('"' + opts['repo'] + '"')
91
127
 
92
- result[real_source] = {
128
+ result[real_source] = validate_fixture_hash!(
93
129
  'target' => File.join(real_target, fixture),
94
- 'ref' => opts['ref'],
130
+ 'ref' => opts['ref'] || opts['tag'],
95
131
  'branch' => opts['branch'],
96
- 'scm' => opts['scm'],
97
- 'flags' => opts['flags'],
132
+ 'scm' => opts['scm'],
133
+ 'flags' => opts['flags'],
98
134
  'subdir' => opts['subdir'],
99
- }
135
+ )
100
136
  end
101
137
  end
102
138
  result
103
139
  end
104
140
 
141
+ def validate_fixture_hash!(hash)
142
+ # Can only validate git based scm
143
+ return hash unless hash['scm'] == 'git'
144
+
145
+ # Forward slashes in the ref aren't allowed. And is probably a branch name.
146
+ raise ArgumentError, "The ref for #{hash['target']} is invalid (Contains a forward slash). If this is a branch name, please use the 'branch' setting instead." if hash['ref'] =~ %r{\/}
147
+
148
+ hash
149
+ end
150
+
105
151
  def include_repo?(version_range)
106
152
  if version_range && defined?(SemanticPuppet)
107
153
  puppet_spec = Gem::Specification.find_by_name('puppet')
@@ -221,6 +267,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
221
267
  # returns the current thread count that is currently active
222
268
  # a status of false or nil means the thread completed
223
269
  # so when anything else we count that as a active thread
270
+ # @return [Integer] - current thread count
224
271
  def current_thread_count(items)
225
272
  active_threads = items.find_all do |_item, opts|
226
273
  if opts[:thread]
@@ -233,55 +280,61 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
233
280
  active_threads.count
234
281
  end
235
282
 
236
- # returns the max_thread_count
237
- # because we may want to limit ssh or https connections
283
+ # @summary Set a limit on the amount threads used, defaults to 10
284
+ # MAX_FIXTURE_THREAD_COUNT can be used to set this limit
285
+ # @return [Integer] - returns the max_thread_count
238
286
  def max_thread_limit
239
- unless @max_thread_limit
240
- # the default thread count is 10 but can be
241
- # raised by using environment variable MAX_FIXTURE_THREAD_COUNT
242
- @max_thread_limit = if ENV['MAX_FIXTURE_THREAD_COUNT'].to_i > 0
243
- ENV['MAX_FIXTURE_THREAD_COUNT'].to_i
244
- else
245
- 10 # the default
246
- end
247
- end
248
- @max_thread_limit
287
+ @max_thread_limit ||= (ENV['MAX_FIXTURE_THREAD_COUNT'] || 10).to_i
249
288
  end
250
289
 
251
- def check_directory_for_symlinks(dir = '.')
252
- dir = Pathname.new(dir) unless dir.is_a?(Pathname)
253
- results = []
254
-
255
- dir.each_child(true) do |child|
256
- if child.symlink?
257
- results << child
258
- elsif child.directory? && child.basename.to_s !~ %r{(^\.git$|^\.?bundle$)}
259
- results.concat(check_directory_for_symlinks(child))
290
+ # @param items [Hash] - a hash of either repositories or forge modules
291
+ # @param [Block] - the method you wish to use to download the item
292
+ def download_items(items)
293
+ items.each do |remote, opts|
294
+ # get the current active threads that are alive
295
+ count = current_thread_count(items)
296
+ if count < max_thread_limit
297
+ logger.debug "New Thread started for #{remote}"
298
+ # start up a new thread and store it in the opts hash
299
+ opts[:thread] = Thread.new do
300
+ yield(remote, opts)
301
+ end
302
+ else
303
+ # the last thread started should be the longest wait
304
+ item, item_opts = items.find_all { |_i, o| o.key?(:thread) }.last
305
+ logger.debug "Waiting on #{item}"
306
+ item_opts[:thread].join # wait for the thread to finish
307
+ # now that we waited lets try again
308
+ redo
260
309
  end
261
310
  end
262
-
263
- results
311
+ # wait for all the threads to finish
312
+ items.each { |_remote, opts| opts[:thread].join }
264
313
  end
265
- end
266
- include PuppetlabsSpecHelper::Tasks::FixtureHelpers
267
314
 
268
- desc 'Create the fixtures directory'
269
- task :spec_prep do
270
- # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library
271
- # uses this to check for Windows
272
- is_windows = !!File::ALT_SEPARATOR
273
- if is_windows
274
- begin
275
- require 'win32/dir'
276
- rescue LoadError
277
- $stderr.puts 'win32-dir gem not installed, falling back to executing mklink directly'
315
+ # @param target [String] - the target directory
316
+ # @param link [String] - the name of the link you wish to create
317
+ # works on windows and linux
318
+ def setup_symlink(target, link)
319
+ link = link['target']
320
+ return if File.symlink?(link)
321
+ logger.info("Creating symlink from #{link} to #{target}")
322
+ if windows?
323
+ target = File.join(File.dirname(link), target) unless Pathname.new(target).absolute?
324
+ if Dir.respond_to?(:create_junction)
325
+ Dir.create_junction(link, target)
326
+ else
327
+ system("call mklink /J \"#{link.tr('/', '\\')}\" \"#{target.tr('/', '\\')}\"")
328
+ end
329
+ else
330
+ FileUtils.ln_sf(target, link)
278
331
  end
279
332
  end
280
333
 
281
- # git has a race condition creating that directory, that would lead to aborted clone operations
282
- FileUtils.mkdir_p('spec/fixtures/modules')
283
-
284
- repositories.each do |remote, opts|
334
+ # @return [Boolean] - returns true if the module was downloaded successfully, false otherwise
335
+ # @param [String] - the remote url or namespace/name of the module to download
336
+ # @param [Hash] - list of options such as version, branch, ref
337
+ def download_repository(remote, opts)
285
338
  scm = 'git'
286
339
  target = opts['target']
287
340
  subdir = opts['subdir']
@@ -289,50 +342,24 @@ task :spec_prep do
289
342
  scm = opts['scm'] if opts['scm']
290
343
  branch = opts['branch'] if opts['branch']
291
344
  flags = opts['flags']
292
- # get the current active threads that are alive
293
- count = current_thread_count(repositories)
294
- if count < max_thread_limit
295
- logger.debug "New Thread started for #{remote}"
296
- # start up a new thread and store it in the opts hash
297
- opts[:thread] = Thread.new do
298
- if valid_repo?(scm, target, remote)
299
- update_repo(scm, target)
300
- else
301
- clone_repo(scm, remote, target, subdir, ref, branch, flags)
302
- end
303
- revision(scm, target, ref) if ref
304
- remove_subdirectory(target, subdir) if subdir
305
- end
345
+ if valid_repo?(scm, target, remote)
346
+ update_repo(scm, target)
306
347
  else
307
- # the last thread started should be the longest wait
308
- item, item_opts = repositories.find_all { |_i, o| o.key?(:thread) }.last
309
- logger.debug "Waiting on #{item}"
310
- item_opts[:thread].join # wait for the thread to finish
311
- # now that we waited lets try again
312
- redo
348
+ clone_repo(scm, remote, target, subdir, ref, branch, flags)
313
349
  end
350
+ revision(scm, target, ref) if ref
351
+ remove_subdirectory(target, subdir) if subdir
314
352
  end
315
353
 
316
- # wait for all the threads to finish
317
- repositories.each { |_remote, opts| opts[:thread].join }
318
-
319
- fixtures('symlinks').each do |target, link|
320
- link = link['target']
321
- next if File.symlink?(link)
322
- logger.info("Creating symlink from #{link} to #{target}")
323
- if is_windows
324
- target = File.join(File.dirname(link), target) unless Pathname.new(target).absolute?
325
- if Dir.respond_to?(:create_junction)
326
- Dir.create_junction(link, target)
327
- else
328
- system("call mklink /J \"#{link.tr('/', '\\')}\" \"#{target.tr('/', '\\')}\"")
329
- end
330
- else
331
- FileUtils.ln_sf(target, link)
332
- end
354
+ # @return [String] - the spec/fixtures/modules directory in the module root folder
355
+ def module_target_dir
356
+ @module_target_dir ||= File.expand_path('spec/fixtures/modules')
333
357
  end
334
358
 
335
- fixtures('forge_modules').each do |remote, opts|
359
+ # @return [Boolean] - returns true if the module was downloaded successfully, false otherwise
360
+ # @param [String] - the remote url or namespace/name of the module to download
361
+ # @param [Hash] - list of options such as version
362
+ def download_module(remote, opts)
336
363
  ref = ''
337
364
  flags = ''
338
365
  if opts.instance_of?(String)
@@ -343,34 +370,60 @@ task :spec_prep do
343
370
  flags = " #{opts['flags']}" if opts['flags']
344
371
  end
345
372
 
346
- next if File.directory?(target)
373
+ return false if File.directory?(target)
347
374
 
348
- working_dir = module_working_directory
349
- target_dir = File.expand_path('spec/fixtures/modules')
375
+ # The PMT cannot handle multi threaded runs due to cache directory collisons
376
+ # so we randomize the directory instead.
377
+ # Does working_dir even need to be passed?
378
+ Dir.mktmpdir do |working_dir|
379
+ command = 'puppet module install' + ref + flags + ' --ignore-dependencies' \
380
+ ' --force' \
381
+ " --module_working_dir \"#{working_dir}\"" \
382
+ " --target-dir \"#{module_target_dir}\" \"#{remote}\""
350
383
 
351
- command = 'puppet module install' + ref + flags + \
352
- ' --ignore-dependencies' \
353
- ' --force' \
354
- " --module_working_dir \"#{working_dir}\"" \
355
- " --target-dir \"#{target_dir}\" \"#{remote}\""
384
+ unless system(command)
385
+ raise "Failed to install module #{remote} to #{module_target_dir}"
386
+ end
387
+ end
388
+ $CHILD_STATUS.success?
389
+ end
390
+ end
391
+
392
+ include PuppetlabsSpecHelper::Tasks::FixtureHelpers
356
393
 
357
- unless system(command)
358
- raise "Failed to install module #{remote} to #{target_dir}"
394
+ desc 'Create the fixtures directory'
395
+ task :spec_prep do
396
+ # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library
397
+ # uses this to check for Windows
398
+ if windows?
399
+ begin
400
+ require 'win32/dir'
401
+ rescue LoadError
402
+ $stderr.puts 'win32-dir gem not installed, falling back to executing mklink directly'
359
403
  end
360
404
  end
361
405
 
406
+ # git has a race condition creating that directory, that would lead to aborted clone operations
407
+ FileUtils.mkdir_p('spec/fixtures/modules')
408
+
409
+ symlinks.each { |target, link| setup_symlink(target, link) }
410
+
411
+ download_items(repositories) { |remote, opts| download_repository(remote, opts) }
412
+
413
+ download_items(forge_modules) { |remote, opts| download_module(remote, opts) }
414
+
362
415
  FileUtils.mkdir_p('spec/fixtures/manifests')
363
416
  FileUtils.touch('spec/fixtures/manifests/site.pp')
364
417
  end
365
418
 
366
419
  desc 'Clean up the fixtures directory'
367
420
  task :spec_clean do
368
- fixtures('repositories').each do |_remote, opts|
421
+ repositories.each do |_remote, opts|
369
422
  target = opts['target']
370
423
  FileUtils.rm_rf(target)
371
424
  end
372
425
 
373
- fixtures('forge_modules').each do |_remote, opts|
426
+ forge_modules.each do |_remote, opts|
374
427
  target = opts['target']
375
428
  FileUtils.rm_rf(target)
376
429
  end
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = '2.12.0'.freeze
2
+ VERSION = '2.15.0'.freeze
3
3
 
4
4
  # compat for pre-1.2.0 users; deprecated
5
5
  module Version
@@ -22,14 +22,16 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_runtime_dependency 'mocha', '~> 1.0'
24
24
  spec.add_runtime_dependency 'puppet-lint', '~> 2.0'
25
- spec.add_runtime_dependency 'puppet-syntax', '~> 2.0'
25
+ spec.add_runtime_dependency 'puppet-syntax', ['>= 2.0', '< 4']
26
26
  spec.add_runtime_dependency 'rspec-puppet', '~> 2.0'
27
+ spec.add_runtime_dependency 'pathspec', '~> 0.2.1'
27
28
 
28
- spec.add_development_dependency 'bundler', '~> 1.12'
29
+ spec.add_development_dependency 'bundler'
29
30
  spec.add_development_dependency 'pry'
30
31
  spec.add_development_dependency 'puppet'
31
- spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'rake', ['>= 10.0', '< 14']
32
33
  spec.add_development_dependency 'rspec', '~> 3.0'
33
34
  spec.add_development_dependency 'yard'
34
35
  spec.add_development_dependency 'gettext-setup', '~> 0.29'
36
+ spec.add_development_dependency 'fakefs', ['>= 0.13.3', '< 2']
35
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetlabs_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-11-08 00:00:00.000000000 Z
12
+ date: 2020-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -43,16 +43,22 @@ dependencies:
43
43
  name: puppet-syntax
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.0'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '4'
49
52
  type: :runtime
50
53
  prerelease: false
51
54
  version_requirements: !ruby/object:Gem::Requirement
52
55
  requirements:
53
- - - "~>"
56
+ - - ">="
54
57
  - !ruby/object:Gem::Version
55
58
  version: '2.0'
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '4'
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: rspec-puppet
58
64
  requirement: !ruby/object:Gem::Requirement
@@ -68,19 +74,33 @@ dependencies:
68
74
  - !ruby/object:Gem::Version
69
75
  version: '2.0'
70
76
  - !ruby/object:Gem::Dependency
71
- name: bundler
77
+ name: pathspec
72
78
  requirement: !ruby/object:Gem::Requirement
73
79
  requirements:
74
80
  - - "~>"
75
81
  - !ruby/object:Gem::Version
76
- version: '1.12'
77
- type: :development
82
+ version: 0.2.1
83
+ type: :runtime
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
80
86
  requirements:
81
87
  - - "~>"
82
88
  - !ruby/object:Gem::Version
83
- version: '1.12'
89
+ version: 0.2.1
90
+ - !ruby/object:Gem::Dependency
91
+ name: bundler
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
84
104
  - !ruby/object:Gem::Dependency
85
105
  name: pry
86
106
  requirement: !ruby/object:Gem::Requirement
@@ -113,16 +133,22 @@ dependencies:
113
133
  name: rake
114
134
  requirement: !ruby/object:Gem::Requirement
115
135
  requirements:
116
- - - "~>"
136
+ - - ">="
117
137
  - !ruby/object:Gem::Version
118
138
  version: '10.0'
139
+ - - "<"
140
+ - !ruby/object:Gem::Version
141
+ version: '14'
119
142
  type: :development
120
143
  prerelease: false
121
144
  version_requirements: !ruby/object:Gem::Requirement
122
145
  requirements:
123
- - - "~>"
146
+ - - ">="
124
147
  - !ruby/object:Gem::Version
125
148
  version: '10.0'
149
+ - - "<"
150
+ - !ruby/object:Gem::Version
151
+ version: '14'
126
152
  - !ruby/object:Gem::Dependency
127
153
  name: rspec
128
154
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +191,26 @@ dependencies:
165
191
  - - "~>"
166
192
  - !ruby/object:Gem::Version
167
193
  version: '0.29'
194
+ - !ruby/object:Gem::Dependency
195
+ name: fakefs
196
+ requirement: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: 0.13.3
201
+ - - "<"
202
+ - !ruby/object:Gem::Version
203
+ version: '2'
204
+ type: :development
205
+ prerelease: false
206
+ version_requirements: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: 0.13.3
211
+ - - "<"
212
+ - !ruby/object:Gem::Version
213
+ version: '2'
168
214
  description: Contains rake tasks and a standard spec_helper for running spec tests
169
215
  on puppet modules.
170
216
  email:
@@ -180,6 +226,7 @@ files:
180
226
  - ".rubocop_todo.yml"
181
227
  - ".travis.yml"
182
228
  - CHANGELOG.md
229
+ - CODEOWNERS
183
230
  - CONTRIBUTING.md
184
231
  - Gemfile
185
232
  - HISTORY.md
@@ -195,6 +242,7 @@ files:
195
242
  - lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb
196
243
  - lib/puppetlabs_spec_helper/rake_tasks.rb
197
244
  - lib/puppetlabs_spec_helper/tasks/beaker.rb
245
+ - lib/puppetlabs_spec_helper/tasks/check_symlinks.rb
198
246
  - lib/puppetlabs_spec_helper/tasks/fixtures.rb
199
247
  - lib/puppetlabs_spec_helper/version.rb
200
248
  - puppet_spec_helper.rb
@@ -220,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
268
  version: '0'
221
269
  requirements: []
222
270
  rubyforge_project:
223
- rubygems_version: 2.6.14.1
271
+ rubygems_version: 2.7.8
224
272
  signing_key:
225
273
  specification_version: 4
226
274
  summary: Standard tasks and configuration for module spec tests.