berkshelf_ext 1.0.14 → 1.0.16

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## v1.0.16
2
+ * Add nesting support to `install` command (#2)
3
+
1
4
  ## v1.0.14
2
5
  * Use chef configurations from berks config if unset by knife
3
6
  * Fix exception namespacing
data/README.md CHANGED
@@ -68,5 +68,9 @@ all the addons, just set the everything env variable:
68
68
  3. https://github.com/RiotGames/berkshelf/pull/302
69
69
  4. https://github.com/RiotGames/berkshelf/pull/291
70
70
 
71
+ # Contributors
72
+
73
+ * [Vasily Mikhaylichenko](https://github.com/vaskas)
74
+
71
75
  # Info
72
76
  * Repository: https://github.com/chrisroberts/berkshelf_ext
Binary file
@@ -13,6 +13,12 @@ module BerkshelfExt
13
13
  :desc => 'Restrict nesting to this depth. Defaults to "0" (no restriction)'
14
14
  )
15
15
  )
16
+ %w{upload install}.each do |cmd|
17
+ klass.tasks[cmd].options[:nested_berksfiles] = Thor::Option.new(
18
+ 'nested_berksfiles', :type => :boolean, :default => false,
19
+ :desc => 'Use Berksfiles found within cookbooks specifed in Berksfile'
20
+ )
21
+ end
16
22
  end
17
23
  end
18
24
  end
@@ -23,10 +29,13 @@ module BerkshelfExt
23
29
  klass.class_eval do
24
30
  alias_method :non_nested_berksfiles_resolver, :resolver
25
31
  alias_method :resolver, :nested_berksfiles_resolver
32
+
33
+ alias_method :non_nested_berksfile_install, :install
34
+ alias_method :install, :nested_berksfile_install
26
35
  end
27
36
  end
28
37
  end
29
-
38
+
30
39
  def nested_berksfiles_resolver(options={})
31
40
  Berkshelf::Resolver.new(
32
41
  self.downloader,
@@ -36,6 +45,19 @@ module BerkshelfExt
36
45
  nested_depth: options[:nested_depth]
37
46
  )
38
47
  end
48
+
49
+ def nested_berksfile_install(options = {})
50
+ resolver = nested_berksfiles_resolver(options)
51
+
52
+ @cached_cookbooks = resolver.resolve
53
+ write_lockfile(resolver.sources) unless lockfile_present?
54
+
55
+ if options[:path]
56
+ self.class.vendor(@cached_cookbooks, options[:path])
57
+ end
58
+
59
+ self.cached_cookbooks
60
+ end
39
61
  end
40
62
 
41
63
  module Resolver
@@ -48,7 +70,7 @@ module BerkshelfExt
48
70
  end
49
71
  end
50
72
  end
51
-
73
+
52
74
  def nested_berksfiles_initialize(downloader, options={})
53
75
  @nested_depth_limit = options[:nested_depth].to_i
54
76
  skip_deps = options[:skip_dependencies]
@@ -2,6 +2,6 @@ module BerkshelfExt
2
2
  class Version < Gem::Version
3
3
  end
4
4
 
5
- VERSION = Version.new('1.0.14')
5
+ VERSION = Version.new('1.0.16')
6
6
  BERKSHELF_CONSTRAINT = '~> 1.3.1'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: berkshelf
@@ -61,6 +61,7 @@ files:
61
61
  - lib/berkshelf_ext/berksfile_loader_context.rb
62
62
  - lib/berkshelf_ext.rb
63
63
  - README.md
64
+ - berkshelf_ext-1.0.14.gem
64
65
  - berkshelf_ext.gemspec
65
66
  - bin/berks_ext
66
67
  - CHANGELOG.md