puppetlabs_spec_helper 2.1.0 → 2.2.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: 01f28b4872910d69e3d37d10e0a5e25193bd23b6
4
- data.tar.gz: 9a2a2907b2bfc41da33c7fbd507a8dba3c361ca4
3
+ metadata.gz: feee2f3cf5d61beaccc0515e95befc300307a526
4
+ data.tar.gz: 4931b17333960330bf64c0e6d9d54242d873be49
5
5
  SHA512:
6
- metadata.gz: 5e4718a4d21f670b4d2c60bfb05becc6696e9e8ea3bfd4496cb1ae493ce449da24db54b0f2784026a27d4e67beb13b9e7441fb08e3303db910c2ad3f1acdc755
7
- data.tar.gz: b8b98e85acfd1d6789b249409ebb6f799fe6631ac14192ce63f1660ae0f8f64f9d0cf05f11f95b73b6d65f9a289248069ebe3194a60a3d7fdd5e59b4aff7d22d
6
+ metadata.gz: 5ade464305fa7a9b1e237e0ecf379c23a2e27d38f963b7c7129432859c3b311f1a933a69a9624ba53e26cab68ec4d1461f888ddccd504a860889f450762fe94c
7
+ data.tar.gz: 63648ac51c6b670f3ad180b39ac6ce6fd7150b3457aa47faa555af86199ff806f5156354f7ec92c42a4f0997af2a8904b677ac939591b03791b472b34299fda6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,51 @@
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.2.0]
6
+ ### Summary
7
+ i18n rake task, and unbreak windows again.
8
+
9
+ ### Added
10
+ - New rake task for i18n stuff.
11
+
12
+ ### Fixed
13
+ - Fixture path calculation for windows
14
+ - Log to stderr instead of stdout as per rspec's spec
15
+
16
+ ## [2.1.5]
17
+ ### Summary:
18
+ Fix symlinks fixtures code.
19
+
20
+ ## [2.1.4]
21
+ ### Summary:
22
+ Better Windows support.
23
+
24
+ ### Fixed:
25
+ - Create directory junctions instead of symlinks on windows (#192)
26
+ - Replace check:symlinks with platform independent alternative (#193)
27
+
28
+ ## [2.1.3]
29
+ ### Summary:
30
+ This release fixes puppet module install into paths with spaces, and fix conflicting build names for CI jobs.
31
+
32
+ ### Fixed:
33
+ - Properly exscape paths for puppet module install
34
+ - Add "r" to the beginning of `rake compute_dev_version`
35
+
36
+ ## [2.1.2]
37
+ ### Summary:
38
+ The `release_tasks` now falls back to `spec` if the `parallel_spec` test fails due to the `parallel_tests` gem being absent.
39
+
40
+ ### Fixed:
41
+ - Make `release_tasks` fall back to `spec` when missing the `parallel_tests` gem
42
+
43
+ ## [2.1.1]
44
+ ### Summary:
45
+ Bugfix for an unstated dependency on parallel\_spec that was added in 2.0.0
46
+
47
+ ### Fixed:
48
+ - Add dependency for parallel\_spec, since psh requires it anyway.
49
+
5
50
  ## [2.1.0]
6
51
  ### Summary:
7
52
  Minor version bump for new CI_SPEC_OPTIONS variable and bug fix.
@@ -316,7 +361,14 @@ compatible yet.
316
361
  ### Added
317
362
  * Initial release
318
363
 
319
- [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.0.1...master
364
+ [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.2.0...master
365
+ [2.2.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.1.5...v2.2.0
366
+ [2.1.5]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.1.4...v2.1.5
367
+ [2.1.4]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.1.3...v2.1.4
368
+ [2.1.3]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.1.2...v2.1.3
369
+ [2.1.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.1.1...v2.1.2
370
+ [2.1.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.1.0...v2.1.1
371
+ [2.1.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.0.1...v2.1.0
320
372
  [2.0.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.0.0...v2.0.1
321
373
  [2.0.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v1.2.2...v2.0.0
322
374
  [1.2.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v1.2.1...v1.2.2
@@ -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
@@ -94,7 +95,7 @@ def vagrant_ssh(set, node = nil)
94
95
  end
95
96
 
96
97
  def auto_symlink
97
- { Dir.pwd.split('/').last.split('-').last => '#{source_dir}' }
98
+ { File.basename(Dir.pwd).split('-').last => '#{source_dir}' }
98
99
  end
99
100
 
100
101
  def fixtures(category)
@@ -192,7 +193,7 @@ def logger
192
193
  else
193
194
  level = Logger::INFO
194
195
  end
195
- @logger = Logger.new(STDOUT)
196
+ @logger = Logger.new(STDERR)
196
197
  @logger.level = level
197
198
  end
198
199
  @logger
@@ -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
@@ -281,12 +283,18 @@ task :spec_prep do
281
283
  # wait for all the threads to finish
282
284
  repositories.each {|remote, opts| opts[:thread].join }
283
285
 
284
- 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)
288
- else
289
- File::exists?(target) || FileUtils::ln_sf(source, target)
286
+ fixtures("symlinks").each do |target, link|
287
+ unless File.symlink?(link)
288
+ logger.info("Creating symlink from #{link} to #{target}")
289
+ if is_windows
290
+ if Dir.respond_to?(:create_junction)
291
+ Dir.create_junction(link, target)
292
+ else
293
+ system("call mklink /J \"#{link.gsub('/', '\\')}\" \"#{target.gsub('/', '\\')}\"")
294
+ end
295
+ else
296
+ FileUtils::ln_sf(target, link)
297
+ end
290
298
  end
291
299
  end
292
300
 
@@ -308,11 +316,11 @@ task :spec_prep do
308
316
  command = "puppet module install" + ref + flags + \
309
317
  " --ignore-dependencies" \
310
318
  " --force" \
311
- " --module_working_dir #{working_dir}" \
312
- " --target-dir #{target_dir} #{remote}"
319
+ " --module_working_dir \"#{working_dir}\"" \
320
+ " --target-dir \"#{target_dir}\" \"#{remote}\""
313
321
 
314
322
  unless system(command)
315
- fail "Failed to install module #{remote} to #{target}"
323
+ fail "Failed to install module #{remote} to #{target_dir}"
316
324
  end
317
325
  end
318
326
 
@@ -371,7 +379,7 @@ task :parallel_spec do
371
379
  ParallelTests::CLI.new.run(args)
372
380
  Rake::Task[:spec_clean].invoke
373
381
  rescue LoadError
374
- fail 'Add the parallel_tests gem to Gemfile to enable this task'
382
+ raise 'Add the parallel_tests gem to Gemfile to enable this task'
375
383
  end
376
384
  end
377
385
 
@@ -500,10 +508,18 @@ task :compute_dev_version do
500
508
  end
501
509
 
502
510
  sha = `git rev-parse HEAD`[0..7]
511
+ branch = `git rev-parse --abbrev-ref HEAD`
503
512
 
504
513
  # If we're in a CI environment include our build number
514
+ # If the branch is a release branch we append an 'r' into the new_version,
515
+ # this is due to the release branch buildID conflicting with master branch when trying to push to the staging forge.
516
+ # More info can be found at https://tickets.puppetlabs.com/browse/FM-6170
505
517
  if build = ENV['BUILD_NUMBER'] || ENV['TRAVIS_BUILD_NUMBER']
506
- new_version = sprintf('%s-%04d-%s', version, build, sha)
518
+ if branch.eql? "release"
519
+ new_version = sprintf('%s-%s%04d-%s', version, "r", build, sha)
520
+ else
521
+ new_version = sprintf('%s-%04d-%s', version, build, sha)
522
+ end
507
523
  else
508
524
  new_version = "#{version}-#{sha}"
509
525
  end
@@ -515,20 +531,39 @@ desc "Runs all necessary checks on a module in preparation for a release"
515
531
  task :release_checks do
516
532
  Rake::Task[:lint].invoke
517
533
  Rake::Task[:validate].invoke
518
- Rake::Task[:parallel_spec].invoke
534
+ begin
535
+ Rake::Task[:parallel_spec].invoke
536
+ rescue RuntimeError
537
+ Rake::Task[:spec].invoke
538
+ end
519
539
  Rake::Task["check:symlinks"].invoke
520
540
  Rake::Task["check:test_file"].invoke
521
541
  Rake::Task["check:dot_underscore"].invoke
522
542
  Rake::Task["check:git_ignore"].invoke
523
543
  end
524
544
 
545
+ def check_directory_for_symlinks(dir='.')
546
+ dir = Pathname.new(dir) unless dir.is_a?(Pathname)
547
+ results = []
548
+
549
+ dir.each_child(true) do |child|
550
+ if child.symlink?
551
+ results << child
552
+ elsif child.directory? && child.basename.to_s != '.git'
553
+ results.concat(check_directory_for_symlinks(child))
554
+ end
555
+ end
556
+
557
+ results
558
+ end
559
+
525
560
  namespace :check do
526
561
  desc "Fails if symlinks are present in directory"
527
562
  task :symlinks do
528
- symlink = `find . -path ./.git -prune -o -type l -ls`
529
- unless symlink == ""
530
- puts symlink
531
- fail "A symlink exists within this directory"
563
+ symlinks = check_directory_for_symlinks
564
+ unless symlinks.empty?
565
+ symlinks.each { |r| puts "Symlink found: #{r.to_s} => #{r.readlink}" }
566
+ fail "Symlink(s) exist within this directory"
532
567
  end
533
568
  end
534
569
 
@@ -595,4 +630,11 @@ if File.exist? locales_dir
595
630
  rescue Gem::LoadError
596
631
  puts "No gettext-setup gem found, skipping gettext initialization" if Rake.verbose == true
597
632
  end
633
+ namespace :module do
634
+ desc "Runs all tasks to build a modules POT file for internationalization"
635
+ task :pot_gen do
636
+ Rake::Task["gettext:pot"].invoke()
637
+ Rake::Task["gettext:metadata_pot"].invoke("#{module_dir}/metadata.json")
638
+ end
639
+ end
598
640
  end
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
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.0
4
+ version: 2.2.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: 2017-03-06 00:00:00.000000000 Z
12
+ date: 2017-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha