Sha256: a5e42395b7ad33bbe5adffa38446277225ca00fc8653edff97f38f6f7e62599d

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

require 'build-tool/commands'

module BuildTool; module Commands;

    #
    # BuildCommand
    #
    class Gc < ModuleBasedCommand

        name        "gc"
        description "Remove old stuff"
        long_description [ "Invokes maintenance actions. The history db is purged from entries older",
                           "than 10 days. If supplied do garbage collection for the modules too.",
                           "What that means is subject to the modules. See with -vvvv."]

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

        def applicable?
            BuildTool::Application.instance.name != "build-tool"
        end

        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
                        debug("Removing #{cmd.logdir}");
                        File.rm_rf( cmd.logdir ) if File.exist?( cmd.logdir )
                    end
                end
                cmd.delete
            end
            return 0
        end

        def do_execute_module( mod )
            mod.gc
        end

    end # class Info

end; end # module BuildTool::Commands


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
build-tool-0.3 lib/build-tool/commands/gc.rb