Sha256: d162767b658919ff68ff6cb1da8a7133b63aa1b330aa269a7d4bf559b18c3973

Contents?: true

Size: 1.49 KB

Versions: 12

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

        def do_execute_module( mod )
            mod.gc
        end

    end # class Info

end; end # module BuildTool::Commands


Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
build-tool-0.5.7 lib/build-tool/commands/gc.rb
build-tool-0.5.6 lib/build-tool/commands/gc.rb
build-tool-0.5.5 lib/build-tool/commands/gc.rb
build-tool-0.5.4 lib/build-tool/commands/gc.rb
build-tool-0.5.3 lib/build-tool/commands/gc.rb
build-tool-0.5.2 lib/build-tool/commands/gc.rb
build-tool-0.4.6 lib/build-tool/commands/gc.rb
build-tool-0.5.1 lib/build-tool/commands/gc.rb
build-tool-0.4.5 lib/build-tool/commands/gc.rb
build-tool-0.5.0 lib/build-tool/commands/gc.rb
build-tool-0.4.4 lib/build-tool/commands/gc.rb
build-tool-0.4.3 lib/build-tool/commands/gc.rb