berkshelf 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -151,14 +151,25 @@ module Berkshelf
151
151
  # Server so that it cannot be overwritten
152
152
  def upload(chef_server_url, options = {})
153
153
  uploader = Uploader.new(chef_server_url, options)
154
- resolver = Resolver.new(Berkshelf.downloader, sources(exclude: options[:without]))
154
+ solution = resolve(options)
155
155
 
156
- resolver.resolve.each do |cb|
156
+ solution.each do |cb|
157
157
  Berkshelf.ui.info "Uploading #{cb.cookbook_name} (#{cb.version}) to: '#{chef_server_url}'"
158
158
  uploader.upload!(cb, options)
159
159
  end
160
160
  end
161
161
 
162
+ # Finds a solution for the Berksfile and returns an array of CachedCookbooks.
163
+ #
164
+ # @option options [Symbol, Array] :without
165
+ # Group(s) to exclude which will cause any sources marked as a member of the
166
+ # group to not be resolved
167
+ #
168
+ # @return [Array<Berkshelf::CachedCookbooks]
169
+ def resolve(options = {})
170
+ Resolver.new(Berkshelf.downloader, sources(exclude: options[:without])).resolve
171
+ end
172
+
162
173
  # Write a collection of hard links to the given path representing the given
163
174
  # CachedCookbooks. Useful for getting Cookbooks in a single location for
164
175
  # consumption by Vagrant, or another tool that expect this structure.
@@ -29,7 +29,7 @@ module Berkshelf
29
29
  template "Berksfile.erb", File.join(target_path, "Berksfile")
30
30
 
31
31
  if options[:chefignore]
32
- copy_file "chefignore", File.join(target_path, ".chefignore")
32
+ copy_file "chefignore", File.join(target_path, "chefignore")
33
33
  end
34
34
  end
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -121,6 +121,17 @@ EOF
121
121
  end
122
122
  end
123
123
 
124
+ describe "#resolve" do
125
+ let(:resolver) { double('resolver') }
126
+ before(:each) { Berkshelf::Resolver.stub(:new) { resolver } }
127
+
128
+ it "resolves the Berksfile" do
129
+ resolver.should_receive(:resolve).and_return([double('cached_cookbook_one'), double('cached_cookbook_two')])
130
+ solution = subject.resolve
131
+ solution.should have(2).items
132
+ end
133
+ end
134
+
124
135
  describe "#install" do
125
136
  let(:resolver) { double('resolver') }
126
137
  before(:each) { Berkshelf::Resolver.stub(:new) { resolver } }
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: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-06-25 00:00:00.000000000 Z
15
+ date: 2012-06-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: dep_selector
@@ -458,7 +458,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
458
458
  version: '0'
459
459
  segments:
460
460
  - 0
461
- hash: 2507702980010171500
461
+ hash: 135561862523341822
462
462
  requirements: []
463
463
  rubyforge_project:
464
464
  rubygems_version: 1.8.23