Sha256: dc215e377469a9431e05e5ec196f3da7ee985d12900992be77f7a3c9c7c118a2

Contents?: true

Size: 968 Bytes

Versions: 207

Compression:

Stored size: 968 Bytes

Contents

require 'travis/cli'

module Travis
  module CLI
    class Accounts < ApiCommand
      description "displays accounts and their subscription status"

      def run
        authenticate
        accounts.each do |account|
          color = account.on_trial? ? :info : :green
          say [
            color(account.login, [color, :bold]),
            color("(#{account.name || account.login.capitalize}):", color),
            "#{description(account)},",
            account.repos_count == 1 ? "1 repository" : "#{account.repos_count} repositories"
          ].join(" ")
        end
        unless accounts.none?(&:on_trial?) or session.config['host'].nil?
          say session.config['host'], "To set up a subscription, please visit %s."
        end
      end

      def description(account)
        return "subscribed"          if account.subscribed?
        return "educational account" if account.educational?
        "not subscribed"
      end
    end
  end
end

Version data entries

207 entries across 207 versions & 3 rubygems

Version Path
travis-1.8.12.travis.1101.9 lib/travis/cli/accounts.rb
travis-1.8.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1098.9 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1081.9 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1059.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1058.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1056.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1051.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1048.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1044.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1041.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1040.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1026.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1025.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1024.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1022.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1021.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1020.11 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1012.9 lib/travis/cli/accounts.rb
travis-1.8.11.travis.1011.9 lib/travis/cli/accounts.rb