cookbook-release 1.5.1 → 1.6.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
2
  SHA256:
3
- metadata.gz: '0438ab5b35c35ac88fbc7f99b58e43882fe7fc2cb2d4299ed1d609cd0b702d4d'
4
- data.tar.gz: 7390fd2694a610a5ac4fe0b81f4fdc6e7cbee9e4381d96f7b0ff9573f7c70cd0
3
+ metadata.gz: e4b745baf2a010f96d7bd64dea31e9275f5d070cf871d738f0f1e9a6271a7554
4
+ data.tar.gz: 84360fb9192231adc36ef0e1031b7a4ca2cac799848a08efb6c270b7daa7943a
5
5
  SHA512:
6
- metadata.gz: 27ff8bf88d9e8453cfa5a46b45dd74e59ac5a8ba5e18b4b988b4acdf2a6b7d7b4e29c057ad73e402fcec7065b1662d5b8003496e100ce8592787da8441ab2a5f
7
- data.tar.gz: 6e44f603a8aa0801968d3eea30574ef3b0c8751cb98c80b2d9f57f2511e80414d0f1cf978b4688105a58140c3e8123eb1437eeed355bb2507f85b5b53c181e23
6
+ metadata.gz: 9278ffaf0ed6073d59b733e1c79c39a80b199874ba3f94318801805ba1f70508b019ae359926272183f862e0702c4d8596f98a095f10624592c0c2eb28ffd972
7
+ data.tar.gz: d08177747f17e1fb1c5a9527bd75b55be0bf9f9446e9e18529bf3d2121ed77427dbedd22d49d0b074f8d0e2d56a12dbff8d365ffcda4c5dbea7109fb43eab9ff
@@ -6,7 +6,7 @@ require 'English'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cookbook-release'
9
- spec.version = '1.5.1'
9
+ spec.version = '1.6.0'
10
10
  spec.authors = ['Grégoire Seux']
11
11
  spec.email = 'g.seux@criteo.com'
12
12
  spec.summary = 'Provide primitives (and rake tasks) to release a cookbook'
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'semantic'
23
23
  spec.add_dependency 'highline'
24
24
  spec.add_dependency 'mixlib-shellout'
25
- spec.add_dependency 'chef', '>= 12.18.31'
25
+ # TODO: support Chef 17 and leverage knife gem at some point
26
+ spec.add_dependency 'chef', '>= 12.18.31', '< 17.0' # knife code has been moved to dedicated gem starting with Chef 17
26
27
  spec.add_dependency 'git-ng' # see https://github.com/schacon/ruby-git/issues/307
27
28
  spec.add_dependency 'unicode-emoji'
28
29
 
@@ -24,6 +24,9 @@ module CookbookRelease
24
24
  end
25
25
 
26
26
  def self.find_root(dir = Dir.pwd)
27
+ # Do not consider given dir as part of the git repo if not in git hierarchy or dir is not tracked
28
+ return if ::Mixlib::ShellOut.new('git ls-files --error-unmatch .', cwd: dir).run_command.error?
29
+
27
30
  cmd = Mixlib::ShellOut.new("git rev-parse --show-toplevel", cwd: dir)
28
31
  cmd.run_command
29
32
  cmd.error? ? nil : cmd.stdout.chomp
data/spec/git_spec.rb CHANGED
@@ -45,9 +45,18 @@ describe CookbookRelease::GitUtilities do
45
45
  FileUtils.rm_rf(tmp)
46
46
  end
47
47
 
48
- it 'finds repo\'s root from subdir' do
48
+ it 'do not finds repo\'s root from untracked subdir' do
49
49
  subdir = 'cookbooks/mycookbook'
50
50
  FileUtils.mkdir_p(subdir)
51
+ expect(CookbookRelease::GitUtilities.find_root(subdir)).to be nil
52
+ end
53
+
54
+ it 'finds repo\'s root from tracked subdir' do
55
+ subdir = 'cookbooks/mycookbook'
56
+ tracked_file = ::File.join(subdir, 'tracked_file')
57
+ FileUtils.mkdir_p(subdir)
58
+ FileUtils.touch(tracked_file)
59
+ ::Mixlib::ShellOut.new("git add '#{tracked_file}'").run_command
51
60
  expect(CookbookRelease::GitUtilities.find_root(subdir)).to eq(Dir.pwd)
52
61
  end
53
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookbook-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grégoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-27 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -59,6 +59,9 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 12.18.31
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '17.0'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +69,9 @@ dependencies:
66
69
  - - ">="
67
70
  - !ruby/object:Gem::Version
68
71
  version: 12.18.31
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '17.0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: git-ng
71
77
  requirement: !ruby/object:Gem::Requirement