Class: BuildTool::ModuleBasedCommand

Inherits:
Command show all
Defined in:
lib/kde-build/command/module_based.rb

Instance Method Summary collapse

Methods inherited from Command

#complete, #show_help

Instance Method Details

#execute(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kde-build/command/module_based.rb', line 7

def execute( args )

    # If no argument is given show the help and quit.
    if args.length == 0
        show_help
        return
    end

    # Map the command line to real modules
    real_modules = []
    ModuleRegistry.get_modules( args ) do |mod|
        # Check if the module is fit for the command
        if is_module_ready( mod )
            real_modules.push( mod )
        end
    end

    # Execute the command for each module
    real_modules.each do |mod|
        begin

            execute_for_module( mod )

        rescue Interrupt => e
            $log.info("SIGBREAK recieved.")
            return

        rescue Exception => e
            $log.info("error: #{e.class}: #{e.message}")
            puts e.backtrace if $verbose
        end

    end
end