ey-pro-cli 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/ey-pro-cli.gemspec +1 -0
- data/lib/ey_pro_cli.rb +15 -0
- data/lib/ey_pro_cli/version.rb +1 -1
- data/spec/accounts_spec.rb +21 -0
- data/spec/deploy_spec.rb +31 -36
- data/spec/login_spec.rb +3 -16
- data/spec/logout_spec.rb +8 -6
- data/spec/support/core_helper.rb +17 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acf342d707f2bef9f0a62d3d9959b7ca0af1971d
|
4
|
+
data.tar.gz: 83fb71e8d8242a5c78aa13d27bac3e45bee649c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba8b7a6881dd68087640013230e50780565bb3bed1abf398037e498449175b05221fc6ab4f14ea540f0c5c87bc33c72cd08602d2204978b25033cc5fbac88d8
|
7
|
+
data.tar.gz: 31a1ca488d31b1628d9e6ad1d5e7ce5ce059fccd190bd9627746f9573c7a54f8e6f70d5fd20109f45741a2ad84ce7ba8ea77954a4d0134765f00b3c1f3510ee1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ey-pro-cli (0.0.
|
4
|
+
ey-pro-cli (0.0.8)
|
5
5
|
addressable (~> 2.2)
|
6
6
|
cistern (~> 0.11, >= 0.11.1)
|
7
7
|
colorize
|
@@ -11,6 +11,7 @@ PATH
|
|
11
11
|
faye
|
12
12
|
mime-types
|
13
13
|
sshkey (~> 1.6)
|
14
|
+
table_print
|
14
15
|
thor
|
15
16
|
|
16
17
|
GEM
|
@@ -77,6 +78,7 @@ GEM
|
|
77
78
|
rspec-support (3.3.0)
|
78
79
|
slop (3.6.0)
|
79
80
|
sshkey (1.7.0)
|
81
|
+
table_print (1.5.4)
|
80
82
|
thor (0.19.1)
|
81
83
|
websocket-driver (0.6.2)
|
82
84
|
websocket-extensions (>= 0.1.0)
|
data/ey-pro-cli.gemspec
CHANGED
data/lib/ey_pro_cli.rb
CHANGED
@@ -7,6 +7,7 @@ $:.unshift(File.dirname(__FILE__) + '/vendor/core')
|
|
7
7
|
|
8
8
|
require 'colorize'
|
9
9
|
require 'thor'
|
10
|
+
require 'table_print'
|
10
11
|
require File.expand_path(File.dirname(__FILE__) + '/ey_pro_cli/version')
|
11
12
|
require File.expand_path(File.dirname(__FILE__) + '/vendor/core/ey-core')
|
12
13
|
|
@@ -19,6 +20,16 @@ class EyProCli < Thor
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
desc "accounts", "Retrieve a list of Engine Yard PRO accounts that you have access to"
|
24
|
+
|
25
|
+
def accounts
|
26
|
+
accounts = core_client.users.current.accounts
|
27
|
+
width = longest_account_name_length(accounts)
|
28
|
+
|
29
|
+
table_data = TablePrint::Printer.new(accounts, [{id: {width: 36}}, :name])
|
30
|
+
puts table_data.table_print
|
31
|
+
end
|
32
|
+
|
22
33
|
desc "login", "Retrieve API token from Engine Yard PRO"
|
23
34
|
|
24
35
|
def login
|
@@ -113,6 +124,10 @@ class EyProCli < Thor
|
|
113
124
|
|
114
125
|
private
|
115
126
|
|
127
|
+
def longest_account_name_length(accounts)
|
128
|
+
accounts.map(&:name).group_by(&:size).max.last.length
|
129
|
+
end
|
130
|
+
|
116
131
|
def check_for_updates
|
117
132
|
gem = core_client.gems.get("ey-pro-cli")
|
118
133
|
unless gem
|
data/lib/ey_pro_cli/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EyProCli do
|
4
|
+
describe "accounts" do
|
5
|
+
context "with a token" do
|
6
|
+
before(:each) do
|
7
|
+
create_core_credentials
|
8
|
+
@accounts = create_accounts(subject.core_client, quantity: 2)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "returns a list of accounts" do
|
12
|
+
output = capture(:stdout) { subject.accounts }
|
13
|
+
|
14
|
+
expect(output).to match(/#{@accounts.first.id}/)
|
15
|
+
expect(output).to match(/#{@accounts.first.name}/)
|
16
|
+
expect(output).to match(/#{@accounts.last.id}/)
|
17
|
+
expect(output).to match(/#{@accounts.last.name}/)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/deploy_spec.rb
CHANGED
@@ -2,54 +2,49 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe EyProCli do
|
4
4
|
describe "deploy" do
|
5
|
-
|
6
|
-
|
7
|
-
---
|
8
|
-
'#{subject.core_url}': #{SecureRandom.hex(20)}'
|
9
|
-
EOF
|
10
|
-
@tempfile.rewind
|
11
|
-
subject.class.core_file = @tempfile
|
12
|
-
end
|
5
|
+
context "with a token" do
|
6
|
+
before(:each) { create_core_credentials }
|
13
7
|
|
14
|
-
|
8
|
+
let(:options) { {} }
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
context "with a running environment" do
|
11
|
+
before(:each) do
|
12
|
+
account, environment, application = boot_environment(subject.core_client)
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
options.merge!(
|
15
|
+
:account => account.name,
|
16
|
+
:app => application.name,
|
17
|
+
:environment => environment.name,
|
18
|
+
)
|
19
|
+
end
|
26
20
|
|
27
|
-
|
28
|
-
|
21
|
+
it "successfully deploys" do
|
22
|
+
subject.options = options
|
29
23
|
|
30
|
-
|
31
|
-
|
24
|
+
expect(capture(:stdout) { subject.deploy }).to match(/deploy successful/i)
|
25
|
+
end
|
32
26
|
|
33
|
-
|
34
|
-
|
27
|
+
context "--stream" do
|
28
|
+
before(:each) { options.merge!(stream: true) }
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
it "streams" do
|
31
|
+
subject.options = options
|
32
|
+
expect(capture(:stdout) { subject.deploy }).to match(/subscription failed/i) # proves that the flag works, even if the mock doesn't
|
33
|
+
end
|
39
34
|
end
|
40
|
-
end
|
41
35
|
|
42
|
-
|
43
|
-
|
36
|
+
context "--no-update-check" do
|
37
|
+
before(:each) { subject.options = options }
|
44
38
|
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
it "has the updater message without the flag" do
|
40
|
+
expect(capture(:stdout) { subject.deploy }).to match(/gem outdated, consider updating/i)
|
41
|
+
end
|
48
42
|
|
49
|
-
|
50
|
-
|
43
|
+
it "does not have the message with the flag" do
|
44
|
+
options.merge!("no-update-check" => true)
|
51
45
|
|
52
|
-
|
46
|
+
expect(capture(:stdout) { subject.deploy }).not_to match(/gem outdated, consider updating/i)
|
47
|
+
end
|
53
48
|
end
|
54
49
|
end
|
55
50
|
end
|
data/spec/login_spec.rb
CHANGED
@@ -3,32 +3,19 @@ require 'spec_helper'
|
|
3
3
|
describe EyProCli do
|
4
4
|
describe "login" do
|
5
5
|
context "with a valid user and password" do
|
6
|
-
before(:each) { subject.class.core_file = @tempfile }
|
7
|
-
|
8
6
|
it "writes the token" do
|
9
|
-
|
10
|
-
|
11
|
-
output = capture(:stdout) { subject.login }
|
12
|
-
expect(output).to match(/writing token/i)
|
13
|
-
|
14
|
-
expect(read_yaml(@tempfile)).to have_key("https://api.engineyard.com/")
|
7
|
+
create_core_credentials
|
15
8
|
end
|
16
9
|
|
17
10
|
it "updates the token if it does not match" do
|
18
|
-
|
19
|
-
|
20
|
-
output = capture(:stdout) { subject.login }
|
21
|
-
expect(output).to match(/writing token/i)
|
11
|
+
create_core_credentials
|
22
12
|
|
23
13
|
output = capture(:stdout) { subject.login }
|
24
14
|
expect(output).to match(/token does not match/i)
|
25
15
|
end
|
26
16
|
|
27
17
|
it "does not update the token if it already exists" do
|
28
|
-
|
29
|
-
|
30
|
-
output = capture(:stdout) { subject.login }
|
31
|
-
expect(output).to match(/writing token/i)
|
18
|
+
create_core_credentials
|
32
19
|
|
33
20
|
yaml = read_yaml(@tempfile)
|
34
21
|
expect(yaml).to have_key("https://api.engineyard.com/")
|
data/spec/logout_spec.rb
CHANGED
@@ -2,14 +2,16 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe EyProCli do
|
4
4
|
describe "logout" do
|
5
|
-
context "
|
6
|
-
before(:each)
|
7
|
-
subject.class.core_file = @tempfile
|
8
|
-
|
9
|
-
allow(subject).to receive(:ask) { FFaker::Internet.email }
|
5
|
+
context "without a token" do
|
6
|
+
before(:each) { subject.class.core_file = @tempfile }
|
10
7
|
|
11
|
-
|
8
|
+
it "handles a missing token" do
|
9
|
+
expect(capture(:stdout) { subject.logout }).to match(/no api token found/i)
|
12
10
|
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with a token" do
|
14
|
+
before(:each) { create_core_credentials }
|
13
15
|
|
14
16
|
it "removes the token" do
|
15
17
|
expect(capture(:stdout) { subject.logout }).to match(/successfully removed api token/i)
|
data/spec/support/core_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module CoreHelper
|
2
2
|
def boot_environment(core_client)
|
3
|
-
account = core_client.
|
3
|
+
account = create_accounts(core_client).first
|
4
4
|
environment = account.environments.create(name: SecureRandom.hex(4))
|
5
5
|
application = account.applications.create(name: SecureRandom.hex(4))
|
6
6
|
provider = create_provider(account)
|
@@ -12,6 +12,12 @@ module CoreHelper
|
|
12
12
|
[account, environment, application]
|
13
13
|
end
|
14
14
|
|
15
|
+
def create_accounts(core_client, quantity: 1)
|
16
|
+
quantity.times.map do |iteration|
|
17
|
+
core_client.accounts.create(name: SecureRandom.hex(4))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
def create_provider(account)
|
16
22
|
attributes = {type: :aws, provisioned_id: SecureRandom.hex(8)}
|
17
23
|
attributes[:credentials] ||= {
|
@@ -25,6 +31,16 @@ module CoreHelper
|
|
25
31
|
|
26
32
|
account.providers.create!(attributes).resource!
|
27
33
|
end
|
34
|
+
|
35
|
+
def create_core_credentials
|
36
|
+
subject.class.core_file = @tempfile
|
37
|
+
|
38
|
+
allow(subject).to receive(:ask) { FFaker::Internet.email }
|
39
|
+
|
40
|
+
output = capture(:stdout) { subject.login }
|
41
|
+
|
42
|
+
expect(read_yaml(@tempfile)).to have_key("https://api.engineyard.com/")
|
43
|
+
end
|
28
44
|
end
|
29
45
|
|
30
46
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey-pro-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Engine Yard Cloud Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -240,6 +240,20 @@ dependencies:
|
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: table_print
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
type: :runtime
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '0'
|
243
257
|
description: This gem allows you to deploy your rails application to Engine Yard Pro
|
244
258
|
directly from the command line.
|
245
259
|
email: cloud@engineyard.com
|
@@ -598,6 +612,7 @@ files:
|
|
598
612
|
- lib/vendor/core/ey-core/subscribable.rb
|
599
613
|
- lib/vendor/core/ey-core/token_authentication.rb
|
600
614
|
- lib/vendor/core/ey-core/version.rb
|
615
|
+
- spec/accounts_spec.rb
|
601
616
|
- spec/deploy_spec.rb
|
602
617
|
- spec/login_spec.rb
|
603
618
|
- spec/logout_spec.rb
|
@@ -628,6 +643,7 @@ signing_key:
|
|
628
643
|
specification_version: 4
|
629
644
|
summary: Command-line deployment for Engine Yard pro
|
630
645
|
test_files:
|
646
|
+
- spec/accounts_spec.rb
|
631
647
|
- spec/deploy_spec.rb
|
632
648
|
- spec/login_spec.rb
|
633
649
|
- spec/logout_spec.rb
|