Class: Mona::Project

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

Defined Under Namespace

Classes: Builder, Factory, FindRoot, Initializer

Constant Summary collapse

DEFAULT_OPTIONS =
{
  configs_dir: 'configs',
  package_dirname: 'package',
  packages_lookup_subdir: ".",
  loader: Mona::Loaders::Base,
  tasks: []
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixins

included

Constructor Details

#initialize(root_path:, env:, loader: nil, configs_dir: nil, package_dirname: nil, packages_lookup_subdir: nil, tasks: nil) ⇒ Project

Returns a new instance of Project.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mona/project.rb', line 26

def initialize(root_path:, env:, loader: nil, configs_dir: nil, package_dirname: nil, packages_lookup_subdir: nil, tasks: nil)
  @root_path = root_path
  @env = env
  @packages = []

  @loader = loader || DEFAULT_OPTIONS.fetch(:loader).new(@root_path)
  @tasks = tasks || DEFAULT_OPTIONS.fetch(:tasks)
  @configs_dir = configs_dir || DEFAULT_OPTIONS.fetch(:configs_dir)
  @package_dirname = package_dirname || DEFAULT_OPTIONS.fetch(:package_dirname)
  @packages_lookup_subdir = packages_lookup_subdir || DEFAULT_OPTIONS.fetch(:packages_lookup_subdir)

  nil
end

Instance Attribute Details

#configs_dirObject (readonly)

Returns the value of attribute configs_dir.



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

def configs_dir
  @configs_dir
end

#envObject (readonly)

Returns the value of attribute env.



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

def env
  @env
end

#loaderObject (readonly)

Returns the value of attribute loader.



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

def loader
  @loader
end

#package_dirnameObject (readonly)

Returns the value of attribute package_dirname.



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

def package_dirname
  @package_dirname
end

#packagesObject (readonly)

Returns the value of attribute packages.



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

def packages
  @packages
end

#packages_lookup_subdirObject (readonly)

Returns the value of attribute packages_lookup_subdir.



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

def packages_lookup_subdir
  @packages_lookup_subdir
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



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

def root_path
  @root_path
end

#tasksObject (readonly)

Returns the value of attribute tasks.



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

def tasks
  @tasks
end

Instance Method Details

#set_packages(packages) ⇒ Object



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

def set_packages(packages)
  @packages = packages
end