travis 1.5.6.travis.329.4 → 1.5.6.travis.330.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmE4ZjA2Y2FkNzhhNmM4YzViYzlhZTE4MDI0OTdmNWM5OWE0OTg5NA==
4
+ NWUyYTBlYjM5MDJhMTdmYjk5YTQ0NDU2MmNlNzk3YTE0NWI2MTRhYg==
5
5
  data.tar.gz: !binary |-
6
- NjI4Y2YyZmY4MDY5YjMwNmRlODgyZDU4ODZlMDU0YTI5NDE3MjBlMQ==
6
+ NDQxN2I3N2ZiZjMxMTQwMzIyZjRlYmRiNThjZWRjODY4NDhkOGRjYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTM3NmIzZjhlZGEyNGE2OWRjMjIzZjc2YmFlZTI0YmI0YTU4ZjJkOTcxNWY2
10
- OGZmNmE5ZmE1YzE4YWUwN2I4ODEyYjU4MDNlZDY3NDk1YTdmMmFiYWUxNzMy
11
- NzhhMjE2YTE1YzgyODQzOWI2OGM2ZGE3MjJmZWFkNGIzODYwZmM=
9
+ YjAzNDhlODQyOGRhNDc0NTkwOTg3MmE3NDQzMWY2NjEzOTM0NWQ0YjI3YTkw
10
+ NTE4NzA5MjBiYjhjMGFlZDhjNTNmYzVhYzRmOWI0ZmI2MzljYzEzOTQ5YjUy
11
+ OTkxNzJhMWNjYzlmODY4Nzg5YzEwYzc4MmJjZDIzZWM0OTgzMGI=
12
12
  data.tar.gz: !binary |-
