puppetlabs_spec_helper 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45bf89e508fd4e7455ff251a5aa2743007ffe4f3
4
- data.tar.gz: 9152f0a0445f9ddeb10555e35ab1b5e29f138aff
3
+ metadata.gz: ad8505aa8fe7098a8d93aad0c4afda481d0e3512
4
+ data.tar.gz: 1190981ff63c6ceabc641ea537264ffde1a8097c
5
5
  SHA512:
6
- metadata.gz: 1446edba63e86631ea5cc121440e92834ea150a59df692d445d3c4225b10d8141a0e662acb457b44e4ce3c7892e1342dbdd4b8b6436117bbd67dd1fd25d2809b
7
- data.tar.gz: 6ab7060e156d08fbaf6e15e54fa3d670c39ae05d0ab8bb844014e41d03fbb88d1b08d55141b2265e1995b6597175b9f05f02460557b0975568eae62b9c616542
6
+ metadata.gz: 836edb5dabb80f1f5b3f98581ed07123fe5f77996ba84a4199bd7d2b59109b42e59b8ec94115d05ea0e9c27d3d39b24c70163faf809ac4d22d0f56f01bf357b1
7
+ data.tar.gz: 2801e062d093770f274a69c44e3c7414f562ec7144c228a88eaf9c74d6b87aaad55a9cae33a2dadcebb2d8db6c6ebd68101227a12d6a40cf6dc5c9789bc78d25
@@ -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:
@@ -2,12 +2,17 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  before_install:
5
- # https://github.com/bundler/bundler/issues/3558
6
- gem update bundler
5
+ bundle -v
7
6
  script: env COVERAGE=yes bundle exec rake
8
7
  matrix:
9
8
  fast_finish: true
10
9
  include:
10
+ - rvm: '2.5'
11
+ env: PUPPET_GEM_VERSION='~> 6.0'
12
+ - rvm: '2.4'
13
+ env: PUPPET_GEM_VERSION='~> 6.0'
14
+ - rvm: '2.3'
15
+ env: PUPPET_GEM_VERSION='~> 6.0'
11
16
  - rvm: '2.4'
12
17
  env: PUPPET_GEM_VERSION='~> 5.0'
13
18
  - rvm: '2.3'
@@ -3,6 +3,24 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v2.13.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.13.0) (2019-01-11)
7
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.12.0...v2.13.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - \(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))
12
+ - \(PDK-1137\) Determine module name from metadata when possible [\#265](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/265) ([rodjek](https://github.com/rodjek))
13
+
14
+ **Fixed bugs:**
15
+
16
+ - \(MODULES-8242\) - Fix CI\_SPEC\_OPTIONS failing [\#268](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/268) ([stamm](https://github.com/stamm))
17
+ - \(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))
18
+
19
+ **Merged pull requests:**
20
+
21
+ - \(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))
22
+ - \(MAINT\) Add Plans Path Exclusion [\#270](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/270) ([RandomNoun7](https://github.com/RandomNoun7))
23
+
6
24
  ## [v2.12.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.12.0) (2018-11-08)
7
25
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.11.0...v2.12.0)
8
26
 
