librarian 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,6 +45,8 @@ module Librarian
45
45
  end
46
46
 
47
47
  def fetch_manifest!
48
+ expect_manifest
49
+
48
50
  read_manifest(name, manifest_path(found_path))
49
51
  end
50
52
 
@@ -67,6 +69,13 @@ module Librarian
67
69
  FileUtils.cp_r(found_path, install_path)
68
70
  end
69
71
 
72
+ private
73
+
74
+ def expect_manifest
75
+ return if found_path && manifest_path(found_path)
76
+ raise Error, "No metadata file found for #{name} from #{source}! If this should be a cookbook, you might consider contributing a metadata file upstream or forking the cookbook to add your own metadata file."
77
+ end
78
+
70
79
  end
71
80
 
72
81
  def manifest_class
@@ -78,8 +78,10 @@ module Librarian
78
78
  until names.empty?
79
79
  name = names.shift
80
80
  manifest = index.delete(name)
81
- manifest.dependencies.each do |dependency|
82
- names << dependency.name
81
+ if manifest
82
+ manifest.dependencies.each do |dependency|
83
+ names << dependency.name
84
+ end
83
85
  end
84
86
  end
85
87
  self
@@ -1,3 +1,3 @@
1
1
  module Librarian
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -168,6 +168,28 @@ module Librarian
168
168
 
169
169
  end
170
170
 
171
+ context "missing a metadata" do
172
+ git_path = tmp_path.join('big-git-repo')
173
+
174
+ it "should explain the problem" do
175
+ repo_path = tmp_path.join("repo/resolve")
176
+ repo_path.rmtree if repo_path.exist?
177
+ repo_path.mkpath
178
+ repo_path.join("cookbooks").mkpath
179
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
180
+ cookbook "sample",
181
+ :git => #{git_path.to_s.inspect}
182
+ CHEFFILE
183
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
184
+ Chef.stub!(:project_path) { repo_path }
185
+
186
+ expect { Chef.resolve! }.
187
+ to raise_error(Librarian::Error, /no metadata file found/i)
188
+ repo_path.join("Cheffile.lock").should_not be_exist
189
+ repo_path.join("cookbooks/sample").should_not be_exist
190
+ end
191
+ end
192
+
171
193
  end
172
194
  end
173
195
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-17 00:00:00.000000000Z
12
+ date: 2011-09-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &25703580 !ruby/object:Gem::Requirement
16
+ requirement: &22746980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *25703580
24
+ version_requirements: *22746980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &25703120 !ruby/object:Gem::Requirement
27
+ requirement: &22746540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *25703120
35
+ version_requirements: *22746540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &25702660 !ruby/object:Gem::Requirement
38
+ requirement: &22746080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *25702660
46
+ version_requirements: *22746080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &25702220 !ruby/object:Gem::Requirement
49
+ requirement: &22745600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *25702220
57
+ version_requirements: *22745600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: webmock
60
- requirement: &25701800 !ruby/object:Gem::Requirement
60
+ requirement: &22745180 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *25701800
68
+ version_requirements: *22745180
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: chef
71
- requirement: &25701280 !ruby/object:Gem::Requirement
71
+ requirement: &22705600 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0.10'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *25701280
79
+ version_requirements: *22705600
80
80
  description: Librarian
81
81
  email:
82
82
  - y_feldblum@yahoo.com