travis 1.6.17.travis.591.5 → 1.6.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +3 -3
- data/assets/travis.sh +3 -3
- data/lib/travis/cli/sshkey.rb +102 -0
- data/lib/travis/client/singleton_setting.rb +36 -0
- data/lib/travis/client/ssh_key.rb +11 -0
- data/lib/travis/tools/ssl_key.rb +35 -0
- data/lib/travis/version.rb +1 -1
- data/travis.gemspec +5 -1
- metadata +43 -38
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZjNjOTc4YzViYjgyZGZlZGNiZDFkNDM4M2M0OTA1ZDkyNDBkMTdmNA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3fbded80aea5d2d062b1d7b50e1de3611d508cd3
|
4
|
+
data.tar.gz: 8eb31369badf5488d23f904bb67cc48512841287
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZGJkMGQ1NmU0Yzk1NmY3NjlmODI5ZDQ0MTJhZTU1NmJiMDVjMmQ1ZjgxNGI3
|
11
|
-
YWJmOGQyZWI3MTg2NzJkMWNiNmI3YWZmOGQ2OTEyYzhmYTFmZTk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MmUzNDFmMmE1MTRjYmI1MDc0ZDM4NWEyZTEwNjBlZTI1NWE3Y2RkYmIxMTY4
|
14
|
-
ZDhjZDI3MGViNDc0NmFmZWMzMzBjZDU1MDI1Mzg4YWM1YjFmMTYyM2E2ZmQ4
|
15
|
-
YjIzODI1OTQwMzA4MzkxM2M2ODlkNjQxZTZjOThiMjhmMjdkNjA=
|
6
|
+
metadata.gz: 8179310c925a42f8b1166c9aab1af47ff1e5f02e012e05cee30c96faa306758cdddd771255db47507a51a85d77f0d6e0c8230402b046957ff7e77c457b441849
|
7
|
+
data.tar.gz: 1bf3eacb5cc3064713f2f833cf7b27e8b3132a1488ba7acadcc0e099722427da6c9e852253c97b0928d173ac7e18ad9d7f4deb8b2cbd87914d0a483479f774f0
|
data/README.md
CHANGED
@@ -1693,12 +1693,12 @@ You can check your Ruby version by running `ruby -v`:
|
|
1693
1693
|
|
1694
1694
|
Then run:
|
1695
1695
|
|
1696
|
-
$ gem install travis -v 1.6.
|
1696
|
+
$ gem install travis -v 1.6.17 --no-rdoc --no-ri
|
1697
1697
|
|
1698
1698
|
Now make sure everything is working:
|
1699
1699
|
|
1700
1700
|
$ travis version
|
1701
|
-
1.6.
|
1701
|
+
1.6.17
|
1702
1702
|
|
1703
1703
|
See also [Note on Ubuntu](#note-on-ubuntu) below.
|
1704
1704
|
|
@@ -1783,7 +1783,7 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
|
|
1783
1783
|
|
1784
1784
|
## Version History
|
1785
1785
|
|
1786
|
-
**1.6.17** (
|
1786
|
+
**1.6.17** (July 25, 2014)
|
1787
1787
|
|
1788
1788
|
* Add `travis sshkey` and corresponding Ruby API.
|
1789
1789
|
* Make desktop notifications work on Mac OS X 10.10.
|
data/assets/travis.sh
CHANGED
@@ -54,7 +54,7 @@ if type compdef 1>/dev/null 2>/dev/null; then
|
|
54
54
|
settings) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "--keys[always use setting key instead of description]" "--enable[enable boolean setting(s)]" "-f[disable boolean setting(s)]" "--disable[disable boolean setting(s)]" "-s[set to given value]" "--set[set to given value]" "-c[change settings interactively]" "--configure[change settings interactively]" '*:file:_files' && return 0;;
|
55
55
|
setup) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-f[override config section if it already exists]" "--force[override config section if it already exists]" '*:file:_files' && return 0;;
|
56
56
|
show) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" '*:file:_files' && return 0;;
|
57
|
-
sshkey) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-D[remove SSH key]" "--delete[remove SSH key]" "-d[set description]" "--description[set description]" "-u[upload key from given file]" "--upload[upload key from given file]" "-s[upload key read from stdin]" "--stdin[upload key read from stdin]" "-c[set exit code depending on key existing]" "--check[set exit code depending on key existing]" '*:file:_files' && return 0;;
|
57
|
+
sshkey) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-D[remove SSH key]" "--delete[remove SSH key]" "-d[set description]" "--description[set description]" "-u[upload key from given file]" "--upload[upload key from given file]" "-s[upload key read from stdin]" "--stdin[upload key read from stdin]" "-c[set exit code depending on key existing]" "--check[set exit code depending on key existing]" "-g[generate SSH key and set up for given GitHub user]" "--generate[generate SSH key and set up for given GitHub user]" '*:file:_files' && return 0;;
|
58
58
|
status) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-x[sets the exit code to 1 if the build failed]" "--exit-code[sets the exit code to 1 if the build failed]" "--no-exit-code[sets the exit code to 1 if the build failed]" "-q[does not print anything]" "--quiet[does not print anything]" "--no-quiet[does not print anything]" "-p[sets the status code to 1 if the build is pending]" "--fail-pending[sets the status code to 1 if the build is pending]" "--no-fail-pending[sets the status code to 1 if the build is pending]" '*:file:_files' && return 0;;
|
59
59
|
sync) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" "-c[only check the sync status]" "--check[only check the sync status]" "-b[will trigger sync but not block until sync is done]" "--background[will trigger sync but not block until sync is done]" "-f[will force sync, even if one is already running]" "--force[will force sync, even if one is already running]" '*:file:_files' && return 0;;
|
60
60
|
token) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests]" '*:file:_files' && return 0;;
|
@@ -100,7 +100,7 @@ elif type compctl 1>/dev/null 2>/dev/null; then
|
|
100
100
|
settings) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--keys" "--enable" "--disable" "-f" "--set" "-s" "--configure" "-c");;
|
101
101
|
setup) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--force" "-f");;
|
102
102
|
show) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r");;
|
103
|
-
sshkey) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--delete" "-D" "--description" "-d" "--upload" "-u" "--stdin" "-s" "--check" "-c");;
|
103
|
+
sshkey) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--delete" "-D" "--description" "-d" "--upload" "-u" "--stdin" "-s" "--check" "-c" "--generate" "-g");;
|
104
104
|
status) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--exit-code" "--no-exit-code" "-x" "--quiet" "--no-quiet" "-q" "--fail-pending" "--no-fail-pending" "-p");;
|
105
105
|
sync) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--check" "-c" "--background" "-b" "--force" "-f");;
|
106
106
|
token) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter");;
|
@@ -147,7 +147,7 @@ elif type complete 1>/dev/null 2>/dev/null; then
|
|
147
147
|
settings) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --keys --enable --disable -f --set -s --configure -c";;
|
148
148
|
setup) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --force -f";;
|
149
149
|
show) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r";;
|
150
|
-
sshkey) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --delete -D --description -d --upload -u --stdin -s --check -c";;
|
150
|
+
sshkey) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --delete -D --description -d --upload -u --stdin -s --check -c --generate -g";;
|
151
151
|
status) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --repo -r --exit-code --no-exit-code -x --quiet --no-quiet -q --fail-pending --no-fail-pending -p";;
|
152
152
|
sync) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter --check -c --background -b --force -f";;
|
153
153
|
token) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --org --staging --token -t --debug --enterprise -X --adapter";;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'travis/cli'
|
2
|
+
require 'travis/tools/ssl_key'
|
3
|
+
require 'travis/tools/github'
|
4
|
+
|
5
|
+
module Travis
|
6
|
+
module CLI
|
7
|
+
class Sshkey < RepoCommand
|
8
|
+
description "checks, updates or deletes an SSH key"
|
9
|
+
on '-D', '--delete', 'remove SSH key'
|
10
|
+
on '-d', '--description DESCRIPTION', 'set description'
|
11
|
+
on '-u', '--upload FILE', 'upload key from given file'
|
12
|
+
on '-s', '--stdin', 'upload key read from stdin'
|
13
|
+
on '-c', '--check', 'set exit code depending on key existing'
|
14
|
+
on '-g', '--generate', 'generate SSH key and set up for given GitHub user'
|
15
|
+
|
16
|
+
def_delegators :repository, :ssh_key
|
17
|
+
|
18
|
+
def run
|
19
|
+
error "SSH keys are not available on #{color(session.config['host'], :bold)}" if org?
|
20
|
+
delete_key if delete?
|
21
|
+
update_key File.read(upload), upload if upload?
|
22
|
+
update_key $stdin.read, 'stdin' if stdin?
|
23
|
+
generate_key if generate?
|
24
|
+
display_key
|
25
|
+
end
|
26
|
+
|
27
|
+
def display_key
|
28
|
+
say "Current SSH key: #{color(ssh_key.description, :info)}"
|
29
|
+
say "Finger print: #{color(ssh_key.fingerprint, :info)}"
|
30
|
+
rescue Travis::Client::NotFound
|
31
|
+
say "No custom SSH key installed."
|
32
|
+
exit 1 if check?
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_key(value, file)
|
36
|
+
self.description ||= ask("Key description: ") { |q| q.default = file } if interactive?
|
37
|
+
say "updating ssh key for #{color slug, :info} with key from #{color file, :info}"
|
38
|
+
ssh_key.update(:value => value, :description => description || file)
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_key
|
42
|
+
return if interactive? and not danger_zone? "Remove SSH key for #{color slug, :info}?"
|
43
|
+
say "removing ssh key for #{color slug, :info}"
|
44
|
+
ssh_key.delete
|
45
|
+
rescue Travis::Client::NotFound
|
46
|
+
warn "no key found to remove"
|
47
|
+
end
|
48
|
+
|
49
|
+
def generate_key
|
50
|
+
github.with_basic_auth do |gh|
|
51
|
+
check_access(gh)
|
52
|
+
empty_line
|
53
|
+
|
54
|
+
say "Generating RSA key."
|
55
|
+
private_key = Tools::SSLKey.generate_rsa
|
56
|
+
self.description ||= "key for fetching dependencies for #{slug}"
|
57
|
+
|
58
|
+
say "Uploading public key to GitHub."
|
59
|
+
gh.post("/user/keys", :title => "#{description} (Travis CI)", :key => Tools::SSLKey.rsa_ssh(private_key.public_key))
|
60
|
+
|
61
|
+
say "Uploading private key to Travis CI."
|
62
|
+
ssh_key.update(:value => private_key.to_s, :description => description)
|
63
|
+
|
64
|
+
empty_line
|
65
|
+
if agree("Store private key? ") { |q| q.default = "no" }
|
66
|
+
path = ask("Path: ") { |q| q.default = "id_travis_rsa" }
|
67
|
+
File.write(path, private_key.to_s)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def check_access(gh)
|
73
|
+
gh["repos/#{slug}"]
|
74
|
+
rescue GH::Error
|
75
|
+
error "GitHub account has no read access to #{color slug, :bold}"
|
76
|
+
end
|
77
|
+
|
78
|
+
def github
|
79
|
+
@github ||= begin
|
80
|
+
load_gh
|
81
|
+
Tools::Github.new(session.config['github']) do |g|
|
82
|
+
g.note = "token for fetching dependencies for #{slug} (Travis CI)"
|
83
|
+
g.explode = explode?
|
84
|
+
g.ask_login = proc { ask("Username: ") }
|
85
|
+
g.ask_password = proc { |user| ask("Password for #{user}: ") { |q| q.echo = "*" } }
|
86
|
+
g.ask_otp = proc { |user| ask("Two-factor authentication code for #{user}: ") }
|
87
|
+
g.login_header = proc { login_header }
|
88
|
+
g.debug = proc { |log| debug(log) }
|
89
|
+
g.after_tokens = proc { g.explode = true and error("no suitable github token found") }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def login_header
|
95
|
+
say "We need the #{color("GitHub login", :important)} for the account you want to add the key to."
|
96
|
+
say "This information will #{color("not be sent to Travis CI", :important)}, only to #{color(github_endpoint.host, :info)}."
|
97
|
+
say "The password will not be displayed."
|
98
|
+
empty_line
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Travis
|
4
|
+
module Client
|
5
|
+
class SingletonSetting < Entity
|
6
|
+
def self.base_path
|
7
|
+
"settings/#{one}"
|
8
|
+
end
|
9
|
+
|
10
|
+
has :repository
|
11
|
+
|
12
|
+
def repository_id
|
13
|
+
id
|
14
|
+
end
|
15
|
+
|
16
|
+
def path
|
17
|
+
"#{self.class.base_path}/#{id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def update(values = {})
|
21
|
+
values = { 'value' => values } unless values.is_a? Hash
|
22
|
+
values.each { |key, value| attributes[key.to_s] = value.to_s }
|
23
|
+
session.patch_raw(path, JSON.dump(self.class.one => attributes))
|
24
|
+
reload
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete
|
28
|
+
session.delete_raw(path)
|
29
|
+
reload
|
30
|
+
true
|
31
|
+
end
|
32
|
+
|
33
|
+
alias save update
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
module Travis
|
5
|
+
module Tools
|
6
|
+
module SSLKey
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def generate_rsa(size = 2048)
|
10
|
+
OpenSSL::PKey::RSA.generate(size)
|
11
|
+
end
|
12
|
+
|
13
|
+
def public_rsa_key(string)
|
14
|
+
@to_rsa ||= OpenSSL::PKey::RSA.new(string)
|
15
|
+
rescue OpenSSL::PKey::RSAError
|
16
|
+
public_key = string.gsub('RSA PUBLIC KEY', 'PUBLIC KEY')
|
17
|
+
@to_rsa = OpenSSL::PKey::RSA.new(public_key)
|
18
|
+
end
|
19
|
+
|
20
|
+
def rsa_ssh(key)
|
21
|
+
['ssh-rsa ', "\0\0\0\assh-rsa#{sized_bytes(key.e)}#{sized_bytes(key.n)}"].pack('a*m').gsub("\n", '')
|
22
|
+
end
|
23
|
+
|
24
|
+
def sized_bytes(value)
|
25
|
+
bytes = to_byte_array(value.to_i)
|
26
|
+
[bytes.size, *bytes].pack('NC*')
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_byte_array(num, *significant)
|
30
|
+
return significant if num.between?(-1, 0) and significant[0][7] == num[7]
|
31
|
+
to_byte_array(*num.divmod(256)) + significant
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/travis/version.rb
CHANGED
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.
|
5
|
+
s.version = "1.6.17"
|
6
6
|
s.description = "CLI and Ruby client library for Travis CI"
|
7
7
|
s.homepage = "https://github.com/travis-ci/travis.rb"
|
8
8
|
s.summary = "Travis CI client"
|
@@ -176,6 +176,7 @@ Gem::Specification.new do |s|
|
|
176
176
|
"lib/travis/cli/setup/sauce_connect.rb",
|
177
177
|
"lib/travis/cli/setup/service.rb",
|
178
178
|
"lib/travis/cli/show.rb",
|
179
|
+
"lib/travis/cli/sshkey.rb",
|
179
180
|
"lib/travis/cli/status.rb",
|
180
181
|
"lib/travis/cli/sync.rb",
|
181
182
|
"lib/travis/cli/token.rb",
|
@@ -205,6 +206,8 @@ Gem::Specification.new do |s|
|
|
205
206
|
"lib/travis/client/restartable.rb",
|
206
207
|
"lib/travis/client/session.rb",
|
207
208
|
"lib/travis/client/settings.rb",
|
209
|
+
"lib/travis/client/singleton_setting.rb",
|
210
|
+
"lib/travis/client/ssh_key.rb",
|
208
211
|
"lib/travis/client/states.rb",
|
209
212
|
"lib/travis/client/user.rb",
|
210
213
|
"lib/travis/client/weak_entity.rb",
|
@@ -215,6 +218,7 @@ Gem::Specification.new do |s|
|
|
215
218
|
"lib/travis/tools/github.rb",
|
216
219
|
"lib/travis/tools/notification.rb",
|
217
220
|
"lib/travis/tools/safe_string.rb",
|
221
|
+
"lib/travis/tools/ssl_key.rb",
|
218
222
|
"lib/travis/tools/system.rb",
|
219
223
|
"lib/travis/version.rb",
|
220
224
|
"spec/cli/cancel_spec.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.17
|
4
|
+
version: 1.6.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
@@ -39,206 +39,206 @@ authors:
|
|
39
39
|
autorequire:
|
40
40
|
bindir: bin
|
41
41
|
cert_chain: []
|
42
|
-
date: 2014-07-
|
42
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
43
43
|
dependencies:
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: faraday
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - ~>
|
48
|
+
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0.9'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - ~>
|
55
|
+
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0.9'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: faraday_middleware
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- - ~>
|
62
|
+
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0.9'
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 0.9.1
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - ~>
|
72
|
+
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0.9'
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 0.9.1
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: highline
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- - ~>
|
82
|
+
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '1.6'
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- - ~>
|
89
|
+
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '1.6'
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: backports
|
94
94
|
requirement: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
- !ruby/object:Gem::Dependency
|
107
107
|
name: gh
|
108
108
|
requirement: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - ~>
|
110
|
+
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0.13'
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - ~>
|
117
|
+
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0.13'
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
121
|
name: launchy
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- - ~>
|
124
|
+
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '2.1'
|
127
127
|
type: :runtime
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- - ~>
|
131
|
+
- - "~>"
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '2.1'
|
134
134
|
- !ruby/object:Gem::Dependency
|
135
135
|
name: pry
|
136
136
|
requirement: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- - <
|
138
|
+
- - "<"
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0.10'
|
141
|
-
- - ~>
|
141
|
+
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0.9'
|
144
144
|
type: :runtime
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- - <
|
148
|
+
- - "<"
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0.10'
|
151
|
-
- - ~>
|
151
|
+
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0.9'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: typhoeus
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - ~>
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0.6'
|
161
|
-
- -
|
161
|
+
- - ">="
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: 0.6.8
|
164
164
|
type: :runtime
|
165
165
|
prerelease: false
|
166
166
|
version_requirements: !ruby/object:Gem::Requirement
|
167
167
|
requirements:
|
168
|
-
- - ~>
|
168
|
+
- - "~>"
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0.6'
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 0.6.8
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
name: pusher-client
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.4'
|
181
181
|
type: :runtime
|
182
182
|
prerelease: false
|
183
183
|
version_requirements: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - ~>
|
185
|
+
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0.4'
|
188
188
|
- !ruby/object:Gem::Dependency
|
189
189
|
name: addressable
|
190
190
|
requirement: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- - ~>
|
192
|
+
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '2.3'
|
195
195
|
type: :runtime
|
196
196
|
prerelease: false
|
197
197
|
version_requirements: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- - ~>
|
199
|
+
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '2.3'
|
202
202
|
- !ruby/object:Gem::Dependency
|
203
203
|
name: rspec
|
204
204
|
requirement: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- - ~>
|
206
|
+
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '2.12'
|
209
209
|
type: :development
|
210
210
|
prerelease: false
|
211
211
|
version_requirements: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - ~>
|
213
|
+
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '2.12'
|
216
216
|
- !ruby/object:Gem::Dependency
|
217
217
|
name: sinatra
|
218
218
|
requirement: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - ~>
|
220
|
+
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.3'
|
223
223
|
type: :development
|
224
224
|
prerelease: false
|
225
225
|
version_requirements: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- - ~>
|
227
|
+
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '1.3'
|
230
230
|
- !ruby/object:Gem::Dependency
|
231
231
|
name: rack-test
|
232
232
|
requirement: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - ~>
|
234
|
+
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0.6'
|
237
237
|
type: :development
|
238
238
|
prerelease: false
|
239
239
|
version_requirements: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- - ~>
|
241
|
+
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0.6'
|
244
244
|
description: CLI and Ruby client library for Travis CI
|
@@ -373,6 +373,7 @@ files:
|
|
373
373
|
- lib/travis/cli/setup/sauce_connect.rb
|
374
374
|
- lib/travis/cli/setup/service.rb
|
375
375
|
- lib/travis/cli/show.rb
|
376
|
+
- lib/travis/cli/sshkey.rb
|
376
377
|
- lib/travis/cli/status.rb
|
377
378
|
- lib/travis/cli/sync.rb
|
378
379
|
- lib/travis/cli/token.rb
|
@@ -402,6 +403,8 @@ files:
|
|
402
403
|
- lib/travis/client/restartable.rb
|
403
404
|
- lib/travis/client/session.rb
|
404
405
|
- lib/travis/client/settings.rb
|
406
|
+
- lib/travis/client/singleton_setting.rb
|
407
|
+
- lib/travis/client/ssh_key.rb
|
405
408
|
- lib/travis/client/states.rb
|
406
409
|
- lib/travis/client/user.rb
|
407
410
|
- lib/travis/client/weak_entity.rb
|
@@ -412,6 +415,7 @@ files:
|
|
412
415
|
- lib/travis/tools/github.rb
|
413
416
|
- lib/travis/tools/notification.rb
|
414
417
|
- lib/travis/tools/safe_string.rb
|
418
|
+
- lib/travis/tools/ssl_key.rb
|
415
419
|
- lib/travis/tools/system.rb
|
416
420
|
- lib/travis/version.rb
|
417
421
|
- spec/cli/cancel_spec.rb
|
@@ -459,18 +463,19 @@ require_paths:
|
|
459
463
|
- lib
|
460
464
|
required_ruby_version: !ruby/object:Gem::Requirement
|
461
465
|
requirements:
|
462
|
-
- -
|
466
|
+
- - ">="
|
463
467
|
- !ruby/object:Gem::Version
|
464
468
|
version: '0'
|
465
469
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
466
470
|
requirements:
|
467
|
-
- -
|
471
|
+
- - ">="
|
468
472
|
- !ruby/object:Gem::Version
|
469
|
-
version:
|
473
|
+
version: '0'
|
470
474
|
requirements: []
|
471
475
|
rubyforge_project:
|
472
|
-
rubygems_version: 2.
|
476
|
+
rubygems_version: 2.2.2
|
473
477
|
signing_key:
|
474
478
|
specification_version: 4
|
475
479
|
summary: Travis CI client
|
476
480
|
test_files: []
|
481
|
+
has_rdoc:
|