Sha256: 53517a723077f39f40ddeb3f617a0792b11d16cf8036907f83f10f8f402544d3

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

class MonoRepoDeps::Package
  include MonoRepoDeps::Mixins

  attr_reader :name, :root_path, :dependencies, :configs

  DEFAULT_ENV = :_default_

  sig do
    params(
      name: Symbol,
      root_path: String,
      package_dirname: String,
      dependencies: T::Hash[Symbol, Symbol]
    )
    .void
  end
  def initialize(name:, root_path:, package_dirname:, dependencies:)
    @name = name
    @root_path = root_path
    @package_dirname = package_dirname
    @dependencies = dependencies

    nil
  end

  sig do
    params(env: T.nilable(Symbol)).returns(T::Array[Symbol])
  end
  def get_dependencies(env = nil)
    default_deps = @dependencies.fetch(DEFAULT_ENV, [])
    env_deps     = @dependencies.fetch(env, [])

    default_deps | env_deps
  end

  def get_bc
    # /app/bounded_contexts/jobs/microservices/jobs_app
    @root_path.split('/')[3]
  end

  def get_dependency_envs
    @dependencies.keys
  end

  def workdir_path
    File.join( self.root_path, @package_dirname )
  end

  def entrypoint_file
    File.join( self.workdir_path, "#{name}.rb" )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mono_repo_deps-0.2.0 lib/mono_repo_deps/package.rb