puppetlabs_spec_helper 2.9.0 → 2.9.1

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
2
  SHA256:
3
- metadata.gz: 6821247effca57cc705aad0fd004ab5fda488ed7053734c996b1ee3249cea435
4
- data.tar.gz: 7b762f7e6e5ab7986574e4d080c070a1ee010dfa56baeccb3a6e13c70b4cdee8
3
+ metadata.gz: b21969553f83495baee878153ceb6d7dc828dded4cd8ed35792b18b23ccaa804
4
+ data.tar.gz: 5a2b080d487936959a2e0435682874dee0a1be4e01e908a302a293aa7418b772
5
5
  SHA512:
6
- metadata.gz: 98520f9b6d4b1d7c3f4209991c6c11188b7637dea387de6322f6a2201e8af9203fbc20ab0e777c2cb19f38f05a2c106fd82f8827756a16463ef17c09b8ba8f9d
7
- data.tar.gz: cc4718fd5b4424b55980117271b88bdeaf778d3a1c87b34a83d9d79425cde795bf4315c4a11fe05e672ac8f980b74fcc723d9ce238a8982b29c7eaa9d07a4a03
6
+ metadata.gz: 3241f6e747d967037543ae2bf8244c099c97a237a938ea8e4fcde077f49fc60b6ab6322eec0a38dd5513869b91765b77cb774d97db00517221f86a3534a67f78
7
+ data.tar.gz: 10dcfe69b3c546e1bd0d45298e95f555998ec9809ad804e0e46dc8366b5d24487bd9f3fd07f5f7c2d97a957d671aa223ffb256f9e30c636828b11181e2cc4a8a
data/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All significant changes to this repo will be summarized in this file.
4
4
 
5
5
 
6
+ ## [v2.9.1](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.9.1) (2018-06-20)
7
+ [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.9.0...v2.9.1)
8
+
9
+ **Fixed bugs:**
10
+
11
+ - \(PDK-1031\) Remove thread-unsafe Dir.chdir usage [\#249](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/249) ([rodjek](https://github.com/rodjek))
12
+ - \(PDK-1033\) Use `--unshallow` when fetching a ref [\#247](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/247) ([DavidS](https://github.com/DavidS))
13
+
6
14
  ## [v2.9.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.9.0) (2018-06-18)
7
15
  [Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.8.0...v2.9.0)
8
16
 
@@ -12,6 +20,7 @@ All significant changes to this repo will be summarized in this file.
12
20
 
13
21
  **Merged pull requests:**
14
22
 
23
+ - Release prep 2.9.0 [\#248](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/248) ([DavidS](https://github.com/DavidS))
15
24
  - Stable development structure for this gem [\#246](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/246) ([cardil](https://github.com/cardil))
16
25
 
17
26
  # Previous Changes
@@ -514,4 +523,4 @@ compatible yet.
514
523
  [0.1.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.0.0...0.1.0
515
524
 
516
525
 
517
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
526
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile CHANGED
@@ -6,11 +6,11 @@ gemspec
6
6
 
7
7
  group :development do
8
8
  gem 'codecov'
9
- gem 'github_changelog_generator'
9
+ gem 'github_changelog_generator' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.0')
10
10
  gem 'puppet', ENV['PUPPET_GEM_VERSION'] || ENV['PUPPET_VERSION'] || '~> 4.0'
11
11
  gem 'simplecov', '~> 0'
12
12
  gem 'simplecov-console'
13
- if RUBY_VERSION >= '2.1'
13
+ if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
14
14
  gem 'rubocop', '< 0.50'
15
15
  gem 'rubocop-rspec', '~> 1'
16
16
  end
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'open3'
2
3
 
3
4
  module PuppetlabsSpecHelper; end
4
5
  module PuppetlabsSpecHelper::Tasks; end
@@ -128,13 +129,17 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
128
129
  when 'hg'
129
130
  ['pull']
130
131
  when 'git'
131
- ['fetch']
132
+ ['fetch'].tap do |git_args|
133
+ git_args << '--unshallow' if shallow_git_repo?
134
+ end
132
135
  else
133
136
  raise "Unfortunately #{scm} is not supported yet"
134
137
  end
135
- Dir.chdir(target) do
136
- system("#{scm} #{args.flatten.join(' ')}")
137
- end
138
+ system("#{scm} #{args.flatten.join(' ')}", chdir: target)
139
+ end
140
+
141
+ def shallow_git_repo?
142
+ File.file?(File.join('.git', 'shallow'))
138
143
  end
139
144
 
140
145
  def revision(scm, target, ref)
@@ -147,7 +152,23 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
147
152
  else
148
153
  raise "Unfortunately #{scm} is not supported yet"
149
154
  end
150
- system("cd #{target} && #{scm} #{args.flatten.join ' '}")
155
+ system("#{scm} #{args.flatten.join ' '}", chdir: target)
156
+ end
157
+
158
+ def valid_repo?(scm, target, remote)
159
+ return false unless File.directory?(target)
160
+ return true if scm == 'hg'
161
+
162
+ return true if git_remote_url(target) == remote
163
+
164
+ warn "Git remote for #{target} has changed, recloning repository"
165
+ FileUtils.rm_rf(target)
166
+ false
167
+ end
168
+
169
+ def git_remote_url(target)
170
+ output, status = Open3.capture2e('git', '-C', target, 'remote', 'get-url', 'origin')
171
+ status.success? ? output.strip : nil
151
172
  end
152
173
 
153
174
  def remove_subdirectory(target, subdir)
@@ -259,7 +280,7 @@ task :spec_prep do
259
280
  logger.debug "New Thread started for #{remote}"
260
281
  # start up a new thread and store it in the opts hash
261
282
  opts[:thread] = Thread.new do
262
- if File.directory?(target)
283
+ if valid_repo?(scm, target, remote)
263
284
  update_repo(scm, target)
264
285
  else
265
286
  clone_repo(scm, remote, target, subdir, ref, branch, flags)
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = '2.9.0'.freeze
2
+ VERSION = '2.9.1'.freeze
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.9.0
4
+ version: 2.9.1
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-06-18 00:00:00.000000000 Z
12
+ date: 2018-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha