module CF::App::PushInteractions

Public Instance Methods

ask_bind_services() click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 55
def ask_bind_services
  return if all_instances.empty?

  ask "Bind other services to application?", :default => false
end
ask_command() click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 42
def ask_command
  command = ask("Custom startup command", :default => "none")

  if command != "none"
    command
  end
end
ask_create_services() click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 50
def ask_create_services
  line unless quiet?
  ask "Create services for application?", :default => false
end
ask_domain(app) click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 17
def ask_domain(app)
  choices = app.space.domains

  options = {
    :choices => choices + ["none"],
    :display => proc { |choice| choice.is_a?(String) ? choice : choice.name },
    :allow_other => true
  }

  options[:default] = choices.first

  ask "Domain", options
end
ask_host(name) click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 7
def ask_host(name)
  # Use .dup here because when we pass app.name deep into interactive,
  # it needs an unfrozen String because the cli allows people to change
  # this value.
  host = name.dup
  ask "Subdomain", :choices => [host, "none"],
    :default => host,
    :allow_other => true
end
ask_instances() click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 38
def ask_instances
  ask("Instances", :default => 1)
end
ask_memory(default) click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 31
def ask_memory(default)
  ask("Memory Limit",
      :choices => memory_choices,
      :allow_other => true,
      :default => default || "128M")
end
ask_name() click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 3
def ask_name
  ask("Name")
end

Private Instance Methods

ask_with_other(message, all, choices, default, other) click to toggle source
# File lib/cf/cli/app/push/interactions.rb, line 63
def ask_with_other(message, all, choices, default, other)
  choices = choices.sort_by(&:name)
  choices << other if other

  opts = {
    :choices => choices,
    :display => proc { |x|
      if other && x == other
        "other"
      else
        x.name
      end
    }
  }

  opts[:default] = default if default

  res = ask(message, opts)

  if other && res == other
    opts[:choices] = all
    res = ask(message, opts)
  end

  res
end