travis 1.6.4.travis.414.4 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjRjNjRiMmY4NGFkYTAxZjI0OTEzM2QyMDg1MmY4MWI5YzRkNDgwNA==
5
- data.tar.gz: !binary |-
6
- ZmUyZDZiMjU2MDlmODdjNGVlM2EzODJmNjlmZjU3ZTA4MmUzNWY2Nw==
2
+ SHA1:
3
+ metadata.gz: 1f1ea5e031378d36f8bfc8c283759b5c3301d553
4
+ data.tar.gz: 4e3479d161a7ff7e7982296a1644b77e0fa463aa
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjY5Mjc1MDJjODdiZjkxZjA3Yjk0OGJlYmQ1NWQ3NmJjZmU1NDMzNGQzN2Jl
10
- MmE0Y2FkOTViNzVjMWI1NTkyZjk1ZmM2ODkzZmY3YWE2ZmZhZDBlODVhZDYx
11
- ZmQyMmE4NTc2MDBjNzQyNWZmOWI0ODgwYjQ1MTdhN2U3MjQzMDI=
12
- data.tar.gz: !binary |-
13
- MzQ2YzRjNjQ1M2YwYzQzYTBjNDIyZjMwZTFmZjQxZDIyYTFlM2NlYjE3MTE2
14
- OTdlN2VkZTU4NDdlYjdiY2ZmMmRjMjM4MTdhNjI3ZGE3NGQ5MjYyNmFhYjI2
15
- ODU0NmRiMDJjMDJiYmNjNGNiYjg4Y2IwNmEwMDU0MjQ2MzY4OTY=
6
+ metadata.gz: 51019cc944b229a081725a343df8b3000c141d04d4a036cc1f0c07587affd58866a8a5e6b6abc45db1ea2acf7d83a97e306cc507927408d7b0a64ca2b7169233
7
+ data.tar.gz: 89b49e317f304fa2cabc9dd28bb2f5b8c6c148e6831345057daf1ca2514f3992296bb70e044d7dba831657ca424c26c0e612551cfb43700a2b5f4dcd695cd0a9
data/README.md CHANGED
@@ -1081,6 +1081,26 @@ puts "Hello #{Travis::User.current.name}!"
1081
1081
 
1082
1082
  Travis CI will not store that token.
1083
1083
 
1084
+ It also ships with a tool for generating a GitHub token from a user name and password via the GitHub API:
1085
+
1086
+ ``` ruby
1087
+ require 'travis'
1088
+ require 'travis/tools/github'
1089
+
1090
+ # drop_token will make the token a temporary one
1091
+ github = Travis::Tools::Github.new(drop_token: true) do |g|
1092
+ g.ask_login = -> { print("GitHub login: "); gets }
1093
+ g.ask_password = -> { print("Password: "); gets }
1094
+ g.ask_otp = -> { print("Two-factor token: "); gets }
1095
+ end
1096
+
1097
+ github.with_token do |token|
1098
+ Travis.github_auth(token)
1099
+ end
1100
+
1101
+ puts "Hello #{Travis::User.current.name}!"
1102
+ ```
1103
+
1084
1104
  ### Using Pro
1085
1105
 
1086
1106
  Using the library with private projects pretty much works the same, except you use `Travis::Pro`.
@@ -1475,12 +1495,12 @@ You can check your Ruby version by running `ruby -v`:
1475
1495
 
1476
1496
  Then run:
1477
1497
 
1478
- $ gem install travis -v 1.6.3 --no-rdoc --no-ri
1498
+ $ gem install travis -v 1.6.5 --no-rdoc --no-ri
1479
1499
 
1480
1500
  Now make sure everything is working:
1481
1501
 
1482
1502
  $ travis version
1483
- 1.6.3
1503
+ 1.6.5
1484
1504
 
1485
1505
  ### Development Version
1486
1506
 
@@ -1535,16 +1555,21 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
1535
1555
 
1536
1556
  ## Version History
1537
1557
 
1538
- **1.6.4** (not yet released)
1558
+ **1.6.5** (December 16, 2013)
1539
1559
 
1540
1560
  * Add `travis settings` command for accessing repository settings.
1541
1561
  * Add `travis setup opsworks`.
1542
1562
  * Add `travis console -x` to run a line of Ruby code with a valid session.
1563
+ * Add authentication and streaming example for Ruby library.
1543
1564
  * Add Ruby API for dealing with repository settings.
1544
1565
  * Improve `travis login` and `travis login --auto`. Add ability to load GitHub token from Keychain.
1545
1566
  * Only ask for GitHub two-factor auth token if two-factor auth is actually required.
1546
1567
  * Fix access right check for `travis caches`.
1547
1568
 
1569
+ **1.6.4** (December 16, 2013)
1570
+
1571
+ Release was yanked. See 1.6.5 for changes.
1572
+
1548
1573
  **1.6.3** (November 27, 2013)
1549
1574
 
1550
1575
  * Fix OS detection on Windows.
File without changes
@@ -0,0 +1,23 @@
1
+ require 'travis/pro'
2
+ require 'travis/tools/github'
3
+ require 'highline/import' # so we can hide the password
4
+
5
+ # Set up GitHub tool for doing the login handshake.
6
+ github = Travis::Tools::Github.new(drop_token: true) do |g|
7
+ g.ask_login = -> { ask("GitHub login: ") }
8
+ g.ask_password = -> { ask("Password: ") { |q| q.echo = "*" } }
9
+ g.ask_otp = -> { ask("Two-factor token: ") }
10
+ end
11
+
12
+ # Create temporary GitHub token and use it to authenticate against Travis CI.
13
+ github.with_token do |token|
14
+ Travis::Pro.github_auth(token)
15
+ end
16
+
17
+ # Look up the current user.
18
+ user = Travis::Pro::User.current
19
+ puts "Hello #{user.name}!"
20
+
21
+ # Display repositories the user is a member of.
22
+ repos = Travis::Pro::Repository.find_all(member: user.login)
23
+ repos.each { |repo| puts "#{repo.slug} #{repo.last_build_state}" }
@@ -0,0 +1,6 @@
1
+ require 'travis'
2
+
3
+ Travis.listen do |listener|
4
+ listener.on("job:started") { |e| puts "job started for #{e.repository.slug}" }
5
+ listener.on("job:finished") { |e| puts "job finished for #{e.repository.slug}" }
6
+ end
data/lib/travis/cli.rb CHANGED
@@ -71,7 +71,7 @@ module Travis
71
71
  end
72
72
 
73
73
  def commands
74
- CLI.constants.map { |n| CLI.const_get(n) }.select { |c| command? c }
74
+ CLI.constants.map { |n| try_const_get(n) }.select { |c| command? c }
75
75
  end
76
76
 
77
77
  def silent
@@ -85,13 +85,18 @@ module Travis
85
85
 
86
86
  private
87
87
 
88
+ def try_const_get(name)
89
+ CLI.const_get(name)
90
+ rescue Exception
91
+ end
92
+
88
93
  def dummy_io
89
94
  return StringIO.new unless defined? IO::NULL and IO::NULL
90
95
  File.open(IO::NULL, 'w')
91
96
  end
92
97
 
93
98
  def command?(constant)
94
- constant and constant < Command and not constant.abstract?
99
+ constant.is_a? Class and constant < Command and not constant.abstract?
95
100
  end
96
101
 
97
102
  def command_name(name)
@@ -45,7 +45,7 @@ module Travis
45
45
  end
46
46
 
47
47
  def with_session(&block)
48
- with_token { |t| GH.with(:token => t, &block) }
48
+ with_token { |t| GH.with(:token => t) { yield(t) } }
49
49
  end
50
50
 
51
51
  def possible_tokens(&block)
@@ -70,7 +70,7 @@ module Travis
70
70
  if manual_login
71
71
  login_header.call if login_header
72
72
  user = github_login || ask_login.call
73
- password = ask_password.call(user)
73
+ password = ask_password.arity == 0 ? ask_password.call : ask_password.call(user)
74
74
  yield login(user, password, true)
75
75
  end
76
76
 
@@ -200,7 +200,8 @@ module Travis
200
200
  reply['token']
201
201
  rescue GH::Error => error
202
202
  if error.info[:response_status] == 401 and error.info[:response_headers]['x-github-otp'].to_s =~ /required/
203
- login(user, password, die, ask_otp.call(user))
203
+ otp = ask_otp.arity == 0 ? ask_otp.call : ask_otp.call(user)
204
+ login(user, password, die, otp)
204
205
  elsif die
205
206
  raise gh_error(error)
206
207
  end
@@ -1,3 +1,3 @@
1
1
  module Travis
2
- VERSION = '1.6.3'
2
+ VERSION = '1.6.5'
3
3
  end
data/travis.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # general infos
4
4
  s.name = "travis"
5
- s.version = "1.6.3"
5
+ s.version = "1.6.5"
6
6
  s.description = "CLI and Ruby client library for Travis CI"
7
7
  s.homepage = "https://github.com/travis-ci/travis"
8
8
  s.summary = "Travis CI client"
@@ -98,7 +98,9 @@ Gem::Specification.new do |s|
98
98
  "assets/travis.sh",
99
99
  "assets/travis.sh.erb",
100
100
  "bin/travis",
101
- "example/org_overview.rb",
101
+ "examples/org_overview.rb",
102
+ "examples/pro_auth.rb",
103
+ "examples/stream.rb",
102
104
  "lib/travis.rb",
103
105
  "lib/travis/cli.rb",
104
106
  "lib/travis/cli/accounts.rb",
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.6.4.travis.414.4
4
+ version: 1.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -30,7 +30,7 @@ authors:
30
30
  autorequire:
31
31
  bindir: bin
32
32
  cert_chain: []
33
- date: 2013-12-15 00:00:00.000000000 Z
33
+ date: 2013-12-16 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: faraday
@@ -92,14 +92,14 @@ dependencies:
92
92
  name: backports
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ! '>='
95
+ - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ! '>='
102
+ - - '>='
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  - !ruby/object:Gem::Dependency
@@ -291,7 +291,9 @@ files:
291
291
  - assets/travis.sh
292
292
  - assets/travis.sh.erb
293
293
  - bin/travis
294
- - example/org_overview.rb
294
+ - examples/org_overview.rb
295
+ - examples/pro_auth.rb
296
+ - examples/stream.rb
295
297
  - lib/travis.rb
296
298
  - lib/travis/cli.rb
297
299
  - lib/travis/cli/accounts.rb
@@ -418,18 +420,19 @@ require_paths:
418
420
  - lib
419
421
  required_ruby_version: !ruby/object:Gem::Requirement
420
422
  requirements:
421
- - - ! '>='
423
+ - - '>='
422
424
  - !ruby/object:Gem::Version
423
425
  version: '0'
424
426
  required_rubygems_version: !ruby/object:Gem::Requirement
425
427
  requirements:
426
- - - ! '>'
428
+ - - '>='
427
429
  - !ruby/object:Gem::Version
428
- version: 1.3.1
430
+ version: '0'
429
431
  requirements: []
430
432
  rubyforge_project:
431
- rubygems_version: 2.1.11
433
+ rubygems_version: 2.0.7
432
434
  signing_key:
433
435
  specification_version: 4
434
436
  summary: Travis CI client
435
437
  test_files: []
438
+ has_rdoc: