Sha256: 1ab992a7eba9fcaa96b44f93497623dae6af5ee749c4d858338208fd8bd770e7

Contents?: true

Size: 1.91 KB

Versions: 12

Compression:

Stored size: 1.91 KB

Contents

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

require 'build-tool/commands'

module BuildTool; module Commands; module Environments

    #
    # BuildCommand
    #
    class List < Standard

        name        "list"
        description "List all available environments in alphabetical order."
        long_description [ "Shows the list of  all environments of the current recipe."]
        cmdalias    "lsenv"

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

            @all = false
            options.on( "--all", "Show inactive environments." ) { |t|
                @all = true
                }
                super
        end

        def do_execute( args )
            if args.length == 0

                info( "%-15s (%s)" % [ "Environment", "Inherits" ] )
                info( "------------------------------------------------------------" )
                configuration.environments.keys.sort.each do |name|
                    env = configuration.environment(name)
                    next if !env.active? && !@all
                    if env.parent
                        info( "%-15s %s" % [ name, env.parent.name ] )
                    else
                        info( name )
                    end
                end

            elsif args.length == 1

                info( "Environment:" )
                env = configuration.environment( args[ 0 ] )
                if env.parent
                    info( "%-15s %s" % [ "Parent", env.parent.name ] )
                end
                env.vars.sort.each do |var|
                    info( "  %-20s %s" % [ var + ":", env[var] ] )
                end

            else

                return usage( "To many arguments" )

            end

            return 0
        end

    end # class

end; end; end # module BuildTool::Commands::Environments


Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
build-tool-0.6.9 lib/build-tool/commands/environments/list.rb
build-tool-0.6.8 lib/build-tool/commands/environments/list.rb
build-tool-0.6.7 lib/build-tool/commands/environments/list.rb
build-tool-0.6.6 lib/build-tool/commands/environments/list.rb
build-tool-0.6.5 lib/build-tool/commands/environments/list.rb
build-tool-0.6.4 lib/build-tool/commands/environments/list.rb
build-tool-0.6.3 lib/build-tool/commands/environments/list.rb
build-tool-0.6.2 lib/build-tool/commands/environments/list.rb
build-tool-0.6.1 lib/build-tool/commands/environments/list.rb
build-tool-0.6.0 lib/build-tool/commands/environments/list.rb
build-tool-0.6.0.rc2 lib/build-tool/commands/environments/list.rb
build-tool-0.6.0.rc1 lib/build-tool/commands/environments/list.rb