def identify(directory)
      raw = json(directory)

      dependencies = raw['dependencies'].to_h

      dependency_sources =
        raw['dependency-sources']
        .to_h
        .merge(@dependency_sources)

      dependencies.map do |package, constraint|
        constraints = Utils.transform_constraint constraint

        type =
          if dependency_sources.key?(package)
            source = dependency_sources[package]
            case source
            when Hash
              uri_type source['url'], Branch::Just(source['ref'])
            when String
              if File.exist?(source)
                Type::Directory(Pathname.new(source))
              else
                uri_type source, Branch::Just('master')
              end
            end
          else
            Type::Git(Uri::Github(package), Branch::Nothing())
          end

        type.source.identifier = self
        type.source.options = @options

        Dependency.new(package, type.source, constraints)
      end
    end
def identify(directory)
      raw = json(directory)

      dependencies = raw['dependencies'].to_h

      dependency_sources =
        raw['dependency-sources']
        .to_h
        .merge(@dependency_sources)

      dependencies.map do |package, constraint|
        constraints = Utils.transform_constraint constraint

        type =
          if dependency_sources.key?(package)
            source = dependency_sources[package]
            case source
            when Hash
              uri_type source['url'], Branch::Just(source['ref'])
            when String
              if File.exist?(source)
                Type::Directory(Pathname.new(source))
              else
                uri_type source, Branch::Just('master')
              end
            end
          else
            Type::Git(Uri::Github(package), Branch::Nothing())
          end

        type.source.identifier = self
        type.source.options = @options

        Dependency.new(package, type.source, constraints)
      end
    end
Identifies dependencies from a directory

 @param directory [Dir] The directory

 @return [Array] The dependencies