Sha256: 3bf57dd8dd4a0c0b8c7248e83021a34ff19a57652704bc77980215e7b40ffef1

Contents?: true

Size: 1.71 KB

Versions: 49

Compression:

Stored size: 1.71 KB

Contents

module CF::App
  module PushInteractions
    def ask_name
      ask("Name")
    end

    def ask_host(name)
      ask "Subdomain", :choices => [name, "none"],
        :default => name,
        :allow_other => true
    end

    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

    def ask_memory(default)
      ask("Memory Limit",
          :choices => memory_choices,
          :allow_other => true,
          :default => default || "128M")
    end

    def ask_instances
      ask("Instances", :default => 1)
    end

    def ask_command
      command = ask("Custom startup command", :default => "none")

      if command != "none"
        command
      end
    end

    def ask_create_services
      line unless quiet?
      ask "Create services for application?", :default => false
    end

    def ask_bind_services
      return if all_instances.empty?

      ask "Bind other services to application?", :default => false
    end

    private

    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
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
cf-5.2.0 lib/cf/cli/app/push/interactions.rb
cf-5.1.0.rc1 lib/cf/cli/app/push/interactions.rb
cf-5.0.0.rc4 lib/cf/cli/app/push/interactions.rb
cf-5.0.0.rc3 lib/cf/cli/app/push/interactions.rb
cf-5.0.0.rc1 lib/cf/cli/app/push/interactions.rb
cf-4.2.9.rc5 lib/cf/cli/app/push/interactions.rb
cf-4.2.9.rc3 lib/cf/cli/app/push/interactions.rb
cf-4.2.10.rc2 lib/cf/cli/app/push/interactions.rb
cf-4.2.10.rc1 lib/cf/cli/app/push/interactions.rb
cf-4.2.9.rc2 lib/cf/cli/app/push/interactions.rb
cf-4.2.8 lib/cf/cli/app/push/interactions.rb
cf-4.2.8.rc2 lib/cf/cli/app/push/interactions.rb
cf-4.2.8.rc1 lib/cf/cli/app/push/interactions.rb
cf-4.2.7 lib/cf/cli/app/push/interactions.rb
cf-4.2.6 lib/cf/cli/app/push/interactions.rb
cf-4.2.5 lib/cf/cli/app/push/interactions.rb
cf-4.2.4 lib/cf/cli/app/push/interactions.rb
cf-4.2.3 lib/cf/cli/app/push/interactions.rb
cf-4.2.2.rc3 lib/cf/cli/app/push/interactions.rb
cf-4.2.2.rc2 lib/cf/cli/app/push/interactions.rb