Class: BuildTool::Commands::Modules::List
- Defined in:
- lib/build-tool/commands/modules/list.rb
Overview
BuildCommand
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #do_execute(args) ⇒ Object
- #initialize_options ⇒ Object
- #show_module(mod) ⇒ Object
- #show_modules(mods) ⇒ Object
Methods inherited from Standard
#complete_module, #complete_modules, #initialize, #log_directory, #while_logging_to
Methods inherited from Base
#<=>, #applicable?, #cleanup_after_vcs_access, #complete_arguments, #complete_readline, #configuration, #debug, #debug2, #do_complete, #each_option, #error, #execute, #fullname, #info, #initialize, #log?, #setup_command, #setup_options, #show_help, #skip_command, #summarize, #teardown_command, #trace, #usage, #verbose, #warn
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
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/build-tool/commands/modules/list.rb', line 68 def do_execute( args ) # *TODO* listing local and remote recipes if args.length == 0 show_modules( configuration.modules ) else args.each do |arg| mods = complete_modules( arg, @template ) next if !mods show_modules( mods ) end end return 0 end |
#initialize_options ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/build-tool/commands/modules/list.rb', line 31 def . = "Usage: #{self.fullname} [OPTIONS]... [MODULE|GROUP]..." .separator( "" ) .separator( "Options" ) @all = true @active = true @inactive = false .on( "--all", "Include inactive modules." ) { @active = true @inactive = true } .on( "--disabled", "Only show inactive modules." ) { @active = false @inactive = true } @template = false .on( "--template", "Include template modules." ) { @template = true } @broken = false .on( "--broken", "Show only broken modules." ) { @broken = true } @sort = true .on( "--no-sort", "Show modules in order of declaration." ) { @sort = false } super end |
#show_module(mod) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/build-tool/commands/modules/list.rb', line 90 def show_module( mod ) return if @broken and not mod.broken? if mod.active? return if not @active else return if not @inactive end return if mod.is_template? and not @template if @broken info( "%s%s %-35s : %-25s" % [ mod.active_char, mod.state_char, mod.name, mod.state ] ) else info( "%s%s %-35s : %s" % [ mod.active_char, mod.state_char, mod.name, mod.description || "No description specified" ] ) end end |
#show_modules(mods) ⇒ Object
83 84 85 86 87 88 |
# File 'lib/build-tool/commands/modules/list.rb', line 83 def show_modules( mods ) mods = mods.sort if @sort mods.each do |mod| show_module( mod ) end end |