Sha256: 525943b5879888c9d8f6d23cb5f385933a7cd3977789cbfc7cb5a3b2829f97de

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

Contents

class Mona::Package
  include Mona::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_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

  def specs_path
    File.join( self.root_path, '/spec/' )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mona-0.2.3 lib/mona/package.rb
mona-0.2.2 lib/mona/package.rb