# -*- 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