berkshelf 2.0.13 → 2.0.14

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: bebc07cff3e9517a026f6f35d680dc70c9160738
4
- data.tar.gz: 65b4d4bd48f63e4dd7b82fb81841a4d4dd3f0477
3
+ metadata.gz: 17e52bf99ab83485dbf6a146715598c65e87be9f
4
+ data.tar.gz: 52422a0e9b000b2b0859d2061ea8dab038d266e8
5
5
  SHA512:
6
- metadata.gz: e2bbb1c832261038572c797c851239873027cdaa342379d3363e64ac71de0ae0ce0dadba34fc92f4c0e27600761dd8d32159e84e43abad9a05ace571529a1f21
7
- data.tar.gz: 060f7bbd784bcf0ea046b2117c7d28989603179faf0b7142af5259f364ad72da13c0941762332658e789e8f498686945daee074918a1d9f1acb82db5a1607781
6
+ metadata.gz: 5f8a56671024af1c5015c0436e3b85e503dde1d542d036ff96a76a6acfb385657744786891b48c1b61130e003ce1babbbb64af1e2a382f001adbf06e753073e0
7
+ data.tar.gz: daa8720298464b606992fc3e690b15c345fd78aaa60f5a5f4d6ba5176f4e602c01bafd04f373c6705464befba679fe3c01233c6aac5ed5ec57b47639663ba142
@@ -1,3 +1,7 @@
1
+ # 2.0.14
2
+
3
+ * Backport changes from master to allow detecting cookbooks by metadata.json
4
+
1
5
  # 2.0.13
2
6
 
3
7
  * Lock transitive dependency on Faraday
@@ -1,13 +1,13 @@
1
1
  class File
2
2
  class << self
3
- # Returns true or false if the given path is a Chef Cookbook
3
+ # Returns true or false if the given path contains a Chef Cookbook
4
4
  #
5
5
  # @param [#to_s] path
6
6
  # path of directory to reflect on
7
7
  #
8
8
  # @return [Boolean]
9
9
  def cookbook?(path)
10
- File.exists?(File.join(path, 'metadata.rb'))
10
+ File.exists?(File.join(path, "metadata.json")) || File.exists?(File.join(path, "metadata.rb"))
11
11
  end
12
12
  alias_method :chef_cookbook?, :cookbook?
13
13
  end
@@ -1,20 +1,18 @@
1
1
  class Pathname
2
- # Returns true or false if the path of the instantiated
3
- # Pathname or a parent directory contains a Tryhard Pack
4
- # data directory.
2
+ # Returns true or false if the path contains a "metadata.json" or a "metadata.rb" file.
5
3
  #
6
4
  # @return [Boolean]
7
5
  def cookbook?
8
- self.join('metadata.rb').exist?
6
+ join("metadata.json").exist? || join("metadata.rb").exist?
9
7
  end
10
8
  alias_method :chef_cookbook?, :cookbook?
11
9
 
12
- # Ascend the directory structure from the given path to find a
13
- # the root of a Chef Cookbook. If no Cookbook is found, nil is returned
10
+ # Ascend the directory structure from the given path to find the root of a
11
+ # Cookbook. If no Cookbook is found, nil is returned.
14
12
  #
15
13
  # @return [Pathname, nil]
16
14
  def cookbook_root
17
- self.ascend do |potential_root|
15
+ ascend do |potential_root|
18
16
  if potential_root.cookbook?
19
17
  return potential_root
20
18
  end
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "2.0.13"
2
+ VERSION = "2.0.14"
3
3
  end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Pathname do
4
+ describe "#cookbook?" do
5
+ let(:cookbook_path) { tmp_path }
6
+ let(:metadata_rb) { tmp_path.join("metadata.rb") }
7
+ let(:metadata_json) { tmp_path.join("metadata.json") }
8
+
9
+ subject { Pathname.new(cookbook_path) }
10
+
11
+ context "when the path contains a metadata.json file" do
12
+ before { FileUtils.touch(metadata_json) }
13
+ its(:cookbook?) { should be_true }
14
+ end
15
+
16
+ context "when the path contains a metadata.rb file" do
17
+ before { FileUtils.touch(metadata_rb) }
18
+ its(:cookbook?) { should be_true }
19
+ end
20
+
21
+ context "when the path does not contain a metadata.json or metadata.rb file" do
22
+ before { FileUtils.rm_f(metadata_rb) && FileUtils.rm_f(metadata_json) }
23
+ its(:cookbook?) { should be_false }
24
+ end
25
+ end
26
+
27
+ describe "#cookbook_root" do
28
+ let(:root_path) { fixtures_path.join("cookbooks", "example_cookbook") }
29
+ let(:cookbook_path) { root_path }
30
+ subject { Pathname.new(cookbook_path) }
31
+
32
+ context "when in the root of a cookbook" do
33
+ its(:cookbook_root) { should eql(root_path) }
34
+ end
35
+
36
+ context "when in the structure of a cookbook" do
37
+ let(:cookbook_path) { root_path.join("recipes") }
38
+ its(:cookbook_root) { should eql(root_path) }
39
+ end
40
+
41
+ context "when not within the structure of a cookbook" do
42
+ let(:cookbook_path) { "/" }
43
+ its(:cookbook_root) { should be_nil }
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.13
4
+ version: 2.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-01-20 00:00:00.000000000 Z
15
+ date: 2014-02-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -637,6 +637,7 @@ files:
637
637
  - spec/unit/berkshelf/cookbook_source_spec.rb
638
638
  - spec/unit/berkshelf/cookbook_store_spec.rb
639
639
  - spec/unit/berkshelf/core_ext/file_utils_spec.rb
640
+ - spec/unit/berkshelf/core_ext/pathname_spec.rb
640
641
  - spec/unit/berkshelf/downloader_spec.rb
641
642
  - spec/unit/berkshelf/errors_spec.rb
642
643
  - spec/unit/berkshelf/formatters/null_spec.rb
@@ -676,7 +677,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
676
677
  version: 1.8.0
677
678
  requirements: []
678
679
  rubyforge_project:
679
- rubygems_version: 2.0.7
680
+ rubygems_version: 2.0.3
680
681
  signing_key:
681
682
  specification_version: 4
682
683
  summary: Manages a Cookbook's, or an Application's, Cookbook dependencies
@@ -777,6 +778,7 @@ test_files:
777
778
  - spec/unit/berkshelf/cookbook_source_spec.rb
778
779
  - spec/unit/berkshelf/cookbook_store_spec.rb
779
780
  - spec/unit/berkshelf/core_ext/file_utils_spec.rb
781
+ - spec/unit/berkshelf/core_ext/pathname_spec.rb
780
782
  - spec/unit/berkshelf/downloader_spec.rb
781
783
  - spec/unit/berkshelf/errors_spec.rb
782
784
  - spec/unit/berkshelf/formatters/null_spec.rb
@@ -796,4 +798,3 @@ test_files:
796
798
  - spec/unit/berkshelf/ui_spec.rb
797
799
  - spec/unit/berkshelf_spec.rb
798
800
  - spec/unit/chef/config_spec.rb
799
- has_rdoc: