Sha256: 0b193e7ad051a698c5c84c04bcba78f420ebf7e5b07eaf47243ea12d289f5283

Contents?: true

Size: 1.02 KB

Versions: 24

Compression:

Stored size: 1.02 KB

Contents

require "vmc/cli/app/base"

module VMC::App
  class Crashes < Base
    desc "List an app's crashed instances"
    group :apps, :info, :hidden => true
    input :apps, :desc => "Applications whose crashed instances to list",
          :argument => :splat, :singular => :app, :from_given => by_name(:app)
    def crashes
      apps = input[:apps]
      fail "No applications given." if apps.empty?

      spaced(apps) do |app|
        instances =
          with_progress("Getting crashed instances for #{c(app.name, :name)}") do
            app.crashes
          end

        line unless quiet?

        spaced(instances) do |i|
          if quiet?
            line i.id
          else
            display_crashed_instance(i)
          end
        end
      end
    end

    def display_crashed_instance(i)
      start_line "instance #{c("\##{i.id}", :instance)}: "
      puts "#{b(c("crashed", :error))} "

      indented do
        if s = i.since
          line "since: #{c(s.strftime("%F %r"), :neutral)}"
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
vmc-0.5.1 lib/vmc/cli/app/crashes.rb
static-1.0.3 vendor/vmc-0.5.0/lib/vmc/cli/app/crashes.rb
vmc-0.5.1.rc6 lib/vmc/cli/app/crashes.rb
static-1.0.1 vendor/vmc-0.5.0/lib/vmc/cli/app/crashes.rb
vmc-0.5.1.rc5 lib/vmc/cli/app/crashes.rb
vmc-0.5.1.rc4 lib/vmc/cli/app/crashes.rb
vmc-0.5.1.rc3 lib/vmc/cli/app/crashes.rb
vmc-0.5.1.rc2 lib/vmc/cli/app/crashes.rb
vmc-0.5.1.rc1 lib/vmc/cli/app/crashes.rb
vmc-0.5.0 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.rc4 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.rc3 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.rc2 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.rc1 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.beta.12 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.beta.11 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.beta.10 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.beta.7 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.beta.6 lib/vmc/cli/app/crashes.rb
vmc-0.5.0.beta.5 lib/vmc/cli/app/crashes.rb