puppetlabs_spec_helper 2.1.3 → 2.1.4

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: a4e32792b5b1b9ff5cb3e4549b2e34f8c067358e
4
- data.tar.gz: bde81e497fccf351baa4c2b7304346ae134f71c7
3
+ metadata.gz: 1889098dbf439ae7274e2b27fb3953d82a8c53a8
4
+ data.tar.gz: dd27b2e161f3c4a7c77ba38e044f4a1a322bb3fd
5
5
  SHA512:
6
- metadata.gz: d61b5e9fb3e9d439f72be5cd436a8c1b2b154696b81647e9a8d133640560e46e0f33be60c046b50715e3e1c8eaa3c691ee416408aa119067f5da1917e8c562ef
7
- data.tar.gz: 31c88292d17c418fb89bc02f6a80ed5acfabd2384c578f7a8e978e23f27084154e52f465770e73976d2ddbea8386227a7d0b1abdf18f01be452cd9fa957200e7
6
+ metadata.gz: b6ae9d52ec46f3b3cf480b03a12491e79fe771b3f61b846da7b3fabd8a9a772783c61ec0c6c24552d68108be344958c37191af91f3081c79caa9317af9eae629
7
+ data.tar.gz: 78c2779abc91960af397c0129249c4ea8e8724dfe60214e98014f1f0e0f0d5063c8039600bf2bb0bf37a3e1278b869aa11b0bcaa5b6da08064560fe19acc240a
@@ -2,6 +2,14 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [2.1.4]
6
+ ### Summary:
7
+ Better Windows support.
8
+
9
+ ### Fixed:
10
+ - Create directory junctions instead of symlinks on windows (#192)
11
+ - Replace check:symlinks with platform independent alternative (#193)
12
+
5
13
  ## [2.1.3]
6
14
  ### Summary:
7
15
  This release fixes puppet module install into paths with spaces, and fix conflicting build names for CI jobs.
@@ -3,6 +3,7 @@ require 'rake'
3
3
  require 'rspec/core/rake_task'
4
4
  require 'tmpdir'
5
5
  require 'yaml'
6
+ require 'pathname'
6
7
 
7
8
  # optional gems
8
9
  begin
@@ -240,11 +241,12 @@ task :spec_prep do
240
241
  # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library
241
242
  # uses this to check for Windows
242
243
  is_windows = !!File::ALT_SEPARATOR
243
- puppet_symlink_available = false
244
- begin
245
- require 'puppet'
246
- puppet_symlink_available = Puppet::FileSystem.respond_to?(:symlink)
247
- rescue
244
+ if is_windows
245
+ begin
246
+ require 'win32/dir'
247
+ rescue LoadError
248
+ $stderr.puts "win32-dir gem not installed, falling back to executing mklink directly"
249
+ end
248
250
  end
249
251
 
250
252
  # git has a race condition creating that directory, that would lead to aborted clone operations
@@ -282,11 +284,16 @@ task :spec_prep do
282
284
  repositories.each {|remote, opts| opts[:thread].join }
283
285
 
284
286
  fixtures("symlinks").each do |source, target|
285
- if is_windows
286
- fail "Cannot symlink on Windows unless using at least Puppet 3.5" if !puppet_symlink_available
287
- Puppet::FileSystem::exist?(target) || Puppet::FileSystem::symlink(source, target)
287
+ unless File.symlink(target)
288
+ if is_windows
289
+ if Dir.respond_to?(:create_junction)
290
+ Dir.create_junction(target, source)
291
+ else
292
+ system("call mklink /J \"#{target.gsub('/', '\\')}\" \"#{source.gsub('/', '\\')}\"")
293
+ end
294
+ end
288
295
  else
289
- File::exists?(target) || FileUtils::ln_sf(source, target)
296
+ FileUtils::ln_sf(source, target)
290
297
  end
291
298
  end
292
299
 
@@ -534,13 +541,28 @@ task :release_checks do
534
541
  Rake::Task["check:git_ignore"].invoke
535
542
  end
536
543
 
544
+ def check_directory_for_symlinks(dir='.')
545
+ dir = Pathname.new(dir) unless dir.is_a?(Pathname)
546
+ results = []
547
+
548
+ dir.each_child(true) do |child|
549
+ if child.symlink?
550
+ results << child
551
+ elsif child.directory? && child.basename.to_s != '.git'
552
+ results.concat(check_directory_for_symlinks(child))
553
+ end
554
+ end
555
+
556
+ results
557
+ end
558
+
537
559
  namespace :check do
538
560
  desc "Fails if symlinks are present in directory"
539
561
  task :symlinks do
540
- symlink = `find . -path ./.git -prune -o -type l -ls`
541
- unless symlink == ""
542
- puts symlink
543
- fail "A symlink exists within this directory"
562
+ symlinks = check_directory_for_symlinks
563
+ unless symlinks.empty?
564
+ symlinks.each { |r| puts "Symlink found: #{r.to_s} => #{r.readlink}" }
565
+ fail "Symlink(s) exist within this directory"
544
566
  end
545
567
  end
546
568
 
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
3
3
 
4
4
  # compat for pre-1.2.0 users; deprecated
5
5
  module Version
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.1.3
4
+ version: 2.1.4
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: 2017-05-31 00:00:00.000000000 Z
12
+ date: 2017-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  requirements: []
217
217
  rubyforge_project:
218
- rubygems_version: 2.5.1
218
+ rubygems_version: 2.5.2
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Standard tasks and configuration for module spec tests.