Class: BuildTool::Commands::ModuleProgressbar

Inherits:
MJ::Logging::Progressbar show all
Defined in:
lib/build-tool/commands.rb

Overview

class Standard

Instance Method Summary collapse

Constructor Details

#initialize(title, mod, &block) ⇒ ModuleProgressbar

Returns a new instance of ModuleProgressbar.



457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/build-tool/commands.rb', line 457

def initialize( title, mod, &block )
    super( title, mod.size ) do
        mod.each_with_index do |mod, i|
            if @pbar
                @pbar.set( i )
                @pbar.title= mod.name.split( '/' )[-1]
            end
            yield mod
        end
        @pbar.title= 'finished' if @pbar
    end
end

Instance Method Details

#write(event) ⇒ Object



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/build-tool/commands.rb', line 471

def write( event )
    message = event.data
    return if message.empty?

    # Remove the progressbar and print the message
    case event.level
    when ::Logging::level_num( :ERROR ), ::Logging::level_num( :WARN ),  ::Logging::level_num( :INFO )
        begin
            @pbar.clear()       if @pbar
            @oldlogger.append(event)
        rescue Exception => e
            error( e )
            verbose( e.backtrace.join("\n") )
        end
    end
end