travis 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e9ba04f7bc2ce5298cc1449e4d2835b26539b2f
4
- data.tar.gz: 3dc663c0c3726335d2e5393023ddf1ba4c187bb4
3
+ metadata.gz: 8f0be4644ffa1b11b883f5f9caa3b927e093a807
4
+ data.tar.gz: 90949786ac2590427e6539f9c3ac614cbb0a982b
5
5
  SHA512:
6
- metadata.gz: d08eecff707521d33acd5466764e151cb7e687fe4b191ffa12ee5ea2cb481ec9aa9aed8a4cef5b80b544757c97b97bbdded7c03daeffd86a4a0e0b3423b5d326
7
- data.tar.gz: 70f7ea86abb1f3260ccae4d34d337d61d00f7ba7579507d2be669e149fc9c6c2bb0e9fffcff91e1c6f2f16c87393ba3829fd1065a2c77a0ae0327f10ba78714e
6
+ metadata.gz: e20f8818e813c06e6fbd6fecb1714ab41b73c8b121a84c281891346a9652cd63171a6fb846527446ae40375bb6111b0c87928a2805b6f0ac996f8fb1b986b9d6
7
+ data.tar.gz: f60857f3566cc107eb1b188459571dd5fe99e6b612dedc5c64e98ae8b6732711e5750e91b0f1db849ee21ee31ce4ea59d0bfadf7fc7db8c41cfddc5640e3915c
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # The Travis Client
1
+ # The Travis Client [![Build Status](https://travis-ci.org/travis-ci/travis.png?branch=master)](https://travis-ci.org/travis-ci/travis)
2
2
 
