berkshelf 2.0.13 → 2.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/berkshelf/core_ext/file.rb +2 -2
- data/lib/berkshelf/core_ext/pathname.rb +5 -7
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/core_ext/pathname_spec.rb +46 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e52bf99ab83485dbf6a146715598c65e87be9f
|
4
|
+
data.tar.gz: 52422a0e9b000b2b0859d2061ea8dab038d266e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f8a56671024af1c5015c0436e3b85e503dde1d542d036ff96a76a6acfb385657744786891b48c1b61130e003ce1babbbb64af1e2a382f001adbf06e753073e0
|
7
|
+
data.tar.gz: daa8720298464b606992fc3e690b15c345fd78aaa60f5a5f4d6ba5176f4e602c01bafd04f373c6705464befba679fe3c01233c6aac5ed5ec57b47639663ba142
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
class File
|
2
2
|
class << self
|
3
|
-
# Returns true or false if the given path
|
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,
|
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
|
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
|
-
|
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
|
-
#
|
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
|
-
|
15
|
+
ascend do |potential_root|
|
18
16
|
if potential_root.cookbook?
|
19
17
|
return potential_root
|
20
18
|
end
|
data/lib/berkshelf/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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:
|