13
- NjUwMWUxYTdjOWM0M2IyZjA0MzUyZGQzZmUyNDBmOTFhOWExNmE2YmNiNzJk
14
- MTlkZjk0YWRkMzVlMThlNmZkZjUyMjI3NTg4YjA4Yjc3NDViMWM1NGM0YTdj
15
- ZmY2ZjQ2NTE3YmZkMGFkOGFkM2RmMDJmOTVjYWM5OTcwM2Y0NDU=
13
+ YTNmY2QwZTc4ZTUyM2M0NzI3MWVjYTM0YTg4MDQ0Y2YwMmM2ZGFmMDQxYTBm
14
+ ZjNiYTg4MWQ3MDcyZmI1N2I4MDA2MmY3M2I5MDdlZjczZWY3NjljNTYzMTQ3
15
+ YjI3ZjBmZWY5ZTc2YTU1ZDZmZGUwMGEzYzc5MjY0OWJkMzY1ZGI=
data/README.md CHANGED
@@ -36,6 +36,7 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line
36
36
  * [`setup`](#setup)
37
37
  * [`show`](#show)
38
38
  * [`status`](#status)
39
+ * [Pro and Enterprise](#pro-and-enterprise)
39
40
  * [Environment Variables](#environment-variables)
40
41
  * [Ruby Library](#ruby-library)
41
42
  * [Authentication](#authentication)
@@ -110,8 +111,6 @@ Additionally, every API command understands the following options:
110
111
  --debug show API requests
111
112
  --adapter ADAPTER Faraday adapter to use for HTTP requests
112
113
 
113
- By default, [General API Commands](#general-api-commands) will talk to [api.travis-ci.org](https://api.travis-ci.org). You can change this by supplying `--pro` for [api.travis-ci.com](https://api.travis-ci.com) or `--api-endpoint` with your own endpoint. Note that all [Repository Commands](#repository-commands) will try to figure out the API endpoint to talk to automatically depending on the project's visibility on GitHub.
114
-
115
114
  You can supply an access token via `--token` if you want to make an authenticated call. If you don't have an access token stored for the API endpoint, it will remember it for subsequent requests. Keep in mind, this is not the "Travis token" used when setting up GitHub hooks (due to security). You probably don't have an access token handy right now. Don't worry, usually you won't use this option but instead just do a [`travis login`](#login).
116
115
 
117
116
  The `--debug` option will print HTTP requests to STDERR. Like `--explode`, this is really helpful when contributing to this project.
@@ -775,6 +774,30 @@ Outputs a one line status message about the project's last build. With `-q` that
775
774
 
776
775
  $ travis status -qpx && cap deploy
777
776
 
777
+ ### Pro and Enterprise
778
+
779
+ By default, [General API Commands](#general-api-commands) will talk to [api.travis-ci.org](https://api.travis-ci.org). You can change this by supplying `--pro` for [api.travis-ci.com](https://api.travis-ci.com) or `--api-endpoint` with your own endpoint. Note that all [Repository Commands](#repository-commands) will try to figure out the API endpoint to talk to automatically depending on the project's visibility on GitHub.
780
+
781
+ $ travis login --pro
782
+ ...
783
+ $ travis monitor --pro -m
784
+ ...
785
+
786
+ The custom `--api-endpoint` option is handy for local development:
787
+
788
+ $ travis whatsup --api-endpoint http://localhost:3000
789
+ ...
790
+
791
+ If you have a Travis Enterprise setup in house, you can use the `--enterprise` (or short `-X`) option. It will ask you for the enterprise domain the first time it is used.
792
+
793
+ $ travis login -X
794
+ Enterprise domain: travisci.example.com
795
+ ...
796
+ $ travis whatsup -X
797
+ ...
798
+
799
+ Note that currently [Repository Commands](#repository-commands) will not be able to detect Travis Enterprise automatically at the moment. You will have to use the `-X` flag at least once per repository. The command line tool will remember the API endpoint for subsequent commands issued against the same repository.
800
+
778
801
  ### Environment Variables
779
802
 
780
803
  You can set the following environment variables to influence the travis behavior:
@@ -1299,7 +1322,11 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
1299
1322
  * Fix double `provider` entry generated by `travis setup engineyard`.
1300
1323
  * Only load auto-completions if available.
1301
1324
  * Fix and improve growl notifications.
1302
- * Fix netrc parsing for `travis login --auto`.
1325
+ * Fix GitHub host detection `travis login --auto`.
1326
+ * API endpoint may now include a path all the requests will be prefixed with.
1327
+ * Allow overriding SSL options in Ruby client.
1328
+ * Add `--insecure` to turn off SSL verification.
1329
+ * Add `--enterprise`/`-X` option for Travis Enterprise integration.
1303
1330
 
1304
1331
  **1.5.5** (October 2, 2013)
1305
1332
 
@@ -4,10 +4,12 @@ module Travis
4
4
  module CLI
5
5
  class ApiCommand < Command
6
6
  include Travis::Client::Methods
7
+ attr_accessor :enterprise_name
7
8
  attr_reader :session
8
9
  abstract
9
10
 
10
11
  on('-e', '--api-endpoint URL', 'Travis API server to talk to')
12
+ on('-I', '--[no-]insecure', 'do not verify SSL certificate of API endpoint')
11
13
  on('--pro', "short-cut for --api-endpoint '#{Travis::Client::PRO_URI}'") { |c,_| c.api_endpoint = Travis::Client::PRO_URI }
12
14
  on('--org', "short-cut for --api-endpoint '#{Travis::Client::ORG_URI}'") { |c,_| c.api_endpoint = Travis::Client::ORG_URI }
13
15
  on('--staging', 'talks to staging system') { |c,_| c.api_endpoint = c.api_endpoint.gsub(/api/, 'api-staging') }
@@ -23,6 +25,10 @@ module Travis
23
25
  end
24
26
  end
25
27
 
28
+ on('-X', '--enterprise [NAME]', 'use enterprise setup (optionally takes name for multiple setups)') do |c, name|
29
+ c.enterprise_name = name || 'default'
30
+ end
31
+
26
32
  on('--adapter ADAPTER', 'Faraday adapter to use for HTTP requests') do |c, adapter|
27
33
  adapter.gsub! '-', '_'
28
34
  require "faraday/adapter/#{adapter}"
@@ -41,9 +47,13 @@ module Travis
41
47
  end
42
48
 
43
49
  def setup
50
+ setup_enterprise if enterprise?
44
51
  self.api_endpoint = default_endpoint if default_endpoint and not explicit_api_endpoint?
45
52
  self.access_token ||= fetch_token
46
53
  endpoint_config['access_token'] ||= access_token
54
+ endpoint_config['insecure'] = insecure unless insecure.nil?
55
+ self.insecure = endpoint_config['insecure']
56
+ session.ssl = { :verify => false } if insecure?
47
57
  authenticate if pro?
48
58
  end
49
59
 
@@ -80,6 +90,23 @@ module Travis
80
90
 
81
91
  private
82
92
 
93
+ def setup_enterprise
94
+ c = config['enterprise'] ||= {}
95
+ c[enterprise_name] = api_endpoint if explicit_api_endpoint?
96
+ c[enterprise_name] ||= write_to($stderr) do
97
+ error "enterprise setup not configured" unless interactive?
98
+ user_input = ask(color("Enterprise domain: ", :bold)).to_s
99
+ domain = user_input[%r{^(?:https?://)?(.*?)(?:/api/?)?$}, 1]
100
+ "https://#{domain}/api/"
101
+ end
102
+ self.api_endpoint = c[enterprise_name]
103
+ self.insecure = true if insecure.nil?
104
+ end
105
+
106
+ def enterprise?
107
+ !!enterprise_name
108
+ end
109
+
83
110
  def load_gh
84
111
  return if defined? GH
85
112
  require 'gh'
@@ -17,7 +17,7 @@ module Travis
17
17
  class Session
18
18
  SSL_OPTIONS = { :ca_file => File.expand_path("../../cacert.pem", __FILE__) }
19
19
  include Methods
20
- attr_reader :connection, :headers, :access_token, :instruments, :faraday_adapter, :agent_info
20
+ attr_reader :connection, :headers, :access_token, :instruments, :faraday_adapter, :agent_info, :ssl
21
21
 
22
22
  def initialize(options = Travis::Client::ORG_URI)
23
23
  @headers = {}
@@ -26,6 +26,7 @@ module Travis
26
26
  @agent_info = []
27
27
  @config = nil
28
28
  @faraday_adapter = defined?(Typhoeus) ? :typhoeus : :net_http
29
+ @ssl = SSL_OPTIONS
29
30
 
30
31
  options = { :uri => options } unless options.respond_to? :each_pair
31
32
  options.each_pair { |key, value| public_send("#{key}=", value) }
@@ -44,9 +45,14 @@ module Travis
44
45
  set_user_agent
45
46
  end
46
47
 
48
+ def ssl=(options)
49
+ @ssl = options.dup.freeze
50
+ self.uri = uri if uri
51
+ end
52
+
47
53
  def uri=(uri)
48
54
  clear_cache!
49
- self.connection = Faraday.new(:url => uri, :ssl => SSL_OPTIONS) do |faraday|
55
+ self.connection = Faraday.new(:url => uri, :ssl => ssl) do |faraday|
50
56
  faraday.request :url_encoded
51
57
  faraday.response :json
52
58
  faraday.response :follow_redirects
@@ -154,8 +160,11 @@ module Travis
154
160
  raw(:put, *args)
155
161
  end
156
162
 
157
- def raw(verb, *args)
158
- instrumented(verb.to_s.upcase, *args) { connection.public_send(verb, *args).body }
163
+ def raw(verb, url, *args)
164
+ url = url.sub(/^\//, '')
165
+ result = instrumented(verb.to_s.upcase, url, *args) { connection.public_send(verb, url, *args) }
166
+ raise Travis::Client::Error, 'SSL error: could not verify peer' if result.status == 0
167
+ result.body
159
168
  rescue Faraday::Error::ClientError => e
160
169
  handle_error(e)
161
170
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6.travis.329.4
4
+ version: 1.5.6.travis.330.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase