Class: Dapp::Dimg::Builder::Chef::CookbookMetadata::FromConfBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/dapp/dimg/builder/chef/cookbook_metadata.rb

Overview

FromFileBuilder

Instance Method Summary collapse

Methods inherited from Builder

#depends, #method_missing, #name, #version

Constructor Details

#initialize(metadata, name, version, cookbooks) ⇒ FromConfBuilder

Returns a new instance of FromConfBuilder.



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/dapp/dimg/builder/chef/cookbook_metadata.rb', line 84

def initialize(, name, version, cookbooks)
  super()

  @cookbooks = cookbooks

  @cookbooks.each do |cname, desc|
    depends(cname, desc[:version_constraint], **desc)
  end

  self.name name
  self.version version
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dapp::Dimg::Builder::Chef::CookbookMetadata::Builder

Instance Method Details

#dumpObject



97
98
99
100
101
102
103
104
105
106
# File 'lib/dapp/dimg/builder/chef/cookbook_metadata.rb', line 97

def dump
  [].tap do |lines|
    lines << "name #{@metadata.name.inspect}\n"
    lines << "version #{@metadata.version.inspect}\n"

    @cookbooks.keys.each do |cookbook|
      lines << "depends #{cookbook.inspect}\n" unless cookbook.start_with? 'dimod-'
    end
  end.join
end