Class: BuildTool::ModuleActions::Base

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

Direct Known Subclasses

Clean, Clone, Configure, Fetch, Install, Make, Rebase, Reconfigure

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Base.



66
67
68
69
70
71
72
73
74
75
# File 'lib/build-tool/command_actions.rb', line 66

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/build-tool/command_actions.rb', line 77

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