Class: BuildTool::Commands::Modules::List

Inherits:
Standard show all
Defined in:
lib/build-tool/commands/modules/list.rb

Overview

BuildCommand

Instance Attribute Summary

Attributes inherited from Base

#cmd, #options, #parent

Instance Method Summary collapse

Methods inherited from Standard

#complete_module, #complete_modules, #initialize, #log_directory, #while_logging_to

Methods inherited from Base

#<=>, #applicable?, #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::Standard

Instance Method Details

#do_execute(args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/build-tool/commands/modules/list.rb', line 34

def do_execute( args )
    # *TODO* listing local and remote recipes
    if args.length == 0
        configuration.modules.each do |mod|
            if @template or not mod.is_template?
                say "%-30s : %s" % [ mod.name, mod.description || "No description specified" ] if ( mod.active? || @all )
            end
        end
    else
        args.each do |arg|
            mods = complete_modules( arg, @template )
            next if !mods
            mods.each do |mod|
                say "%-30s : %s" % [ mod.name, mod.description || "No description specified" ] if ( mod.active? || @all )
            end
        end
    end

    return 0
end

#initialize_optionsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/build-tool/commands/modules/list.rb', line 16

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

    @template = false

    @options.separator "Options:"

    options.on( "--all", "Include inactive modules." ) {
        @all = true
        }

    options.on( "--template", "Include template modules." ) {
        @template = true
        }

    super
end