Sha256: 73d6aa50d4825d66b697b137388b904379cea738315755806cdcd52f1da7e9fa

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

class MonoRepoDeps::Package::DependencyBypasser
  include MonoRepoDeps::Mixins

  Inject = MonoRepoDeps::Deps[
    packages_repo: "package.repo"
  ]

  include Inject

  sig do
    params(
      package_name: Symbol,
      env: Symbol,
      only: T.nilable(T::Array[Symbol]),
      skip: T.nilable(T::Array[Symbol]),
      imported: T::Array[Symbol],
      packages_order: T::Array[Symbol],
    )
    .returns(T::Array[Symbol])
  end
  def call(package_name:, env:, only: nil, skip: nil, imported: [], packages_order: [])
    package = packages_repo.find!(package_name)

    return [] if imported.include?(package_name)
    imported.push(package.name)

    package_dependencies = package.get_dependencies(env)
    package_dependencies = package_dependencies.select { only.include?(_1.name) } unless only.nil?
    package_dependencies = package_dependencies.reject { skip.include?(_1.name) } unless skip.nil?

    package_dependencies.each do |dependency_dto|
      self.call(
        package_name: dependency_dto.name,
        skip: dependency_dto.skip,
        only: dependency_dto.only,
        imported: imported,
        packages_order: packages_order,
        env: env
      )
    end

    packages_order.push(package_name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mono_repo_deps-0.1.14 lib/mono_repo_deps/package/dependency_bypasser.rb
mono_repo_deps-0.1.13 lib/mono_repo_deps/package/dependency_bypasser.rb