Sha256: 60a4ac60f27d58a1a98044ff41d0593b80dfa6cf9cd92db455339033f38bf295

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

# -*- coding: UTF-8 -*-

require 'build-tool/commands'

module BuildTool; module Commands; module Modules

    #
    # BuildCommand
    #
    class Enable < ModuleBasedCommand

        name        'enable'
        description 'Enable the given modules.'
        long_description [ 'Sets the modules status.' ]

        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

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

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

        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

    end # class Activate

end; end; end # module BuildTool::Commands::Modules



Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
build-tool-0.6.9 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.8 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.7 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.6 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.5 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.4 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.3 lib/build-tool/commands/modules/enable.rb
build-tool-0.6.2 lib/build-tool/commands/modules/enable.rb