Sha256: 3503d5fb818fcb1a0c6d4891569e07cebfc50b12ac85198025983e903252799f

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

require 'minimart/inventory_requirement/local_path_requirement'

module Minimart
  module InventoryRequirement
    # This class is used to parse any local path requirements specified in the inventory
    # and build Minimart::Inventory::LocalPathRequirements from them.
    class LocalRequirementsBuilder

      # @return [String] the name of the cookbook defined by this requirement.
      attr_reader :name

      # @return [String] the path to the cookbook
      attr_reader :path

      # @param [String] name The name of the cookbook defined by this requirement.
      # @param [Hash] reqs
      # @option reqs [String] 'path' The path to the cookbook
      def initialize(name, reqs)
        @name = name
        @path = reqs['path']
      end

      # Build the local path requirements.
      # @return [Array<Minimart::InventoryRequirement::LocalPathRequirement>]
      def build
        return [] if path.nil? || path.empty?
        [InventoryRequirement::LocalPathRequirement.new(name, path: path)]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minimart-1.2.5 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.2.4 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.2.3 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.2.0 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.1.6 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.1.3 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.0.2 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-1.0.1 lib/minimart/inventory_requirement/local_requirements_builder.rb
minimart-0.0.1 lib/minimart/inventory_requirement/local_requirements_builder.rb