Class: Spiceweasel::Berksfile
- Inherits:
-
Object
- Object
- Spiceweasel::Berksfile
- Includes:
- CommandHelper
- Defined in:
- lib/spiceweasel/berksfile.rb
Instance Attribute Summary collapse
-
#cookbook_list ⇒ Object
readonly
Returns the value of attribute cookbook_list.
-
#create ⇒ Object
readonly
Returns the value of attribute create.
-
#delete ⇒ Object
readonly
Returns the value of attribute delete.
Instance Method Summary collapse
-
#initialize(berkshelf = nil) ⇒ Berksfile
constructor
A new instance of Berksfile.
Methods included from CommandHelper
#create_command, #delete_command
Constructor Details
#initialize(berkshelf = nil) ⇒ Berksfile
Returns a new instance of Berksfile.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/spiceweasel/berksfile.rb', line 28 def initialize(berkshelf=nil) @create = [] @delete = [] @cookbook_list = {} # only load berkshelf if we are going to use it require 'berkshelf' = [] case berkshelf when String path = berkshelf when Hash path = berkshelf['path'] << berkshelf['options'] if berkshelf['options'] end path ||= './Berksfile' << "-b #{path}" = .join(' ') opts = Thor::Options.split(.split(' ')).last resolve_opts = Thor::Options.new(Berkshelf::Cli.tasks['upload'].).parse(opts) berks = Berkshelf::Berksfile.from_file(path) create_command("berks upload #{}") Berkshelf.ui.mute do Spiceweasel::Log.debug("berkshelf resolving dependencies: #{resolve_opts}") berks.resolve(resolve_opts).each do |cb| @cookbook_list[cb.cookbook_name] = cb.version delete_command("knife cookbook#{Spiceweasel::Config[:knife_options]} delete #{cb.cookbook_name} #{cb.version} -a -y") end end end |
Instance Attribute Details
#cookbook_list ⇒ Object (readonly)
Returns the value of attribute cookbook_list.
24 25 26 |
# File 'lib/spiceweasel/berksfile.rb', line 24 def cookbook_list @cookbook_list end |
#create ⇒ Object (readonly)
Returns the value of attribute create.
22 23 24 |
# File 'lib/spiceweasel/berksfile.rb', line 22 def create @create end |
#delete ⇒ Object (readonly)
Returns the value of attribute delete.
23 24 25 |
# File 'lib/spiceweasel/berksfile.rb', line 23 def delete @delete end |