Sha256: f968fb6acd45fc18768ad8d2fab023a7d01899cffdccb7ee5542723c223651b3

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

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: #{Pathname.new($0).basename} #{self.fullname}"

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

        def do_execute( args )
            if args.length != 0
                return usage( "To many arguments." )
            end

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

            return 0
        end

    end # class

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


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
build-tool-0.3.3 lib/build-tool/commands/environments/list.rb
build-tool-0.3.2 lib/build-tool/commands/environments/list.rb
build-tool-0.3.1 lib/build-tool/commands/environments/list.rb
build-tool-0.3 lib/build-tool/commands/environments/list.rb