Sha256: 2ca43b03813804c52395bd9c3d6af16d7a00d13a82391d686eeac7bf9a57b159

Contents?: true

Size: 1.06 KB

Versions: 54

Compression:

Stored size: 1.06 KB

Contents

require "vmc/cli/app/base"

module VMC::App
  class Apps < Base
    IS_UTF8 = !!(ENV["LC_ALL"] || ENV["LC_CTYPE"] || ENV["LANG"] || "")["UTF-8"].freeze

    desc "Show app information"
    group :apps
    input :app, :desc => "App to show", :argument => :required,
          :from_given => by_name(:app)
    def app
      app = input[:app]

      if quiet?
        line app.name
      else
        display_app(app)
      end
    end

    def display_app(a)
      status = app_status(a)

      line "#{c(a.name, :name)}: #{status}"

      indented do
        line "platform: #{b(a.framework.name)} on #{b(a.runtime.name)}"

        start_line "usage: #{b(human_mb(a.memory))}"
        print " #{d(IS_UTF8 ? "\xc3\x97" : "x")} #{b(a.total_instances)}"
        print " instance#{a.total_instances == 1 ? "" : "s"}"

        line

        unless a.urls.empty?
          line "urls: #{a.urls.collect { |u| b(u) }.join(", ")}"
        end

        unless a.services.empty?
          line "services: #{a.services.collect { |s| b(s.name) }.join(", ")}"
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 4 rubygems

Version Path
cloulu-1.0.0 lib/vmc/cli/app/app.rb
cloulu-0.7.0 lib/vmc/cli/app/app.rb
cloulu-0.6.6 lib/vmc/cli/app/app.rb
cloulu-0.6.5 lib/vmc/cli/app/app.rb
cloulu-0.6.1 lib/vmc/cli/app/app.rb
cloulu-0.6.0 lib/vmc/cli/app/app.rb
cloulu-0.5.1 lib/vmc/cli/app/app.rb
cloulu-0.5.0 lib/vmc/cli/app/app.rb
cloulu-0.3.0 lib/vmc/cli/app/app.rb
cloulu-0.2.6 lib/vmc/cli/app/app.rb
cloulu-0.2.5 lib/vmc/cli/app/app.rb
cloulu-0.2.4 lib/vmc/cli/app/app.rb
cloulu-0.2.3 lib/vmc/cli/app/app.rb
cloulu-0.2.1 lib/vmc/cli/app/app.rb
cloulu-0.2.0 lib/vmc/cli/app/app.rb
cloulu-0.1.6 lib/vmc/cli/app/app.rb
cloulu-0.1.5 lib/vmc/cli/app/app.rb
cloulu-0.1.2 lib/vmc/cli/app/app.rb
cloulu-0.1.1 lib/vmc/cli/app/app.rb
vmc-0.5.1 lib/vmc/cli/app/app.rb