class Berkshelf::Berksfile

def add_dependency(name, constraint = nil, options = {})

Returns:
  • (Array - Array

Raises:

  • (DuplicateDependencyDefined) - if a dependency is added whose name conflicts

Options Hash: (**options)
  • :git (String) --
  • :path (String) --
  • :group (Symbol, Array) --

Parameters:
  • constraint (String, Semverse::Constraint) --
  • name (String) --
def add_dependency(name, constraint = nil, options = {})
  if @dependencies[name]
    # Only raise an exception if the dependency is a true duplicate
    groups = (options[:group].nil? || options[:group].empty?) ? [:default] : options[:group]
    unless (@dependencies[name].groups & groups).empty?
      raise DuplicateDependencyDefined.new(name)
    end
  end
  # this appears to be dead code
  # if options[:path]
  #  metadata_file = File.join(options[:path], "metadata.rb")
  # end
  options[:constraint] = constraint
  @dependencies[name] = Dependency.new(self, name, options)
end