Class: Bake::ProjectLoader

Inherits:
Object show all
Defined in:
lib/bake/project_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, invok_dir, props) ⇒ ProjectLoader

Returns a new instance of ProjectLoader.



10
11
12
13
14
# File 'lib/bake/project_loader.rb', line 10

def initialize(context, invok_dir, props)
    @context = context
    load_root_project(invok_dir, props)
    load_invok_project
end

Instance Attribute Details

#invok_projectObject (readonly)

Returns the value of attribute invok_project.



8
9
10
# File 'lib/bake/project_loader.rb', line 8

def invok_project
  @invok_project
end

Instance Method Details

#load_project(parent, name) ⇒ Object

Loads a child project of the project given by parent. It does this by searching for directory called name in parent‘s :cwdir. Raises a ProjectLoadError if no such directory exists. If the directory contains a bakefile, it will be processed in this ProjectLoader’s context.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/bake/project_loader.rb', line 21

def load_project(parent, name)
    dir = File.join(parent[:cwdir], name)
    if !File.directory?(dir)
        raise ProjectLoadError, "no such directory '#{dir}'"
    end
    proj = Project.new(parent, @context.default_toolset, self)
    proj.name = name
    proj.opt(:projname => name)
    proj.opt(:cwdir => dir)
    process(proj)
    return proj
end