cookbook-omnifetch 0.2.1 → 0.2.2

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: e7d091088a8d8bc3534633afc049408ec4b1ae98
4
- data.tar.gz: c41001a64b00582c791a9161d9b65989897aea44
3
+ metadata.gz: 58ddaa973a683bc785d88b14aba77ec925a88593
4
+ data.tar.gz: 6bc3e9c9b10d358670d3e7e10a6f355ff84bef3d
5
5
  SHA512:
6
- metadata.gz: 206300e6648ef964968ab77535acbfd494df3f20ab36d4155ae9a2ddb7224b16d23cc95192aa6a7a02799c5c5c47fb386aa161f6e3ec3d022d9c45789d173899
7
- data.tar.gz: 44b5ba6fdde4ff019d481e2709a8b5b592012193b0cdfb46d741719dafe7f4a5e70dec776175d7fc91120b287e57aba5154babd81f6aa430a556b24ebb24894d
6
+ metadata.gz: 2ad898b79aabc3caa8cc7dd492079f8e7c62dd0f3ab04dc9677b15dc48c18e5853b787dc8d7bccebe11a0d44fcfa23a68df4ccd7bf731f5b2569fe48d50de62d
7
+ data.tar.gz: 6197fdedffcd7df2e40de298d42a4f2b8ff512ccc09302d91e076ddf9ae57d81e072d9a9317342fbef54343a5a82a42cfac2070a7006f227b76d264c2a085675
@@ -50,6 +50,7 @@ module CookbookOmnifetch
50
50
  # the path to the thing that is not a cookbook
51
51
  def initialize(path)
52
52
  @path = File.expand_path(path) rescue path
53
+ super(to_s)
53
54
  end
54
55
 
55
56
  def to_s
@@ -68,6 +69,7 @@ module CookbookOmnifetch
68
69
  def initialize(dependency, cached_cookbook)
69
70
  @dependency = dependency
70
71
  @cached_cookbook = cached_cookbook
72
+ super(to_s)
71
73
  end
72
74
 
73
75
  def to_s
@@ -85,6 +87,7 @@ module CookbookOmnifetch
85
87
  def initialize(dependency, cached_cookbook)
86
88
  @dependency = dependency
87
89
  @cached_cookbook = cached_cookbook
90
+ super(to_s)
88
91
  end
89
92
 
90
93
  def to_s
@@ -98,7 +101,7 @@ module CookbookOmnifetch
98
101
  out << "\n"
99
102
  out << "NOTE: If you do not explicitly set the 'name' attribute in the "
100
103
  out << "metadata, the name of the directory will be used instead. This "
101
- out << "is often a cause of confusion for dependency solving."
104
+ out << "is often a cause of confusion for dependency solving.\n"
102
105
  out
103
106
  end
104
107
  end
@@ -1,3 +1,3 @@
1
1
  module CookbookOmnifetch
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -0,0 +1,87 @@
1
+ require 'spec_helper'
2
+ require 'cookbook-omnifetch/exceptions'
3
+
4
+ module CookbookOmnifetch
5
+ describe "Exceptions" do
6
+
7
+ describe NotACookbook do
8
+
9
+ subject(:exception) do
10
+ described_class.new("/path/to/cookbook")
11
+ end
12
+
13
+ let(:message) do
14
+ "The resource at '/path/to/cookbook' does not appear to be a valid cookbook. Does it have a metadata.rb?"
15
+ end
16
+
17
+ it "creates an informative error in #message" do
18
+ expect(exception.message).to eq(message)
19
+ end
20
+
21
+ it "creates an informative error in #to_s" do
22
+ expect(exception.to_s).to eq(message)
23
+ end
24
+
25
+ end
26
+
27
+ describe CookbookValidationFailure do
28
+
29
+ let(:dependency) { instance_double("ChefDK::Policyfile::CookbookLocationSpecification", to_s: "apt ~> 1.2.3") }
30
+
31
+ # The exception class itself doesn't use this
32
+ let(:cached_cookbook) { Object.new }
33
+
34
+ subject(:exception) do
35
+ described_class.new(dependency, cached_cookbook)
36
+ end
37
+
38
+ let(:message) do
39
+ "The cookbook downloaded for apt ~> 1.2.3 did not satisfy the constraint."
40
+ end
41
+
42
+ it "creates an informative error in #message" do
43
+ expect(exception.message).to eq(message)
44
+ end
45
+
46
+ it "creates an informative error in #to_s" do
47
+ expect(exception.to_s).to eq(message)
48
+ end
49
+
50
+ end
51
+
52
+ describe MismatchedCookbookName do
53
+
54
+ let(:dependency) { instance_double("ChefDK::Policyfile::CookbookLocationSpecification", name: "apt") }
55
+
56
+ let(:cached_cookbook) { instance_double("Chef::Cookbook", cookbook_name: "apt") }
57
+
58
+ subject(:exception) do
59
+ described_class.new(dependency, cached_cookbook)
60
+ end
61
+
62
+ let(:message) do
63
+ <<-EOM
64
+ In your Berksfile, you have:
65
+
66
+ cookbook 'apt'
67
+
68
+ But that cookbook is actually named 'apt'
69
+
70
+ This can cause potentially unwanted side-effects in the future.
71
+
72
+ NOTE: If you do not explicitly set the 'name' attribute in the metadata, the name of the directory will be used instead. This is often a cause of confusion for dependency solving.
73
+ EOM
74
+ end
75
+
76
+ it "creates an informative error in #message" do
77
+ expect(exception.message).to eq(message)
78
+ end
79
+
80
+ it "creates an informative error in #to_s" do
81
+ expect(exception.to_s).to eq(message)
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookbook-omnifetch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-03-26 00:00:00.000000000 Z
16
+ date: 2015-10-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: minitar
@@ -98,6 +98,7 @@ files:
98
98
  - spec/spec_helper.rb
99
99
  - spec/unit/artifactserver_spec.rb
100
100
  - spec/unit/base_spec.rb
101
+ - spec/unit/exceptions_spec.rb
101
102
  - spec/unit/git_spec.rb
102
103
  - spec/unit/path_spec.rb
103
104
  homepage: http://www.getchef.com/
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  version: '0'
121
122
  requirements: []
122
123
  rubyforge_project:
123
- rubygems_version: 2.2.2
124
+ rubygems_version: 2.4.8
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: Library code to fetch Chef cookbooks from a variety of sources to a local
@@ -139,6 +140,7 @@ test_files:
139
140
  - spec/spec_helper.rb
140
141
  - spec/unit/artifactserver_spec.rb
141
142
  - spec/unit/base_spec.rb
143
+ - spec/unit/exceptions_spec.rb
142
144
  - spec/unit/git_spec.rb
143
145
  - spec/unit/path_spec.rb
144
146
  has_rdoc: