Sha256: cb7ee479c8cef80eda5e19df0e3c789f230c88e3e59819046b1d8327430f38f3

Contents?: true

Size: 1.06 KB

Versions: 26

Compression:

Stored size: 1.06 KB

Contents

require "shelly/cli/command"

module Shelly
  module CLI
    class Organization < Command
      namespace :organization
      include Helpers

      before_hook :logged_in?, :only => [:list]

      desc "list", "Lists organizations"
      def list
        user = Shelly::User.new
        organizations = user.organizations
        say "You have access to the following organizations and clouds:", :green
        say_new_line
        organizations.each do |organization|
          say organization.name, :green
          if organization.apps.present?
            apps_table = organization.apps.map do |app|
              state = app.state
              msg = if state == "deploy_failed" || state == "configuration_failed"
                " (deployment log: `shelly deploys show last -c #{app["code_name"]}`)"
              end
              [app.to_s, "|  #{state.humanize}#{msg}"]
            end
            print_table(apps_table, :ident => 2, :colwidth => 35)
          else
            print_wrapped "No clouds", :ident => 2
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
shelly-0.2.19 lib/shelly/cli/organization.rb
shelly-0.2.18 lib/shelly/cli/organization.rb
shelly-0.2.17 lib/shelly/cli/organization.rb
shelly-0.2.16 lib/shelly/cli/organization.rb
shelly-0.2.15 lib/shelly/cli/organization.rb
shelly-0.2.14 lib/shelly/cli/organization.rb
shelly-0.2.13 lib/shelly/cli/organization.rb
shelly-0.2.12 lib/shelly/cli/organization.rb
shelly-0.2.11 lib/shelly/cli/organization.rb
shelly-0.2.10 lib/shelly/cli/organization.rb
shelly-0.2.9 lib/shelly/cli/organization.rb
shelly-0.2.8 lib/shelly/cli/organization.rb
shelly-0.2.7 lib/shelly/cli/organization.rb
shelly-0.2.6.pre lib/shelly/cli/organization.rb
shelly-0.2.5 lib/shelly/cli/organization.rb
shelly-0.2.4 lib/shelly/cli/organization.rb
shelly-0.2.3 lib/shelly/cli/organization.rb
shelly-0.2.2 lib/shelly/cli/organization.rb
shelly-0.2.1 lib/shelly/cli/organization.rb
shelly-0.2.0 lib/shelly/cli/organization.rb