Class: Mona::Package

Inherits:
Object
  • Object
show all
Includes:
Mixins
Defined in:
lib/mona/package.rb

Defined Under Namespace

Classes: Builder, DependencyBypasser, Factory, FindRoot, Indexer, Initializer, List, Repo

Constant Summary collapse

DEFAULT_ENV =
:_default_

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixins

included

Constructor Details

#initialize(name:, root_path:, package_dirname:, dependencies:) ⇒ Package

Returns a new instance of Package.



17
18
19
20
21
22
23
24
# File 'lib/mona/package.rb', line 17

def initialize(name:, root_path:, package_dirname:, dependencies:)
  @name = name
  @root_path = root_path
  @package_dirname = package_dirname
  @dependencies = dependencies

  nil
end

Instance Attribute Details

#configsObject (readonly)

Returns the value of attribute configs.



4
5
6
# File 'lib/mona/package.rb', line 4

def configs
  @configs
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



4
5
6
# File 'lib/mona/package.rb', line 4

def dependencies
  @dependencies
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/mona/package.rb', line 4

def name
  @name
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



4
5
6
# File 'lib/mona/package.rb', line 4

def root_path
  @root_path
end

Instance Method Details

#entrypoint_fileObject



44
45
46
# File 'lib/mona/package.rb', line 44

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

#get_dependencies(env = nil) ⇒ Object



29
30
31
32
33
34
# File 'lib/mona/package.rb', line 29

def get_dependencies(env = nil)
  default_deps = @dependencies.fetch(DEFAULT_ENV, [])
  env_deps     = @dependencies.fetch(env, [])

  default_deps | env_deps
end

#get_dependency_envsObject



36
37
38
# File 'lib/mona/package.rb', line 36

def get_dependency_envs
  @dependencies.keys
end

#specs_pathObject



48
49
50
# File 'lib/mona/package.rb', line 48

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

#workdir_pathObject



40
41
42
# File 'lib/mona/package.rb', line 40

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