Sha256: 0a0f576718bdaf8e51f5e0b51bd2bb92ec60ab0c25780bd0034d7841871753fb

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'knife_cookbook_dependencies/dsl'

module KnifeCookbookDependencies
  class Cookbookfile
    class << self
      include DSL
      def read content
        # This will populate KnifeCookbookDependencies.shelf. TODO: consider making this
        # build and return the shelf rather than building the shelf as
        # a side effect.
        instance_eval(content)
      end

      def process_install
        # TODO: friendly error message when the file doesn't exist
        
        filename = KnifeCookbookDependencies::DEFAULT_FILENAME + ".lock"
        lockfile = false

        if File.exist?(filename)
          lockfile = true
        else
          filename = KnifeCookbookDependencies::DEFAULT_FILENAME unless File.exist?(filename)
        end
          
        read File.open(filename).read
        KnifeCookbookDependencies.shelf.resolve_dependencies
        KnifeCookbookDependencies.shelf.populate_cookbooks_directory
        KnifeCookbookDependencies.shelf.write_lockfile unless lockfile
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knife_cookbook_dependencies-0.0.1 lib/knife_cookbook_dependencies/cookbookfile.rb