Class: BuildTool::Commands::Modules::Enable

Inherits:
BuildTool::Commands::ModuleBasedCommand show all
Defined in:
lib/build-tool/commands/modules/enable.rb

Overview

BuildCommand

Instance Attribute Summary

Attributes inherited from Base

#cmd, #options, #parent

Instance Method Summary collapse

Methods inherited from BuildTool::Commands::ModuleBasedCommand

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

Methods inherited from Standard

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

Methods inherited from Base

#<=>, #cleanup_after_vcs_access, #complete_arguments, #complete_readline, #configuration, #debug, #debug2, #do_complete, #each_option, #error, #execute, #fullname, #info, #initialize, #log?, #quiet, #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::ModuleBasedCommand

Instance Method Details

#applicable?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/build-tool/commands/modules/enable.rb', line 32

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

#do_execute(args) ⇒ Object



36
37
38
39
40
# File 'lib/build-tool/commands/modules/enable.rb', line 36

def do_execute( args )
    super( args )
    configuration.save()
    return 0
end

#do_execute_module(mod) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/build-tool/commands/modules/enable.rb', line 42

def do_execute_module( mod )

    if @default and mod.default_active? == true
        info( '%-35s: using default (enabled).' % mod.name )
        mod.active = nil
    else
        info( '%-35s: enabled explicitely.' % mod.name )
        mod.active = true
    end
end

#initialize_optionsObject



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

def initialize_options
    options.banner = "Usage: #{self.fullname} [OPTIONS]... FEATURE..."
    options.separator( "" )
    options.separator( "Options" )

    @default = false
    options.on( "--default", "Set to use default state if possible." ) { |t|
        @default = true
        }

    super

    # We want to allways match all modules here.
    @all = true
end