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