Class: BuildTool::Commands::Modules::Disable

Inherits:
BuildTool::Commands::ModuleBasedCommand show all
Defined in:
lib/build-tool/commands/modules/disable.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)


47
48
49
# File 'lib/build-tool/commands/modules/disable.rb', line 47

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

#do_execute(args) ⇒ Object



51
52
53
54
55
# File 'lib/build-tool/commands/modules/disable.rb', line 51

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

#do_execute_module(mod) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/build-tool/commands/modules/disable.rb', line 57

def do_execute_module( mod )
    if @default and mod.default_active? == false
        info( '%s: using default (disabled).' % mod.name )
        mod.active = nil
    else
        info( '%s: disabled explicitely.' % mod.name )
        mod.active = false
    end

    if mod.source_directory.exist?
        if @remove_source_directory
            remove_source_directory( mod, true )
        else
            info( 'Source directory %s still exists.' % mod.source_directory )
            verbose( 'module clean --rm-src to remove it' )
        end
    elsif @remove_source_directory
        info( 'Source directory does not exist.' )
    end


    if mod.build_directory.exist?
        if @remove_build_directory
            remove_build_directory( mod, true )
        else
            info( 'Build directory %s still exists.' % mod.build_directory )
            verbose( 'module clean --rm-bld to remove it' )
        end
    elsif @remove_build_directory
        info( 'Build directory does not exist.' )
    end
end

#initialize_optionsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/build-tool/commands/modules/disable.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
        }

    @remove_build_directory = false
    options.on( "--rm-bld", "Remove the build directory." ) {
        @remove_build_directory = true
        }

    @remove_source_directory = false
    options.on( "--rm-src", "Remove the source directory." ) {
        @remove_source_directory = true
        }

    options.on( "--rm-both", "Remove the source and build directory." ) {
        @remove_source_directory = true
        @remove_build_directory = true
        }

    super

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