Class: BuildTool::Commands::Gc

Inherits:
ModuleBasedCommand show all
Defined in:
lib/build-tool/commands/gc.rb

Overview

BuildCommand

Instance Attribute Summary

Attributes inherited from Base

#cmd, #options, #parent

Instance Method Summary collapse

Methods inherited from ModuleBasedCommand

#clean, #clone, #configure, #fetch, #initialize, #install, #is_module_ready?, #make, #rebase, #reconfigure, #summarize

Methods inherited from Standard

#complete_modules, #initialize, #log_directory, #while_logging_to

Methods inherited from Base

#<=>, #cleanup_after_vcs_access, #complete, #complete_arguments, #complete_readline_1_8, #complete_readline_1_9, #configuration, #do_complete_1_8, #do_complete_1_9, #each_option, #execute, #fullname, #initialize, #log?, #say, #setup_command, #show_help, #skip_command, #summarize, #teardown_command, #usage

Methods included from HelpText

#cmdalias, #description, included, #long_description, #name

Constructor Details

This class inherits a constructor from BuildTool::Commands::ModuleBasedCommand

Instance Method Details

#applicable?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/build-tool/commands/gc.rb', line 21

def applicable?
    BuildTool::Application.instance.has_recipe?
end

#do_execute(args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/build-tool/commands/gc.rb', line 25

def do_execute( args )
    case args.length

    when 0
        # Nothing
        #
    else
        super
    end

    BuildTool::History::CommandLog.older_than.each do |cmd|
        if cmd.logdir
            if $noop
                say "rm -rf #{cmd.logdir}"
            else
                logger.debug("Removing #{cmd.logdir}");
                FileUtils.rm_rf( cmd.logdir ) if File.exist?( cmd.logdir )
            end
        end
        cmd.destroy
    end
    return 0
end

#do_execute_module(mod) ⇒ Object



49
50
51
# File 'lib/build-tool/commands/gc.rb', line 49

def do_execute_module( mod )
    mod.gc
end

#initialize_optionsObject



16
17
18
19
# File 'lib/build-tool/commands/gc.rb', line 16

def initialize_options
    @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} [MODULE|GROUP]..."
    super
end