berkshelf 2.0.7 → 2.0.8
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.
- data/features/install_command.feature +1 -1
- data/lib/berkshelf/berksfile.rb +11 -7
- data/lib/berkshelf/cookbook_source.rb +1 -1
- data/lib/berkshelf/errors.rb +14 -1
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +1 -1
- data/spec/unit/berkshelf/formatters/null_spec.rb +1 -1
- metadata +2 -2
@@ -264,7 +264,7 @@ Feature: install cookbooks from a Berksfile
|
|
264
264
|
When I run `berks install`
|
265
265
|
Then the output should contain:
|
266
266
|
"""
|
267
|
-
No Berksfile or Berksfile.lock found at
|
267
|
+
No Berksfile or Berksfile.lock found at '
|
268
268
|
"""
|
269
269
|
And the CLI should exit with the status code for error "BerksfileNotFound"
|
270
270
|
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -6,11 +6,13 @@ module Berkshelf
|
|
6
6
|
#
|
7
7
|
# @return [Berksfile]
|
8
8
|
def from_file(file)
|
9
|
-
new(file).
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
raise BerksfileNotFound.new(file) unless File.exist?(file)
|
10
|
+
|
11
|
+
begin
|
12
|
+
new(file).dsl_eval_file(file)
|
13
|
+
rescue => ex
|
14
|
+
raise BerksfileReadError.new(ex)
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
18
|
# Copy all cached_cookbooks to the given directory. Each cookbook will be contained in
|
@@ -401,6 +403,8 @@ module Berkshelf
|
|
401
403
|
# @option options [String] :path
|
402
404
|
# a path to "vendor" the cached_cookbooks resolved by the resolver. Vendoring
|
403
405
|
# is a technique for packaging all cookbooks resolved by a Berksfile.
|
406
|
+
# @option options [Boolean] :update_lockfile (true)
|
407
|
+
# a boolean method indicating whether we should update the lockfile
|
404
408
|
#
|
405
409
|
# @raise [Berkshelf::OutdatedCookbookSource]
|
406
410
|
# if the lockfile constraints do not satisfy the Berskfile constraints
|
@@ -419,7 +423,7 @@ module Berkshelf
|
|
419
423
|
|
420
424
|
self.class.vendor(@cached_cookbooks, options[:path]) if options[:path]
|
421
425
|
|
422
|
-
lockfile.update(local_sources)
|
426
|
+
lockfile.update(local_sources) unless options[:update_lockfile] == false
|
423
427
|
|
424
428
|
self.cached_cookbooks
|
425
429
|
end
|
@@ -511,7 +515,7 @@ module Berkshelf
|
|
511
515
|
# if an attempt to upload a cookbook which has been frozen on the target server is made
|
512
516
|
# and the :halt_on_frozen option was true
|
513
517
|
def upload(options = {})
|
514
|
-
options = options.reverse_merge(force: false, freeze: true, skip_dependencies: false, halt_on_frozen: false)
|
518
|
+
options = options.reverse_merge(force: false, freeze: true, skip_dependencies: false, halt_on_frozen: false, update_lockfile: false)
|
515
519
|
|
516
520
|
cached_cookbooks = install(options)
|
517
521
|
upload_opts = options.slice(:force, :freeze)
|
@@ -186,7 +186,7 @@ module Berkshelf
|
|
186
186
|
def inspect
|
187
187
|
'#<Berkshelf::CookbookSource: ' << [
|
188
188
|
"#{name} (#{version_constraint})",
|
189
|
-
"locked_version: #{locked_version.
|
189
|
+
"locked_version: #{locked_version ? locked_version.to_s : 'nil'}",
|
190
190
|
"groups: #{groups}",
|
191
191
|
"location: #{location || 'default'}>"
|
192
192
|
].join(', ')
|
data/lib/berkshelf/errors.rb
CHANGED
@@ -19,7 +19,20 @@ module Berkshelf
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class BerksfileNotFound < BerkshelfError
|
22
|
+
class BerksfileNotFound < BerkshelfError
|
23
|
+
status_code(100)
|
24
|
+
|
25
|
+
# @param [#to_s] filepath
|
26
|
+
# the path where a Berksfile was not found
|
27
|
+
def initialize(filepath)
|
28
|
+
@filepath = File.dirname(File.expand_path(filepath)) rescue filepath
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
"No Berksfile or Berksfile.lock found at '#{@filepath}'!"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
23
36
|
class NoVersionForConstraints < BerkshelfError; status_code(101); end
|
24
37
|
class DuplicateLocationDefined < BerkshelfError; status_code(102); end
|
25
38
|
class CookbookNotFound < BerkshelfError; status_code(103); end
|
data/lib/berkshelf/version.rb
CHANGED
@@ -585,7 +585,7 @@ describe Berkshelf::Berksfile do
|
|
585
585
|
Dir.stub(:glob).and_return(['/there-are/no-spaces/in-this/recipes/default.rb'])
|
586
586
|
expect {
|
587
587
|
subject.validate_files!(cookbook)
|
588
|
-
}.to_not raise_error
|
588
|
+
}.to_not raise_error
|
589
589
|
end
|
590
590
|
|
591
591
|
it 'does not raise an exception with spaces in the path' do
|
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.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: activesupport
|