@@ -16,6 +34,10 @@ All significant changes to this repo will be summarized in this file.
16
34
  - \(bugfix\) ignore bundle directory, for symlinks [\#263](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/263) ([tphoney](https://github.com/tphoney))
17
35
  - \(MODULES-7273\) - Raise error when fixture ref invalid [\#262](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/262) ([eimlav](https://github.com/eimlav))
18
36
 
37
+ **Merged pull requests:**
38
+
39
+ - 2.12.0 Release Prep [\#264](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/264) ([tphoney](https://github.com/tphoney))
40
+
19
41
  ## [v2.11.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.11.0) (2018-09-26)
20
42
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.10.0...v2.11.0)
21
43
 
@@ -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
@@ -94,8 +95,8 @@ task :parallel_spec_standalone do |_t, args|
94
95
  else
95
96
  begin
96
97
  args = ['-t', 'rspec']
97
- args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split(' ')).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
98
- args.concat(Rake::FileList[pattern].to_a)
98
+ args += ENV['CI_SPEC_OPTIONS'].strip.split(' ') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
99
+ args += Rake::FileList[pattern].to_a
99
100
 
100
101
  ParallelTests::CLI.new.run(args)
101
102
  end
@@ -201,6 +202,7 @@ PuppetSyntax.exclude_paths ||= []
201
202
  PuppetSyntax.exclude_paths << 'spec/fixtures/**/*'
202
203
  PuppetSyntax.exclude_paths << 'pkg/**/*'
203
204
  PuppetSyntax.exclude_paths << 'vendor/**/*'
205
+ PuppetSyntax.exclude_paths << 'plans/*'
204
206
  if Puppet.version.to_f < 4.0
205
207
  PuppetSyntax.exclude_paths << 'types/**/*'
206
208
  end
@@ -284,7 +286,7 @@ end
284
286
  namespace :check do
285
287
  desc 'Fails if symlinks are present in directory'
286
288
  task :symlinks do
287
- symlinks = check_directory_for_symlinks
289
+ symlinks = PuppetlabsSpecHelper::Tasks::CheckSymlinks.new.check
288
290
  unless symlinks.empty?
289
291
  symlinks.each { |r| puts "Symlink found: #{r} => #{r.readlink}" }
290
292
  raise 'Symlink(s) exist within this directory'
@@ -293,13 +295,10 @@ namespace :check do
293
295
 
294
296
  desc 'Fails if .pp files present in tests folder'
295
297
  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
298
+ ppfiles = Dir[File.join('tests', '**', '*.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'
303
302
  end
304
303
  end
305
304
 
@@ -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,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'open3'
3
+ require 'json'
3
4
 
4
5
  module PuppetlabsSpecHelper; end
5
6
  module PuppetlabsSpecHelper::Tasks; end
@@ -9,6 +10,19 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
9
10
  Dir.pwd
10
11
  end
11
12
 
13
+ def module_name
14
+ raise ArgumentError unless File.file?('metadata.json') && File.readable?('metadata.json')
15
+
16
+ metadata = JSON.parse(File.read('metadata.json'))
17
+ metadata_name = metadata.fetch('name', nil) || ''
18
+
19
+ raise ArgumentError if metadata_name.empty?
20
+
21
+ metadata_name.split('-').last
22
+ rescue JSON::ParserError, ArgumentError
23
+ File.basename(Dir.pwd).split('-').last
24
+ end
25
+
12
26
  # cache the repositories and return a hash object
13
27
  def repositories
14
28
  unless @repositories
@@ -18,7 +32,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
18
32
  end
19
33
 
20
34
  def auto_symlink
21
- { File.basename(Dir.pwd).split('-').last => '#{source_dir}' }
35
+ { module_name => '#{source_dir}' }
22
36
  end
23
37
 
24
38
  def fixtures(category)
@@ -247,21 +261,6 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
247
261
  end
248
262
  @max_thread_limit
249
263
  end
250
-
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))
260
- end
261
- end
262
-
263
- results
264
- end
265
264
  end
266
265
  include PuppetlabsSpecHelper::Tasks::FixtureHelpers
267
266
 
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = '2.12.0'.freeze
2
+ VERSION = '2.13.0'.freeze
3
3
 
4
4
  # compat for pre-1.2.0 users; deprecated
5
5
  module Version
@@ -24,12 +24,14 @@ Gem::Specification.new do |spec|
24
24
  spec.add_runtime_dependency 'puppet-lint', '~> 2.0'
25
25
  spec.add_runtime_dependency 'puppet-syntax', '~> 2.0'
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
32
  spec.add_development_dependency 'rake', '~> 10.0'
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'
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.13.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: 2019-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -68,19 +68,33 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '2.0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: bundler
71
+ name: pathspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '1.12'
77
- type: :development
76
+ version: 0.2.1
77
+ type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '1.12'
83
+ version: 0.2.1
84
+ - !ruby/object:Gem::Dependency
85
+ name: bundler
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: pry
86
100
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +179,20 @@ dependencies:
165
179
  - - "~>"
166
180
  - !ruby/object:Gem::Version
167
181
  version: '0.29'
182
+ - !ruby/object:Gem::Dependency
183
+ name: fakefs
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: 0.13.3
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: 0.13.3
168
196
  description: Contains rake tasks and a standard spec_helper for running spec tests
169
197
  on puppet modules.
170
198
  email:
@@ -195,6 +223,7 @@ files:
195
223
  - lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb
196
224
  - lib/puppetlabs_spec_helper/rake_tasks.rb
197
225
  - lib/puppetlabs_spec_helper/tasks/beaker.rb
226
+ - lib/puppetlabs_spec_helper/tasks/check_symlinks.rb
198
227
  - lib/puppetlabs_spec_helper/tasks/fixtures.rb
199
228
  - lib/puppetlabs_spec_helper/version.rb
200
229
  - puppet_spec_helper.rb