3
- [![Build Status](https://travis-ci.org/travis-ci/travis.png?branch=master)](https://travis-ci.org/travis-ci/travis)
3
+ ![The Travis Mascot](http://about.travis-ci.org/images/travis-mascot-600px.png)
4
4
 
5
- The [travis gem](https://rubygems.org/gems/travis) includes both a command line client and a Ruby library to interface with a Travis CI service. Both work with [travis-ci.org](https://travis-ci.org), [travis-ci.com](https://travis-ci.com) or any custom Travis CI setup you might have.
5
+ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line client](#command-line-client) and a [Ruby library](#ruby-library) to interface with a Travis CI service. Both work with [travis-ci.org](https://travis-ci.org), [travis-ci.com](https://travis-ci.com) or any custom Travis CI setup you might have. Check out the [installation instructions](#installation) to get it running in no time.
6
6
 
7
7
  ## Table of Contents
8
8
 
@@ -25,6 +25,7 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a command line
25
25
  * [`enable`](#enable)
26
26
  * [`encrypt`](#encrypt)
27
27
  * [`history`](#history)
28
+ * [`init`](#init)
28
29
  * [`logs`](#logs)
29
30
  * [`open`](#open)
30
31
  * [`pubkey`](#pubkey)
@@ -47,11 +48,18 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a command line
47
48
  * [Dealing with Sessions](#dealing-with-sessions)
48
49
  * [Using Namespaces](#using-namespaces)
49
50
  * [Installation](#installation)
51
+ * [Updating your Ruby](#updating-your-ruby)
52
+ * [Mac OSX via Homebrew](#mac-osx-via-homebrew)
53
+ * [Windows](#windows)
54
+ * [Other Unix systems](#other-unix-systems)
55
+ * [Ruby versioning tools](#ruby-versioning-tools)
50
56
  * [Upgrading from travis-cli](#upgrading-from-travis-cli)
51
57
  * [Version History](#version-history)
52
58
 
53
59
  ## Command Line Client
54
60
 
61
+ ![](http://about.travis-ci.org/images/new-tricks.png)
62
+
55
63
  There are three types of commands: [Non-API Commands](#non-api-commands), [General API Commands](#general-api-commands) and [Repository Commands](#repository-commands). All commands take the form of `travis COMMAND [ARGUMENTS] [OPTIONS]`. You can get a list of commands by running [`help`](#help).
56
64
 
57
65
  ### Non-API Commands
@@ -324,7 +332,6 @@ If you don't want the sync to be triggered, use `--skip-sync`.
324
332
  -e, --api-endpoint URL Travis API server to talk to
325
333
  --pro short-cut for --api-endpoint 'https://api.travis-ci.com/'
326
334
  --org short-cut for --api-endpoint 'https://api.travis-ci.org/'
327
- --staging talks to staging system
328
335
  -t, --token [ACCESS_TOKEN] access token to use
329
336
  --debug show API requests
330
337
  --adapter ADAPTER Faraday adapter to use for HTTP requests
@@ -428,6 +435,55 @@ Or a certain Pull Request:
428
435
  #49 passed: Pull Request #5 improve output
429
436
  #48 passed: Pull Request #5 let it generate accessor for line splitting automatically
430
437
 
438
+ #### `init`
439
+
440
+ Usage: travis init [language] [file] [options]
441
+ -h, --help Display help
442
+ -i, --[no-]interactive be interactive and colorful
443
+ -E, --[no-]explode don't rescue exceptions
444
+ --skip-version-check don't check if travis client is up to date
445
+ -e, --api-endpoint URL Travis API server to talk to
446
+ --pro short-cut for --api-endpoint 'https://api.travis-ci.com/'
447
+ --org short-cut for --api-endpoint 'https://api.travis-ci.org/'
448
+ -t, --token [ACCESS_TOKEN] access token to use
449
+ --debug show API requests
450
+ --adapter ADAPTER Faraday adapter to use for HTTP requests
451
+ -r, --repo SLUG repository to use (will try to detect from current git clone)
452
+ -s, --skip-sync don't trigger a sync if the repo is unknown
453
+ -f, --force override .travis.yml if it already exists
454
+ -k, --skip-enable do not enable project, only add .travis.yml
455
+ -p, --print-conf print generated config instead of writing to file
456
+ --script VALUE sets script option in .travis.yml (can be used more than once)
457
+ --before-script VALUE sets before_script option in .travis.yml (can be used more than once)
458
+ --after-script VALUE sets after_script option in .travis.yml (can be used more than once)
459
+ --after-success VALUE sets after_success option in .travis.yml (can be used more than once)
460
+ --install VALUE sets install option in .travis.yml (can be used more than once)
461
+ --before-install VALUE sets before_install option in .travis.yml (can be used more than once)
462
+ --compiler VALUE sets compiler option in .travis.yml (can be used more than once)
463
+ --otp-release VALUE sets otp_release option in .travis.yml (can be used more than once)
464
+ --go VALUE sets go option in .travis.yml (can be used more than once)
465
+ --jdk VALUE sets jdk option in .travis.yml (can be used more than once)
466
+ --node-js VALUE sets node_js option in .travis.yml (can be used more than once)
467
+ --perl VALUE sets perl option in .travis.yml (can be used more than once)
468
+ --php VALUE sets php option in .travis.yml (can be used more than once)
469
+ --python VALUE sets python option in .travis.yml (can be used more than once)
470
+ --rvm VALUE sets rvm option in .travis.yml (can be used more than once)
471
+ --scala VALUE sets scala option in .travis.yml (can be used more than once)
472
+ --env VALUE sets env option in .travis.yml (can be used more than once)
473
+ --gemfile VALUE sets gemfile option in .travis.yml (can be used more than once)
474
+
475
+ When setting up a new project, you can run `travis init` to generate a `.travis.yml` and [enable](#enable) the project:
476
+
477
+ $ travis init java
478
+ .travis.yml file created!
479
+ travis-ci/java-example: enabled :)
480
+
481
+ You can also set certain values via command line flags (see list above):
482
+
483
+ $ travis init c --compiler clang
484
+ .travis.yml file created!
485
+ travis-ci/c-example: enabled :)
486
+
431
487
  #### `logs`
432
488
 
433
489
  Given a job number, logs simply prints out that job's logs.
@@ -506,7 +562,6 @@ Helps you configure Travis addons.
506
562
  -e, --api-endpoint URL Travis API server to talk to
507
563
  --pro short-cut for --api-endpoint 'https://api.travis-ci.com/'
508
564
  --org short-cut for --api-endpoint 'https://api.travis-ci.org/'
509
- --staging talks to staging system
510
565
  -t, --token [ACCESS_TOKEN] access token to use
511
566
  --debug show API requests
512
567
  --adapter ADAPTER Faraday adapter to use for HTTP requests
@@ -661,7 +716,7 @@ Or with your own client instance:
661
716
  ``` ruby
662
717
  require 'travis/client'
663
718
 
664
- client = Travis::Client.new
719
+ client = Travis::Client.new(access_token: "...")
665
720
  puts "Hello #{client.user.name}"
666
721
  ```
667
722
 
@@ -996,9 +1051,60 @@ MyTravis::Repository.find('rails/rails')
996
1051
 
997
1052
  ## Installation
998
1053
 
999
- Make sure you have at least [Ruby](http://www.ruby-lang.org/en/downloads/) 1.8.7 (2.0.0 recommended) installed. Then run:
1054
+ Make sure you have at least [Ruby](http://www.ruby-lang.org/en/downloads/) 1.9.3 (2.0.0 recommended) installed.
1055
+
1056
+ You can check your Ruby version by running `ruby -v`:
1057
+
1058
+ $ ruby -v
1059
+ ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]
1060
+
1061
+ Then run:
1062
+
1063
+ $ gem install travis -v 1.4.0 --no-rdoc --no-ri
1064
+
1065
+ Now make sure everything is working:
1066
+
1067
+ $ travis verision
1068
+ 1.4.0
1000
1069
 
1001
- $ gem install travis --no-rdoc --no-ri
1070
+ ### Updating your Ruby
1071
+
1072
+ If you have an outdated Ruby version, you should use your package system or a Ruby Installer to install a recent Ruby.
1073
+
1074
+ #### Mac OSX via Homebrew
1075
+
1076
+ Mac OSX prior to 10.9 ships with a very dated Ruby version. You can use [Homebrew](http://mxcl.github.io/homebrew/) to install a recent version:
1077
+
1078
+ $ brew install ruby
1079
+ $ gem update --system
1080
+
1081
+ #### Windows
1082
+
1083
+ On Windows, we recommend using the [RubyInstaller](http://rubyinstaller.org/), which includes the latest version of Ruby.
1084
+
1085
+ #### Other Unix systems
1086
+
1087
+ On other Unix systems, like Linux, use your package system to install Ruby. Please inquire before hand which package you might actually want to install, as for some distributions `ruby` might actually still be 1.8.7 or older.
1088
+
1089
+ Ubuntu and Debian:
1090
+
1091
+ $ sudo apt-get install ruby1.9.3 ruby-switch
1092
+ $ sudo ruby-switch --set ruby1.9.3
1093
+
1094
+ Fedora Core:
1095
+
1096
+ $ sudo yum install ruby
1097
+
1098
+ Arch Linux:
1099
+
1100
+ $ sudo pacman -S ruby
1101
+
1102
+
1103
+ #### Ruby versioning tools
1104
+
1105
+ Alternatively, you can use a Ruby version management tool such as [rvm](https://rvm.io/rvm/install/), [rbenv](http://rbenv.org/) or [https://github.com/postmodern/chruby](chruby). This is only recommended if you need to run multiple versions of Ruby.
1106
+
1107
+ You can of course always compile Ruby from source, though then you are left with the hassle of keeping it up to date and making sure that everything is set up properly.
1002
1108
 
1003
1109
  ### Upgrading from travis-cli
1004
1110
 
@@ -1006,6 +1112,15 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
1006
1112
 
1007
1113
  ## Version History
1008
1114
 
1115
+ **1.4.0** (July 26, 2013)
1116
+
1117
+ * Add `travis init`
1118
+ * Improve install documentation, especially for people from outside the Ruby community
1119
+ * Improve error message on an expired token
1120
+ * Add Account entity to library
1121
+ * Switch to Typhoeus as default HTTP adapter
1122
+ * Fix tests for forks
1123
+
1009
1124
  **1.3.1** (July 21, 2013)
1010
1125
 
1011
1126
  * Add `travis whatsup --my-repos`, which corresponds to the "My Repositories" tab in the web interface
data/Rakefile CHANGED
@@ -5,20 +5,21 @@ windows = RUBY_PLATFORM =~ /mswin|mingw/
5
5
  desc "run specs"
6
6
  task(:spec) { ruby "-S rspec spec#{" -c" unless windows}" }
7
7
 
8
- desc "generate gemspec"
9
- task 'travis.gemspec' do
8
+ desc "generate gemspec, update readme"
9
+ task 'update' do
10
10
  require 'travis/version'
11
11
  content = File.read('travis.gemspec')
12
12
 
13
13
  # fetch data
14
14
  fields = {
15
- :authors => `git shortlog -sn`.b.scan(/[^\d\s].*/),
15
+ :authors => `git shortlog -sn`.b.scan(/[^\d\s].*/).map { |a| a == 'petems' ? 'Peter Souter' : a },
16
16
  :email => `git shortlog -sne`.b.scan(/[^<]+@[^>]+/),
17
17
  :files => `git ls-files`.b.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
18
18
  }
19
19
 
20
20
  # :(
21
21
  fields[:email].delete("konstantin.haase@gmail.com")
22
+ fields[:authors]
22
23
 
23
24
  # insert data
24
25
  fields.each do |field, values|
@@ -35,9 +36,17 @@ task 'travis.gemspec' do
35
36
  content.gsub!(/./) { |c| c.bytesize > 1 ? "\\u{#{c.codepoints.first.to_s(16)}}" : c }
36
37
 
37
38
  File.open('travis.gemspec', 'w') { |f| f << content }
39
+
40
+ readme = File.read('README.md').b
41
+ readme.gsub! /^(\s+\$ travis verision\n\s+).*$/, "\\1#{Travis::VERSION}"
42
+ readme.gsub! /(gem install travis -v )\S+/, "\\1#{Travis::VERSION}"
43
+ File.write('README.md', readme)
38
44
  end
39
45
 
40
- task :gemspec => 'travis.gemspec'
46
+ task 'travis.gemspec' => :update
47
+ task 'README.md' => :update
48
+
49
+ task :gemspec => :update
41
50
  task :default => :spec
42
51
  task :default => :gemspec unless windows or ENV['CI']
43
52
  task :test => :spec
@@ -133,7 +133,9 @@ module Travis
133
133
  store_config
134
134
  rescue StandardError => e
135
135
  raise(e) if explode?
136
- error e.message
136
+ message = e.message
137
+ message += " - need to run `travis login` again?" if Travis::Client::Error === e and message == 'access denied'
138
+ error message
137
139
  end
138
140
 
139
141
  def command_name
@@ -0,0 +1,4 @@
1
+ language: c
2
+ compiler:
3
+ - clang
4
+ - gcc
@@ -0,0 +1 @@
1
+ language: clojure
@@ -0,0 +1,4 @@
1
+ language: cpp
2
+ compiler:
3
+ - clang
4
+ - gcc
@@ -0,0 +1,3 @@
1
+ language: erlang
2
+ otp_release:
3
+ - R16B
@@ -0,0 +1,4 @@
1
+ language: go
2
+ go:
3
+ - "1.0"
4
+ - "1.1"
@@ -0,0 +1 @@
1
+ language: groovy
@@ -0,0 +1 @@
1
+ language: haskell
@@ -0,0 +1,4 @@
1
+ language: java
2
+ jdk:
3
+ - oraclejdk7
4
+ - openjdk6
@@ -0,0 +1,4 @@
1
+ language: node_js
2
+ node_js:
3
+ - "0.11"
4
+ - "0.10"
@@ -0,0 +1 @@
1
+ language: objective-c
@@ -0,0 +1,4 @@
1
+ language: perl
2
+ perl:
3
+ - "5.16"
4
+ - "5.14"
@@ -0,0 +1,4 @@
1
+ language: php
2
+ php:
3
+ - "5.5"
4
+ - "5.4"
@@ -0,0 +1,5 @@
1
+ language: python
2
+ python:
3
+ - "2.7"
4
+ - "3.3"
5
+ - "pypy"
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - rbx-19mode
@@ -0,0 +1,4 @@
1
+ language: scala
2
+ scala:
3
+ - "2.10.1"
4
+ - "2.9.3"
@@ -0,0 +1,57 @@
1
+ require 'travis/cli'
2
+
3
+ module Travis
4
+ module CLI
5
+ class Init < Enable
6
+ on('-f', '--force', 'override .travis.yml if it already exists')
7
+ on('-k', '--skip-enable', 'do not enable project, only add .travis.yml')
8
+ on('-p', '--print-conf', 'print generated config instead of writing to file')
9
+
10
+ options = %w[
11
+ script before_script after_script after_success install before_install
12
+ compiler otp_release go jdk node_js perl php python rvm scala
13
+ env gemfile
14
+ ]
15
+
16
+ options.each do |option|
17
+ on "--#{option.gsub('_', '-')} VALUE", "sets #{option} option in .travis.yml (can be used more than once)" do |c, value|
18
+ c.custom_config[option] &&= Array(c.custom_config[option]) << value
19
+ c.custom_config[option] ||= value
20
+ end
21
+ end
22
+
23
+ attr_writer :travis_config
24
+
25
+ def run(language = nil, file = '.travis.yml')
26
+ error ".travis.yml already exists, use --force to override" if File.exist?(file) and not force? and not print_conf?
27
+ language ||= ask('Main programming language used: ') { |q| q.default = detect_language }
28
+ self.travis_config = template(language).merge(custom_config)
29
+
30
+ if print_conf?
31
+ puts travis_config.to_yaml
32
+ else
33
+ save_travis_config(file)
34
+ say("#{file} file created!")
35
+ end
36
+
37
+ super() unless skip_enable?
38
+ end
39
+
40
+ def custom_config
41
+ @custom_config ||= {}
42
+ end
43
+
44
+ private
45
+
46
+ def template(language)
47
+ file = File.expand_path("../init/#{language}.yml", __FILE__)
48
+ error "unknown language #{language}" unless File.exist? file
49
+ YAML.load_file(file)
50
+ end
51
+
52
+ def detect_language
53
+ 'ruby'
54
+ end
55
+ end
56
+ end
57
+ end
@@ -88,11 +88,11 @@ module Travis
88
88
  end
89
89
  end
90
90
 
91
- def save_travis_config
91
+ def save_travis_config(file = travis_yaml)
92
92
  yaml = travis_config.to_yaml
93
93
  yaml.gsub! /^(\s+)('on'|true):/, "\\1on:"
94
- yaml.gsub! /\A---\n/, ''
95
- File.write(travis_yaml, yaml)
94
+ yaml.gsub! /\A---\s*\n/, ''
95
+ File.write(file, yaml)
96
96
  end
97
97
  end
98
98
  end
data/lib/travis/cli.rb CHANGED
@@ -25,6 +25,7 @@ module Travis
25
25
  autoload :Endpoint, 'travis/cli/endpoint'
26
26
  autoload :Help, 'travis/cli/help'
27
27
  autoload :History, 'travis/cli/history'
28
+ autoload :Init, 'travis/cli/init'
28
29
  autoload :Login, 'travis/cli/login'
29
30
  autoload :Logs, 'travis/cli/logs'
30
31
  autoload :Open, 'travis/cli/open'
@@ -0,0 +1,14 @@
1
+ require 'travis/client'
2
+
3
+ module Travis
4
+ module Client
5
+ class Account < Entity
6
+ attributes :name, :login, :type, :repos_count
7
+
8
+ one :account
9
+ many :accounts
10
+
11
+ inspect_info :login
12
+ end
13
+ end
14
+ end
@@ -63,6 +63,10 @@ module Travis
63
63
  session.find_one(User)
64
64
  end
65
65
 
66
+ def accounts
67
+ session.find_many(Account)
68
+ end
69
+
66
70
  def restart(entity)
67
71
  # btw, internally we call this reset, not restart, as it resets the state machine
68
72
  # but we thought that would be too confusing
@@ -71,4 +75,4 @@ module Travis
71
75
  end
72
76
  end
73
77
  end
74
- end
78
+ end
@@ -2,6 +2,8 @@ require 'travis/client'
2
2
 
3
3
  require 'faraday'
4
4
  require 'faraday_middleware'
5
+ require 'typhoeus/adapters/faraday'
6
+
5
7
  require 'json'
6
8
 
7
9
  module Travis
@@ -16,13 +18,13 @@ module Travis
16
18
  @cache = {}
17
19
  @instruments = []
18
20
  @config = nil
19
- @faraday_adapter = :net_http_persistent
21
+ @faraday_adapter = :typhoeus
20
22
 
21
23
  options = { :uri => options } unless options.respond_to? :each_pair
22
24
  options.each_pair { |key, value| public_send("#{key}=", value) }
23
25
 
24
26
  raise ArgumentError, "neither :uri nor :connection specified" unless connection
25
- headers['Accept'] ||= 'application/vnd.travis-ci.2+json, */*; q=0.01'
27
+ headers['Accept'] ||= 'application/json; version=2'
26
28
  end
27
29
 
28
30
  def uri
data/lib/travis/client.rb CHANGED
@@ -12,6 +12,7 @@ require 'travis/client/commit'
12
12
  require 'travis/client/job'
13
13
  require 'travis/client/worker'
14
14
  require 'travis/client/namespace'
15
+ require 'travis/client/account'
15
16
 
16
17
  module Travis
17
18
  module Client
@@ -1,3 +1,3 @@
1
1
  module Travis
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -0,0 +1,224 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::CLI::Init do
4
+ before(:each) do
5
+ FileUtils.mkdir_p "spec/tmp"
6
+ Dir.chdir "spec/tmp"
7
+ FileUtils.rm('.travis.yml') if File.exist?('.travis.yml')
8
+ end
9
+
10
+ after(:each) do
11
+ Dir.chdir ".."
12
+ FileUtils.rm('spec/tmp/.travis.yml') if File.exist?('spec/tmp/.travis.yml')
13
+ end
14
+
15
+ example "travis init fakelanguage" do
16
+ run_cli('init', 'fakelanguage', '--skip-enable').should_not be_success
17
+ stderr.should be == "unknown language fakelanguage\n"
18
+ end
19
+
20
+ shared_examples_for 'travis init' do |language|
21
+ example "travis init #{language} (empty directory)" do
22
+ File.exist?('.travis.yml').should be_false
23
+ run_cli('init', language, '--skip-enable').should be_success
24
+ stdout.should be == ".travis.yml file created!\n"
25
+ File.exist?('.travis.yml').should be_true
26
+ File.read('.travis.yml').should include("language: #{language}")
27
+ end
28
+
29
+ example "travis init #{language} (.travis.yml already exists, using --force)" do
30
+ File.open(".travis.yml", "w") { |f| f << "old file" }
31
+ run_cli('init', language, '--force', '--skip-enable').should be_success
32
+ stdout.should be == ".travis.yml file created!\n"
33
+ File.read(".travis.yml").should_not be == "old file"
34
+ end
35
+
36
+ example "travis init #{language} (.travis.yml already exists, not using --force)" do
37
+ File.open(".travis.yml", "w") { |f| f << "old file" }
38
+ run_cli('init', language, '--skip-enable').should_not be_success
39
+ stderr.should be == ".travis.yml already exists, use --force to override\n"
40
+ File.read('.travis.yml').should be == "old file"
41
+ end
42
+ end
43
+
44
+ describe 'travis init c' do
45
+ it_should_behave_like 'travis init', 'c'
46
+
47
+ let :result do
48
+ run_cli('init', 'c', '--skip-enable')
49
+ YAML.load_file('.travis.yml')
50
+ end
51
+
52
+ it 'sets compiler' do
53
+ result.should include('compiler')
54
+ result['compiler'].should include('clang')
55
+ result['compiler'].should include('gcc')
56
+ end
57
+ end
58
+
59
+ describe 'travis init clojure' do
60
+ it_should_behave_like 'travis init', 'clojure'
61
+ end
62
+
63
+ describe 'travis init cpp' do
64
+ it_should_behave_like 'travis init', 'cpp'
65
+
66
+ let :result do
67
+ run_cli('init', 'cpp', '--skip-enable')
68
+ YAML.load_file('.travis.yml')
69
+ end
70
+
71
+ it 'sets compiler' do
72
+ result.should include('compiler')
73
+ result['compiler'].should include('clang')
74
+ result['compiler'].should include('gcc')
75
+ end
76
+ end
77
+
78
+ describe 'travis init erlang' do
79
+ it_should_behave_like 'travis init', 'erlang'
80
+
81
+ let :result do
82
+ run_cli('init', 'erlang', '--skip-enable')
83
+ YAML.load_file('.travis.yml')
84
+ end
85
+
86
+ it 'sets compiler' do
87
+ result.should include('otp_release')
88
+ result['otp_release'].should include('R16B')
89
+ end
90
+ end
91
+
92
+ describe 'travis init go' do
93
+ it_should_behave_like 'travis init', 'go'
94
+
95
+ let :result do
96
+ run_cli('init', 'go', '--skip-enable')
97
+ YAML.load_file('.travis.yml')
98
+ end
99
+
100
+ it 'sets compiler' do
101
+ result.should include('go')
102
+ result['go'].should include('1.0')
103
+ result['go'].should include('1.1')
104
+ end
105
+ end
106
+
107
+ describe 'travis init groovy' do
108
+ it_should_behave_like 'travis init', 'groovy'
109
+ end
110
+
111
+ describe 'travis init haskell' do
112
+ it_should_behave_like 'travis init', 'haskell'
113
+ end
114
+
115
+ describe 'travis init java' do
116
+ it_should_behave_like 'travis init', 'java'
117
+
118
+ let :result do
119
+ run_cli('init', 'java', '--skip-enable')
120
+ YAML.load_file('.travis.yml')
121
+ end
122
+
123
+ it 'sets compiler' do
124
+ result.should include('jdk')
125
+ result['jdk'].should include('oraclejdk7')
126
+ result['jdk'].should include('openjdk6')
127
+ end
128
+ end
129
+
130
+ describe 'travis init node_js' do
131
+ it_should_behave_like 'travis init', 'node_js'
132
+
133
+ let :result do
134
+ run_cli('init', 'node_js', '--skip-enable')
135
+ YAML.load_file('.travis.yml')
136
+ end
137
+
138
+ it 'sets compiler' do
139
+ result.should include('node_js')
140
+ result['node_js'].should include('0.11')
141
+ result['node_js'].should include('0.10')
142
+ end
143
+ end
144
+
145
+ describe 'travis init objective-c' do
146
+ it_should_behave_like 'travis init', 'objective-c'
147
+ end
148
+
149
+ describe 'travis init perl' do
150
+ it_should_behave_like 'travis init', 'perl'
151
+
152
+ let :result do
153
+ run_cli('init', 'perl', '--skip-enable')
154
+ YAML.load_file('.travis.yml')
155
+ end
156
+
157
+ it 'sets compiler' do
158
+ result.should include('perl')
159
+ result['perl'].should include('5.16')
160
+ result['perl'].should include('5.14')
161
+ end
162
+ end
163
+
164
+ describe 'travis init php' do
165
+ it_should_behave_like 'travis init', 'php'
166
+
167
+ let :result do
168
+ run_cli('init', 'php', '--skip-enable')
169
+ YAML.load_file('.travis.yml')
170
+ end
171
+
172
+ it 'sets compiler' do
173
+ result.should include('php')
174
+ result['php'].should include('5.5')
175
+ result['php'].should include('5.4')
176
+ end
177
+ end
178
+
179
+ describe 'travis init python' do
180
+ it_should_behave_like 'travis init', 'python'
181
+
182
+ let :result do
183
+ run_cli('init', 'python', '--skip-enable')
184
+ YAML.load_file('.travis.yml')
185
+ end
186
+
187
+ it 'sets compiler' do
188
+ result.should include('python')
189
+ result['python'].should include('2.7')
190
+ result['python'].should include('3.3')
191
+ end
192
+ end
193
+
194
+ describe 'travis init ruby' do
195
+ it_should_behave_like 'travis init', 'ruby'
196
+
197
+ let :result do
198
+ run_cli('init', 'ruby', '--skip-enable')
199
+ YAML.load_file('.travis.yml')
200
+ end
201
+
202
+ it 'sets compiler' do
203
+ result.should include('rvm')
204
+ result['rvm'].should include('1.9.3')
205
+ result['rvm'].should include('2.0.0')
206
+ result['rvm'].should_not include('1.8.7')
207
+ end
208
+ end
209
+
210
+ describe 'travis init scala' do
211
+ it_should_behave_like 'travis init', 'scala'
212
+
213
+ let :result do
214
+ run_cli('init', 'scala', '--skip-enable')
215
+ YAML.load_file('.travis.yml')
216
+ end
217
+
218
+ it 'sets compiler' do
219
+ result.should include('scala')
220
+ result['scala'].should include('2.10.1')
221
+ result['scala'].should include('2.9.3')
222
+ end
223
+ end
224
+ end
@@ -3,22 +3,22 @@ require 'spec_helper'
3
3
  describe Travis::CLI::Open do
4
4
  example 'travis open -p' do
5
5
  run_cli('open', '-p').should be_success
6
- stdout.should be == "https://travis-ci.org/travis-ci/travis\n"
6
+ stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis/)
7
7
  end
8
8
 
9
9
  example 'travis open 6180 -p' do
10
10
  run_cli('open', '6180', '-p').should be_success
11
- stdout.should be == "https://travis-ci.org/travis-ci/travis/builds/4125095\n"
11
+ stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\/builds\/4125095/)
12
12
  end
13
13
 
14
14
  example 'travis open 6180.1 -p' do
15
15
  run_cli('open', '6180.1', '-p').should be_success
16
- stdout.should be == "https://travis-ci.org/travis-ci/travis/jobs/4125096\n"
16
+ stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\/jobs\/4125096/)
17
17
  end
18
18
 
19
19
  example 'travis open -pg' do
20
20
  run_cli('open', '-pg').should be_success
21
- stdout.should be == "https://github.com/travis-ci/travis\n"
21
+ stdout.should match(/https:\/\/github.com\/[\w\W]*\/travis/)
22
22
  end
23
23
 
24
24
  example 'travis open 6180 -pg' do
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::Client::Account do
4
+ let(:session) { Travis::Client.new }
5
+ subject { session.accounts.first }
6
+ its(:id) { should be == 123 }
7
+ its(:name) { should be == 'Konstantin Haase' }
8
+ its(:login) { should be == 'rkh' }
9
+ its(:type) { should be == 'user' }
10
+ its(:repos_count) { should be == 200 }
11
+ its(:inspect) { should be == "#<Travis::Client::Account: rkh>" }
12
+ end
@@ -656,7 +656,7 @@ module Travis
656
656
  "$ export GEM=railties\n"}}.to_json
657
657
  end
658
658
 
659
- get '/repos/travis-ci/travis' do
659
+ get '/repos/*/travis' do
660
660
  # hack hack
661
661
  request.path_info = '/repos/rails/rails'
662
662
  pass
@@ -705,6 +705,16 @@ module Travis
705
705
  'payload' => nil}}.to_json
706
706
  end
707
707
 
708
+ get '/accounts/' do
709
+ {"accounts"=>
710
+ [{'id' => 123,
711
+ 'name' => "Konstantin Haase",
712
+ 'login' => 'rkh',
713
+ 'type' => 'user',
714
+ 'repos_count' => 200
715
+ }]}.to_json
716
+ end
717
+
708
718
  post '/requests' do
709
719
  $params = params
710
720
  "{}"
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.3.1"
5
+ s.version = "1.4.0"
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"
@@ -13,25 +13,29 @@ Gem::Specification.new do |s|
13
13
  s.authors = [
14
14
  "Konstantin Haase",
15
15
  "Henrik Hodne",
16
+ "Peter Souter",
16
17
  "Max Barnash",
17
18
  "Mario Visic",
18
19
  "Piotr Sarnacki",
19
- "Adrien Brault",
20
20
  "Rapha\xC3\xABl Pinson",
21
+ "Laurent Petit",
22
+ "Adrien Brault",
21
23
  "Justin Lambert",
22
- "Laurent Petit"
24
+ "Aaron Hill"
23
25
  ]
24
26
 
25
27
  # generated from git shortlog -sne
26
28
  s.email = [
27
29
  "konstantin.mailinglists@googlemail.com",
28
30
  "me@henrikhodne.com",
31
+ "p.morsou@gmail.com",
29
32
  "i.am@anhero.ru",
30
33
  "drogus@gmail.com",
31
- "adrien.brault@gmail.com",
32
34
  "raphael.pinson@camptocamp.com",
33
- "jlambert@eml.cc",
34
35
  "laurent.petit@gmail.com",
36
+ "adrien.brault@gmail.com",
37
+ "jlambert@eml.cc",
38
+ "aa1ronham@gmail.com",
35
39
  "mario@mariovisic.com"
36
40
  ]
37
41
 
@@ -55,6 +59,22 @@ Gem::Specification.new do |s|
55
59
  "lib/travis/cli/endpoint.rb",
56
60
  "lib/travis/cli/help.rb",
57
61
  "lib/travis/cli/history.rb",
62
+ "lib/travis/cli/init.rb",
63
+ "lib/travis/cli/init/c.yml",
64
+ "lib/travis/cli/init/clojure.yml",
65
+ "lib/travis/cli/init/cpp.yml",
66
+ "lib/travis/cli/init/erlang.yml",
67
+ "lib/travis/cli/init/go.yml",
68
+ "lib/travis/cli/init/groovy.yml",
69
+ "lib/travis/cli/init/haskell.yml",
70
+ "lib/travis/cli/init/java.yml",
71
+ "lib/travis/cli/init/node_js.yml",
72
+ "lib/travis/cli/init/objective-c.yml",
73
+ "lib/travis/cli/init/perl.yml",
74
+ "lib/travis/cli/init/php.yml",
75
+ "lib/travis/cli/init/python.yml",
76
+ "lib/travis/cli/init/ruby.yml",
77
+ "lib/travis/cli/init/scala.yml",
58
78
  "lib/travis/cli/login.rb",
59
79
  "lib/travis/cli/logs.rb",
60
80
  "lib/travis/cli/open.rb",
@@ -72,6 +92,7 @@ Gem::Specification.new do |s|
72
92
  "lib/travis/cli/whatsup.rb",
73
93
  "lib/travis/cli/whoami.rb",
74
94
  "lib/travis/client.rb",
95
+ "lib/travis/client/account.rb",
75
96
  "lib/travis/client/artifact.rb",
76
97
  "lib/travis/client/build.rb",
77
98
  "lib/travis/client/commit.rb",
@@ -93,6 +114,7 @@ Gem::Specification.new do |s|
93
114
  "spec/cli/endpoint_spec.rb",
94
115
  "spec/cli/help_spec.rb",
95
116
  "spec/cli/history_spec.rb",
117
+ "spec/cli/init_spec.rb",
96
118
  "spec/cli/login_spec.rb",
97
119
  "spec/cli/logs_spec.rb",
98
120
  "spec/cli/open_spec.rb",
@@ -102,6 +124,7 @@ Gem::Specification.new do |s|
102
124
  "spec/cli/token_spec.rb",
103
125
  "spec/cli/version_spec.rb",
104
126
  "spec/cli/whoami_spec.rb",
127
+ "spec/client/account_spec.rb",
105
128
  "spec/client/build_spec.rb",
106
129
  "spec/client/commit_spec.rb",
107
130
  "spec/client/job_spec.rb",
@@ -130,7 +153,7 @@ Gem::Specification.new do |s|
130
153
  s.add_dependency "gh"
131
154
  s.add_dependency "launchy", "~> 2.1"
132
155
  s.add_dependency "pry", "~> 0.9"
133
- s.add_dependency "net-http-persistent", "~> 2.8"
156
+ s.add_dependency "typhoeus"
134
157
  s.add_development_dependency "rspec", "~> 2.12"
135
158
  s.add_development_dependency "sinatra", "~> 1.3"
136
159
  s.add_development_dependency "rack-test", "~> 0.6"
metadata CHANGED
@@ -1,22 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  - Henrik Hodne
9
+ - Peter Souter
9
10
  - Max Barnash
10
11
  - Mario Visic
11
12
  - Piotr Sarnacki
12
- - Adrien Brault
13
13
  - Raphaël Pinson
14
- - Justin Lambert
15
14
  - Laurent Petit
15
+ - Adrien Brault
16
+ - Justin Lambert
17
+ - Aaron Hill
16
18
  autorequire:
17
19
  bindir: bin
18
20
  cert_chain: []
19
- date: 2013-07-21 00:00:00.000000000 Z
21
+ date: 2013-07-26 00:00:00.000000000 Z
20
22
  dependencies:
21
23
  - !ruby/object:Gem::Dependency
22
24
  name: faraday
@@ -131,19 +133,19 @@ dependencies:
131
133
  - !ruby/object:Gem::Version
132
134
  version: '0.9'
133
135
  - !ruby/object:Gem::Dependency
134
- name: net-http-persistent
136
+ name: typhoeus
135
137
  requirement: !ruby/object:Gem::Requirement
136
138
  requirements:
137
- - - ~>
139
+ - - '>='
138
140
  - !ruby/object:Gem::Version
139
- version: '2.8'
141
+ version: '0'
140
142
  type: :runtime
141
143
  prerelease: false
142
144
  version_requirements: !ruby/object:Gem::Requirement
143
145
  requirements:
144
- - - ~>
146
+ - - '>='
145
147
  - !ruby/object:Gem::Version
146
- version: '2.8'
148
+ version: '0'
147
149
  - !ruby/object:Gem::Dependency
148
150
  name: rspec
149
151
  requirement: !ruby/object:Gem::Requirement
@@ -190,12 +192,14 @@ description: CLI and Ruby client library for Travis CI
190
192
  email:
191
193
  - konstantin.mailinglists@googlemail.com
192
194
  - me@henrikhodne.com
195
+ - p.morsou@gmail.com
193
196
  - i.am@anhero.ru
194
197
  - drogus@gmail.com
195
- - adrien.brault@gmail.com
196
198
  - raphael.pinson@camptocamp.com
197
- - jlambert@eml.cc
198
199
  - laurent.petit@gmail.com
200
+ - adrien.brault@gmail.com
201
+ - jlambert@eml.cc
202
+ - aa1ronham@gmail.com
199
203
  - mario@mariovisic.com
200
204
  executables:
201
205
  - travis
@@ -220,6 +224,22 @@ files:
220
224
  - lib/travis/cli/endpoint.rb
221
225
  - lib/travis/cli/help.rb
222
226
  - lib/travis/cli/history.rb
227
+ - lib/travis/cli/init.rb
228
+ - lib/travis/cli/init/c.yml
229
+ - lib/travis/cli/init/clojure.yml
230
+ - lib/travis/cli/init/cpp.yml
231
+ - lib/travis/cli/init/erlang.yml
232
+ - lib/travis/cli/init/go.yml
233
+ - lib/travis/cli/init/groovy.yml
234
+ - lib/travis/cli/init/haskell.yml
235
+ - lib/travis/cli/init/java.yml
236
+ - lib/travis/cli/init/node_js.yml
237
+ - lib/travis/cli/init/objective-c.yml
238
+ - lib/travis/cli/init/perl.yml
239
+ - lib/travis/cli/init/php.yml
240
+ - lib/travis/cli/init/python.yml
241
+ - lib/travis/cli/init/ruby.yml
242
+ - lib/travis/cli/init/scala.yml
223
243
  - lib/travis/cli/login.rb
224
244
  - lib/travis/cli/logs.rb
225
245
  - lib/travis/cli/open.rb
@@ -237,6 +257,7 @@ files:
237
257
  - lib/travis/cli/whatsup.rb
238
258
  - lib/travis/cli/whoami.rb
239
259
  - lib/travis/client.rb
260
+ - lib/travis/client/account.rb
240
261
  - lib/travis/client/artifact.rb
241
262
  - lib/travis/client/build.rb
242
263
  - lib/travis/client/commit.rb
@@ -258,6 +279,7 @@ files:
258
279
  - spec/cli/endpoint_spec.rb
259
280
  - spec/cli/help_spec.rb
260
281
  - spec/cli/history_spec.rb
282
+ - spec/cli/init_spec.rb
261
283
  - spec/cli/login_spec.rb
262
284
  - spec/cli/logs_spec.rb
263
285
  - spec/cli/open_spec.rb
@@ -267,6 +289,7 @@ files:
267
289
  - spec/cli/token_spec.rb
268
290
  - spec/cli/version_spec.rb
269
291
  - spec/cli/whoami_spec.rb
292
+ - spec/client/account_spec.rb
270
293
  - spec/client/build_spec.rb
271
294
  - spec/client/commit_spec.rb
272
295
  - spec/client/job_spec.rb
@@ -304,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
327
  version: '0'
305
328
  requirements: []
306
329
  rubyforge_project:
307
- rubygems_version: 2.0.2
330
+ rubygems_version: 2.0.5
308
331
  signing_key:
309
332
  specification_version: 4
310
333
  summary: Travis CI client