def add(cart_type)
cart = check_cartridges(cart_type, :from => not_standalone_cartridges).first
say "Adding #{cart.short_name} to application '#{options.app}' ... "
say format_usage_message(cart) if cart.usage_rate?
rest_app = find_app(:include => :cartridges)
supports_env_vars = rest_app.supports_add_cartridge_with_env_vars?
supports_gear_size = rest_app.supports_add_cartridge_with_gear_size?
cart.environment_variables = collect_env_vars(options.env).map { |item| item.to_hash } if options.env && supports_env_vars
cart.gear_size = options.gear_size if options.gear_size && supports_gear_size
rest_cartridge = rest_app.add_cartridge(cart)
success "done"
rest_cartridge.environment_variables = cart.environment_variables if cart.environment_variables.present?
paragraph{ display_cart(rest_cartridge) }
paragraph{ say "Use 'rhc env --help' to manage environment variable(s) on this cartridge and application." } if cart.environment_variables.present?
paragraph{ warn "Server does not support environment variables." if options.env && !supports_env_vars }
paragraph{ warn "Server does not support gear sizes for cartridges." if options.gear_size && !supports_gear_size }
paragraph{ rest_cartridge.messages.each { |msg| success msg } }
0
end