Sha256: 2ddd04471280b9448a423db221f7d6f844d835fa71bd8573aeac9425199a5ba7

Contents?: true

Size: 895 Bytes

Versions: 201

Compression:

Stored size: 895 Bytes

Contents

# encoding: utf-8
require 'travis/cli'

module Travis
  module CLI
    class Pubkey < RepoCommand
      attr_accessor :key_format
      description "prints out a repository's public key"
      on('-p', '--pem', 'encode in format used by pem') { |c,_| c.key_format = :pem }
      on('-f', '--fingerprint', 'display fingerprint')  { |c,_| c.key_format = :fingerprint }

      def run
        error "#{key_format} format not supported by #{api_endpoint}" unless key
        say key, "Public key for #{color(repository.slug, :info)}:\n\n%s", :bold
      end

      private

        def key
          key = repository.public_key
          case self.key_format ||= :ssh
          when :fingerprint then key.fingerprint
          when :pem         then key.to_s
          when :ssh         then key.to_ssh
          else raise "unknown format #{key_format}"
          end
        end
    end
  end
end

Version data entries

201 entries across 201 versions & 3 rubygems

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