Class: Bake::App

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

Constant Summary collapse

@@instance =
nil

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



21
22
23
24
25
26
# File 'lib/bake.rb', line 21

def initialize
    raise "App instance already created" if @@instance
    @@instance = self
    @scheme_loader = SchemeLoader.new
    @context = Context.new(@scheme_loader)
end

Class Method Details

.instanceObject



17
18
19
# File 'lib/bake.rb', line 17

def self.instance
    return @@instance
end

Instance Method Details

#run(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/bake.rb', line 28

def run(*args)
    options, args = parse_command_line(*args)
    props, targets = process_excess_args(*args)
    props[:platform] = determine_platform

    @project_loader = ProjectLoader.new(@context, Dir.pwd, props)
    targets = targets.collect do |name|
        target = @project_loader.invok_project.find(name)
        if !target
            raise CommandLineParseError,
                "could not find target '#{name}'"
        end
        target
    end

    method = options[:clean] ? :clean : :build
    if targets.empty?
        send(method, @project_loader.invok_project)
    else
        targets.each { |target| send(method, target) }
    end
end