tugboat 2.2.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +284 -274
- data/README.md +1 -1
- data/features/cassettes/config/Array_of_SSH_Keys_in_Config.yml +1 -1
- data/features/cassettes/config/Single_SSH_key_as_number_in_config.yml +1 -1
- data/lib/tugboat.rb +4 -0
- data/lib/tugboat/middleware/create_droplet.rb +1 -1
- data/lib/tugboat/middleware/custom_logger.rb +3 -1
- data/lib/tugboat/middleware/inject_client.rb +3 -0
- data/lib/tugboat/middleware/list_regions.rb +2 -2
- data/lib/tugboat/middleware/list_sizes.rb +2 -2
- data/lib/tugboat/version.rb +1 -1
- data/license/dependency_decisions.yml +6 -0
- data/spec/cli/authorize_cli_spec.rb +2 -2
- data/spec/cli/create_cli_spec.rb +10 -10
- data/spec/cli/debug_cli_spec.rb +4 -4
- data/spec/cli/destroy_cli_spec.rb +14 -14
- data/spec/cli/destroy_image_cli_spec.rb +8 -8
- data/spec/cli/droplets_cli_spec.rb +13 -13
- data/spec/cli/env_variable_spec.rb +2 -2
- data/spec/cli/halt_cli_spec.rb +15 -15
- data/spec/cli/images_cli_spec.rb +6 -6
- data/spec/cli/info_cli_spec.rb +32 -32
- data/spec/cli/info_image_cli_spec.rb +13 -13
- data/spec/cli/keys_cli_spec.rb +1 -1
- data/spec/cli/password_reset_cli_spec.rb +13 -13
- data/spec/cli/rebuild_cli_spec.rb +48 -48
- data/spec/cli/regions_cli_spec.rb +3 -3
- data/spec/cli/resize_cli_spec.rb +12 -12
- data/spec/cli/restart_cli_spec.rb +12 -12
- data/spec/cli/sizes_cli_spec.rb +2 -2
- data/spec/cli/snapshot_cli_spec.rb +11 -11
- data/spec/cli/ssh_cli_spec.rb +6 -6
- data/spec/cli/start_cli_spec.rb +11 -11
- data/spec/cli/verify_cli_spec.rb +3 -3
- data/spec/cli/wait_cli_spec.rb +11 -11
- data/spec/middleware/check_credentials_spec.rb +1 -1
- data/spec/middleware/inject_client_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/tugboat.gemspec +3 -1
- metadata +34 -6
@@ -6,16 +6,16 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'restarts a droplet' do
|
7
7
|
it 'with a fuzzy name' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
15
15
|
|
16
16
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
17
17
|
with(body: '{"type":"reboot"}',
|
18
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
18
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
19
19
|
to_return(status: 200, body: fixture('restart_response'), headers: {})
|
20
20
|
|
21
21
|
cli.restart('example.com')
|
@@ -28,16 +28,16 @@ Queuing restart for 6918990 (example.com)...Restart complete!
|
|
28
28
|
|
29
29
|
it 'restarts a droplet hard when the hard option is used' do
|
30
30
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
31
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
31
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
32
32
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
33
33
|
|
34
34
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
35
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
35
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
36
36
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
37
37
|
|
38
38
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
39
39
|
with(body: '{"type":"power_cycle"}',
|
40
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
40
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
41
41
|
to_return(status: 200, body: '', headers: {})
|
42
42
|
|
43
43
|
cli.options = cli.options.merge(hard: true)
|
@@ -51,16 +51,16 @@ Queuing hard restart for 6918990 (example.com)...Restart complete!
|
|
51
51
|
|
52
52
|
it 'with an id' do
|
53
53
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
54
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
54
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
55
55
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
56
56
|
|
57
57
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
58
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
58
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
59
59
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
60
60
|
|
61
61
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
62
62
|
with(body: '{"type":"reboot"}',
|
63
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
63
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
64
64
|
to_return(status: 200, body: fixture('restart_response'), headers: {})
|
65
65
|
|
66
66
|
cli.options = cli.options.merge(id: '6918990')
|
@@ -74,16 +74,16 @@ Queuing restart for 6918990 (example.com)...Restart complete!
|
|
74
74
|
|
75
75
|
it 'with a name' do
|
76
76
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
77
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
77
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
78
78
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
79
79
|
|
80
80
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
81
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
81
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
82
82
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
83
83
|
|
84
84
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/6918990/actions').
|
85
85
|
with(body: '{"type":"reboot"}',
|
86
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
86
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
87
87
|
to_return(status: 200, body: fixture('restart_response'), headers: {})
|
88
88
|
|
89
89
|
cli.options = cli.options.merge(name: 'example.com')
|
data/spec/cli/sizes_cli_spec.rb
CHANGED
@@ -5,8 +5,8 @@ describe Tugboat::CLI do
|
|
5
5
|
|
6
6
|
describe 'sizes' do
|
7
7
|
it 'shows a list' do
|
8
|
-
stub_request(:get, 'https://api.digitalocean.com/v2/sizes?per_page=
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
8
|
+
stub_request(:get, 'https://api.digitalocean.com/v2/sizes?page=1&per_page=20').
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_sizes'))
|
11
11
|
|
12
12
|
cli.sizes
|
@@ -8,16 +8,16 @@ describe Tugboat::CLI do
|
|
8
8
|
describe 'snapshots a droplet' do
|
9
9
|
it 'with a fuzzy name' do
|
10
10
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
11
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
11
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
12
12
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
13
13
|
|
14
14
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
15
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
15
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
16
16
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
17
17
|
|
18
18
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
|
19
19
|
with(body: '{"type":"snapshot","name":"foo-snapshot"}',
|
20
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
20
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
21
21
|
to_return(status: 200, body: fixture('snapshot_response'), headers: {})
|
22
22
|
|
23
23
|
cli.snapshot(snapshot_name, 'example3.com')
|
@@ -31,16 +31,16 @@ Queuing snapshot 'foo-snapshot' for 3164444 (example3.com)...Snapshot successful
|
|
31
31
|
|
32
32
|
it 'with an id' do
|
33
33
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
34
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
34
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
35
35
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
36
36
|
|
37
37
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/3164444?per_page=200').
|
38
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
38
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
39
39
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplet_inactive'))
|
40
40
|
|
41
41
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164494/actions').
|
42
42
|
with(body: '{"type":"snapshot","name":"foo-snapshot"}',
|
43
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
43
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
44
44
|
to_return(status: 200, body: fixture('snapshot_response'), headers: {})
|
45
45
|
|
46
46
|
cli.options = cli.options.merge(id: '3164444')
|
@@ -55,16 +55,16 @@ Queuing snapshot 'foo-snapshot' for 3164494 (example.com)...Snapshot successful!
|
|
55
55
|
|
56
56
|
it 'with a name' do
|
57
57
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
58
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
58
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
59
59
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
60
60
|
|
61
61
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
62
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
62
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
63
63
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
64
64
|
|
65
65
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
|
66
66
|
with(body: '{"type":"snapshot","name":"foo-snapshot"}',
|
67
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
67
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
68
68
|
to_return(status: 200, body: fixture('snapshot_response'), headers: {})
|
69
69
|
|
70
70
|
cli.options = cli.options.merge(name: 'example3.com')
|
@@ -79,11 +79,11 @@ Queuing snapshot 'foo-snapshot' for 3164444 (example3.com)...Snapshot successful
|
|
79
79
|
|
80
80
|
it 'does not snapshot a droplet that is active' do
|
81
81
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
82
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
82
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
83
83
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
84
84
|
|
85
85
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
86
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
86
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
87
87
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
88
88
|
|
89
89
|
cli.options = cli.options.merge(name: 'example.com')
|
data/spec/cli/ssh_cli_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'ssh' do
|
7
7
|
it "tries to fetch the droplet's IP from the API" do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
@@ -18,11 +18,11 @@ describe Tugboat::CLI do
|
|
18
18
|
|
19
19
|
it "wait's until droplet active if -w command is given and droplet already active" do
|
20
20
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
21
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
21
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
22
22
|
to_return(status: 200, body: '', headers: {})
|
23
23
|
|
24
24
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
25
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
25
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
26
26
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
27
27
|
|
28
28
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
@@ -45,11 +45,11 @@ SShing with options: -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownH
|
|
45
45
|
|
46
46
|
it "wait's until droplet active if -w command is given and droplet eventually active" do
|
47
47
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
48
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
48
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
49
49
|
to_return(status: 200, body: '', headers: {})
|
50
50
|
|
51
51
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
52
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
52
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
53
53
|
to_return(
|
54
54
|
{ status: 200, body: fixture('show_droplet_inactive'), headers: {} },
|
55
55
|
status: 200, body: fixture('show_droplet'), headers: {}
|
@@ -75,7 +75,7 @@ SShing with options: -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownH
|
|
75
75
|
|
76
76
|
it 'does not allow ssh into a droplet that is inactive' do
|
77
77
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
78
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
78
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
79
79
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
80
80
|
|
81
81
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
data/spec/cli/start_cli_spec.rb
CHANGED
@@ -6,16 +6,16 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'start' do
|
7
7
|
it 'starts the droplet with a fuzzy name' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
15
15
|
|
16
16
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
|
17
17
|
with(body: '{"type":"power_on"}',
|
18
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
18
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
19
19
|
to_return(status: 200, body: fixture('droplet_start_response'), headers: {})
|
20
20
|
|
21
21
|
cli.start('example3.com')
|
@@ -28,15 +28,15 @@ Queuing start for 3164444 (example3.com)...Start complete!
|
|
28
28
|
|
29
29
|
it 'starts the droplet with an id' do
|
30
30
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
31
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
31
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
32
32
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
33
33
|
|
34
34
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/3164494?per_page=200').
|
35
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
35
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
36
36
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplet_inactive'))
|
37
37
|
|
38
38
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164494/actions').
|
39
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
39
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
40
40
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplet_inactive'))
|
41
41
|
|
42
42
|
cli.options = cli.options.merge(id: '3164494')
|
@@ -50,16 +50,16 @@ Queuing start for 3164494 (example.com)...Start complete!
|
|
50
50
|
|
51
51
|
it 'starts the droplet with a name' do
|
52
52
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
53
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
53
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
54
54
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
55
55
|
|
56
56
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
57
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
57
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
58
58
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
59
59
|
|
60
60
|
stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
|
61
61
|
with(body: '{"type":"power_on"}',
|
62
|
-
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
62
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
63
63
|
to_return(status: 200, body: fixture('droplet_start_response'), headers: {})
|
64
64
|
|
65
65
|
cli.options = cli.options.merge(name: 'example3.com')
|
@@ -73,11 +73,11 @@ Queuing start for 3164444 (example3.com)...Start complete!
|
|
73
73
|
|
74
74
|
it 'does not start a droplet that is inactive' do
|
75
75
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
76
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
76
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
77
77
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
78
78
|
|
79
79
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
80
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
80
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
81
81
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
82
82
|
|
83
83
|
cli.options = cli.options.merge(name: 'example.com')
|
data/spec/cli/verify_cli_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'verify' do
|
7
7
|
it 'returns confirmation text when verify passes' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
cli.verify
|
@@ -16,7 +16,7 @@ describe Tugboat::CLI do
|
|
16
16
|
|
17
17
|
it 'returns error when verify fails' do
|
18
18
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
19
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
19
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
20
20
|
to_return(headers: { 'Content-Type' => 'text/html' }, status: 401, body: fixture('401'))
|
21
21
|
|
22
22
|
expect { cli.verify }.to raise_error(SystemExit)
|
@@ -26,7 +26,7 @@ describe Tugboat::CLI do
|
|
26
26
|
|
27
27
|
it 'returns error string when verify fails and a non-json reponse is given' do
|
28
28
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
29
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
29
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
30
30
|
to_return(headers: { 'Content-Type' => 'text/html' }, status: 500, body: fixture('500', 'html'))
|
31
31
|
|
32
32
|
expect { cli.verify }.to raise_error(SystemExit)
|
data/spec/cli/wait_cli_spec.rb
CHANGED
@@ -6,15 +6,15 @@ describe Tugboat::CLI do
|
|
6
6
|
describe 'wait' do
|
7
7
|
it 'waits for a droplet with a fuzzy name' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
11
11
|
|
12
12
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
13
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
13
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
14
14
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
15
15
|
|
16
16
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
17
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
17
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
18
18
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
19
19
|
|
20
20
|
cli.options = cli.options.merge(state: 'active')
|
@@ -28,15 +28,15 @@ eos
|
|
28
28
|
|
29
29
|
it 'loops whilst it waits for state' do
|
30
30
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
31
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
31
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
32
32
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
33
33
|
|
34
34
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
35
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
35
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
36
36
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
37
37
|
|
38
38
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
39
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
39
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
40
40
|
to_return(
|
41
41
|
{ status: 200, body: fixture('show_droplet_inactive'), headers: {} },
|
42
42
|
status: 200, body: fixture('show_droplet'), headers: {}
|
@@ -53,11 +53,11 @@ eos
|
|
53
53
|
|
54
54
|
it 'waits for a droplet with an id' do
|
55
55
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
56
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
56
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
57
57
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
58
58
|
|
59
59
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
60
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
60
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
61
61
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
62
62
|
|
63
63
|
cli.options = cli.options.merge(id: '6918990', state: 'active')
|
@@ -71,15 +71,15 @@ Waiting for droplet to become active..done\e[0m (0s)
|
|
71
71
|
|
72
72
|
it 'waits for a droplet with a name' do
|
73
73
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
74
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
74
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
75
75
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
76
76
|
|
77
77
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
|
78
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
78
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
79
79
|
to_return(status: 200, body: fixture('show_droplets'), headers: {})
|
80
80
|
|
81
81
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
|
82
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
82
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
83
83
|
to_return(status: 200, body: fixture('show_droplet'), headers: {})
|
84
84
|
|
85
85
|
cli.options = cli.options.merge(name: 'example.com', state: 'active')
|
@@ -6,7 +6,7 @@ describe Tugboat::Middleware::CheckCredentials do
|
|
6
6
|
describe '.call' do
|
7
7
|
it 'raises SystemExit with no configuration' do
|
8
8
|
stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
|
9
|
-
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.
|
9
|
+
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
|
10
10
|
to_return(headers: { 'Content-Type' => 'application/json' }, status: 401, body: fixture('401'))
|
11
11
|
|
12
12
|
# Inject the client.
|
@@ -14,11 +14,11 @@ describe Tugboat::Middleware::InjectClient do
|
|
14
14
|
it 'loads the client into the environment' do
|
15
15
|
described_class.new(app).call(env)
|
16
16
|
|
17
|
-
env['barge'].
|
17
|
+
expect(env['barge']).to be_a Barge::Client
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'creates a client with values from config file' do
|
21
|
-
Barge::Client.
|
21
|
+
expect(Barge::Client).to receive(:new).with(hash_including(access_token: 'foo'))
|
22
22
|
|
23
23
|
described_class.new(app).call(env)
|
24
24
|
end
|
data/spec/spec_helper.rb
CHANGED
data/tugboat.gemspec
CHANGED
@@ -20,9 +20,11 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_dependency 'thor', '0.18.1'
|
22
22
|
gem.add_dependency 'barge', '0.12.0'
|
23
|
+
gem.add_dependency 'droplet_kit', '2.0.1'
|
23
24
|
gem.add_dependency 'middleware', '0.1.0'
|
24
|
-
gem.add_dependency 'faraday', '0.
|
25
|
+
gem.add_dependency 'faraday', '0.9.2'
|
25
26
|
gem.add_dependency 'hashie', '3.5.5'
|
27
|
+
gem.add_dependency 'activesupport', '4.0.13'
|
26
28
|
|
27
29
|
gem.add_development_dependency 'rake', '< 11.0'
|
28
30
|
gem.add_development_dependency 'rspec-core', '~> 2.14.0'
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tugboat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Pearkes
|
8
8
|
- Peter Souter
|
9
|
-
- Ørjan Blom
|
9
|
+
- "Ørjan Blom"
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.12.0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: droplet_kit
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.0.1
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.0.1
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: middleware
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,14 +74,14 @@ dependencies:
|
|
60
74
|
requirements:
|
61
75
|
- - '='
|
62
76
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
77
|
+
version: 0.9.2
|
64
78
|
type: :runtime
|
65
79
|
prerelease: false
|
66
80
|
version_requirements: !ruby/object:Gem::Requirement
|
67
81
|
requirements:
|
68
82
|
- - '='
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
84
|
+
version: 0.9.2
|
71
85
|
- !ruby/object:Gem::Dependency
|
72
86
|
name: hashie
|
73
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,6 +96,20 @@ dependencies:
|
|
82
96
|
- - '='
|
83
97
|
- !ruby/object:Gem::Version
|
84
98
|
version: 3.5.5
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: activesupport
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 4.0.13
|
106
|
+
type: :runtime
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - '='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 4.0.13
|
85
113
|
- !ruby/object:Gem::Dependency
|
86
114
|
name: rake
|
87
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -466,7 +494,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
466
494
|
version: '0'
|
467
495
|
requirements: []
|
468
496
|
rubyforge_project:
|
469
|
-
rubygems_version: 2.
|
497
|
+
rubygems_version: 2.2.0
|
470
498
|
signing_key:
|
471
499
|
specification_version: 4
|
472
500
|
summary: A command line tool for interacting with your DigitalOcean droplets.
|