Class: BuildTool::ModuleActions::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/build-tool/command_actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, prio, type, mod) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
20
21
22
23
# File 'lib/build-tool/command_actions.rb', line 14

def initialize( command, prio, type, mod )
    @command = command
    @level = nil
    @logdir = command.log_directory.join( mod.name )
    @type = type
    @prio = prio
    @filename = "#{prio.to_s}_#{type.to_s}"
    @logfile = @logdir.join( @filename )
    @module = mod
end

Instance Method Details

#doObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/build-tool/command_actions.rb', line 25

def do
    # Make sure the directory for this module exists
    FileUtils.mkdir_p( @logdir ) if ! $noop

    oldlevel = Logging.appenders['stdout'].level
    if @level
        Logging.appenders['stdout'].level = @level
    end

    # Open the logfile and then execute the command
    begin
        while_logging do
            execute
        end
    ensure
        Logging.appenders['stdout'].level = oldlevel
    end
end