aptible-cli 0.3.4 → 0.3.5
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/lib/aptible/cli/agent.rb +3 -0
- data/lib/aptible/cli/helpers/account.rb +37 -0
- data/lib/aptible/cli/subcommands/apps.rb +28 -0
- data/lib/aptible/cli/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dea42a2a13d3ce84d25347c1e4cd45a3aff8d3a
|
4
|
+
data.tar.gz: 6a67a250c973dffcc7614ff5b54306d3d42eefa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66826da8eaee8848ee8134dffad3f651ce8448698e93d184da1c3d6f35574c6da0c25459f978ecb8c5689f93b1f56d93df1f8bcc901e5a558578b67192b8969f
|
7
|
+
data.tar.gz: dd903d736c9158fe9fbdf11b8219c0b5f71621bab3200220ed66d60143fe5a5bde8fd999d544d648375ddde1de4393f823959bdfc7ba43fb276716c58e53369c
|
data/lib/aptible/cli/agent.rb
CHANGED
@@ -4,8 +4,10 @@ require 'json'
|
|
4
4
|
|
5
5
|
require_relative 'helpers/token'
|
6
6
|
require_relative 'helpers/operation'
|
7
|
+
require_relative 'helpers/account'
|
7
8
|
require_relative 'helpers/app'
|
8
9
|
|
10
|
+
require_relative 'subcommands/apps'
|
9
11
|
require_relative 'subcommands/config'
|
10
12
|
require_relative 'subcommands/ssh'
|
11
13
|
require_relative 'subcommands/tunnel'
|
@@ -16,6 +18,7 @@ module Aptible
|
|
16
18
|
include Thor::Actions
|
17
19
|
|
18
20
|
include Helpers::Token
|
21
|
+
include Subcommands::Apps
|
19
22
|
include Subcommands::Config
|
20
23
|
include Subcommands::SSH
|
21
24
|
include Subcommands::Tunnel
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'aptible/api'
|
2
|
+
require 'git'
|
3
|
+
|
4
|
+
module Aptible
|
5
|
+
module CLI
|
6
|
+
module Helpers
|
7
|
+
module Account
|
8
|
+
include Helpers::Token
|
9
|
+
|
10
|
+
def ensure_account(options = {})
|
11
|
+
if (handle = options[:account])
|
12
|
+
account = account_from_handle(handle)
|
13
|
+
return account if account
|
14
|
+
fail "Could not find account #{handle}"
|
15
|
+
else
|
16
|
+
ensure_default_account
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def account_from_handle(handle)
|
21
|
+
Aptible::Api::Account.all(token: fetch_token).find do |a|
|
22
|
+
a.handle == handle
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def ensure_default_account
|
27
|
+
accounts = Aptible::Api::Account.all(token: fetch_token)
|
28
|
+
return accounts.first if accounts.count == 1
|
29
|
+
|
30
|
+
fail Thor::Error, <<-ERR.gsub(/\s+/, ' ').strip
|
31
|
+
Multiple accounts available, please specify with --account
|
32
|
+
ERR
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Aptible
|
2
|
+
module CLI
|
3
|
+
module Subcommands
|
4
|
+
module Apps
|
5
|
+
# rubocop:disable MethodLength
|
6
|
+
def self.included(thor)
|
7
|
+
thor.class_eval do
|
8
|
+
include Helpers::Account
|
9
|
+
|
10
|
+
desc 'apps:create HANDLE', 'Create a new application'
|
11
|
+
option :account
|
12
|
+
define_method 'apps:create' do |handle|
|
13
|
+
account = ensure_account(options)
|
14
|
+
app = account.create_app(handle: handle)
|
15
|
+
|
16
|
+
if app.errors.any?
|
17
|
+
fail app.errors.full_messages.first
|
18
|
+
else
|
19
|
+
say "App #{handle} created!"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
# rubocop:enable MethodLength
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/aptible/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptible-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-api
|
@@ -141,9 +141,11 @@ files:
|
|
141
141
|
- bin/aptible
|
142
142
|
- lib/aptible/cli.rb
|
143
143
|
- lib/aptible/cli/agent.rb
|
144
|
+
- lib/aptible/cli/helpers/account.rb
|
144
145
|
- lib/aptible/cli/helpers/app.rb
|
145
146
|
- lib/aptible/cli/helpers/operation.rb
|
146
147
|
- lib/aptible/cli/helpers/token.rb
|
148
|
+
- lib/aptible/cli/subcommands/apps.rb
|
147
149
|
- lib/aptible/cli/subcommands/config.rb
|
148
150
|
- lib/aptible/cli/subcommands/ssh.rb
|
149
151
|
- lib/aptible/cli/subcommands/tunnel.rb
|