Sha256: fd9cff41d917bbe0277603724cee6bac5f81124e48f6835843c13e1af671f468

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

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(without=nil)
        # TODO: friendly error message when the file doesn't exist
        
        filename = KCD::DEFAULT_FILENAME + ".lock"
        lockfile = false

        if File.exist?(filename)
          lockfile = true
        else
          filename = KCD::DEFAULT_FILENAME unless File.exist?(filename)
        end

        begin
          read File.read(filename)
        rescue Errno::ENOENT => e
          KCD.ui.fatal ErrorMessages.missing_cookbookfile
          exit 100
        end

        KCD.shelf.exclude(without)
        KCD.shelf.resolve_dependencies
        KCD.shelf.populate_cookbooks_directory
        KCD.shelf.write_lockfile unless lockfile
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
knife_cookbook_dependencies_over_http-0.0.8.3 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies_over_http-0.0.8.2 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies_over_http-0.0.8.1 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies_over_http-0.0.8 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies-0.0.8 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies-0.0.7 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies-0.0.6 lib/kcd/cookbookfile.rb
knife_cookbook_dependencies-0.0.5 lib/kcd/cookbookfile.rb