Sha256: baef8f4227d39001012082c456482457a4cb38e942e9e50b4129b9a77ba955e2

Contents?: true

Size: 1.03 KB

Versions: 385

Compression:

Stored size: 1.03 KB

Contents

require 'travis/cli'

module Travis
  module CLI
    class Endpoint < ApiCommand
      description "displays or changes the API endpoint"

      skip :authenticate
      on '--drop-default', 'delete stored default endpoint'
      on '--set-default', 'store endpoint as global default'
      on '--github', 'display github endpoint'

      def run_github
        error "--github cannot be combined with --drop-default" if drop_default?
        error "--github cannot be combined with --set-default" if set_default?
        load_gh
        say github_endpoint.to_s, "GitHub endpoint: %s"
      end

      def run_travis
        if drop_default? and was = config['default_endpoint']
          config.delete('default_endpoint')
          say was, "default API endpoint dropped (was %s)"
        else
          config['default_endpoint'] = api_endpoint if set_default?
          say api_endpoint, "API endpoint: %s#{" (stored as default)" if set_default?}"
        end
      end

      def run
        github? ? run_github : run_travis
      end
    end
  end
end

Version data entries

385 entries across 385 versions & 3 rubygems

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