aptible-cli 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3d74fcf955ded96e824f00538e04210e31412c9
4
- data.tar.gz: d96da04e7f720d58f77eecb6371979ec0b7485a3
3
+ metadata.gz: e5b09e8001e9be00308f78164050f5a8b796a01a
4
+ data.tar.gz: 161769a0cede1101f3aaaea7ef7ceb2561326672
5
5
  SHA512:
6
- metadata.gz: 319a2859143709591fa1abf2ec3e77b68ecde13d268887ce5016d8a986e9947ea6fc182c832757a4eede36753abd8c6ebc65b105dda29ac5051773eeb86de1a1
7
- data.tar.gz: 3547c769910209356ab04d11f52f6ecc993cdc0e71735f541ad62c15a30804e1d2ea5cc5fbb817df60e99b2484e301c253db9f50fffec5aa613230242d4c8809
6
+ metadata.gz: 6c3b9516062265be2abee6b8594d62e81c7498bd4bdfa6dc5cceb5269e73aea1cf140ce1c47e2aceb991586daefa099ae6989d6db3d5e2a2b4c6d9054a0da6db
7
+ data.tar.gz: f84bcf686ba16cc90fe293adb58127b0fb40792f581a8d71e44c3a3aaeb1977982802768067d00fb6e7ce7ca2674e915f234c29de27142265253a6be8d970fee
@@ -7,6 +7,7 @@ require_relative 'helpers/operation'
7
7
  require_relative 'helpers/app'
8
8
 
9
9
  require_relative 'subcommands/config'
10
+ require_relative 'subcommands/ssh'
10
11
 
11
12
  module Aptible
12
13
  module CLI
@@ -15,6 +16,7 @@ module Aptible
15
16
 
16
17
  include Helpers::Token
17
18
  include Subcommands::Config
19
+ include Subcommands::SSH
18
20
 
19
21
  desc 'version', 'Print Aptible CLI version'
20
22
  def version
@@ -0,0 +1,43 @@
1
+ require 'shellwords'
2
+
3
+ module Aptible
4
+ module CLI
5
+ module Subcommands
6
+ module SSH
7
+ # rubocop:disable MethodLength
8
+ def self.included(thor)
9
+ thor.class_eval do
10
+ include Helpers::Operation
11
+ include Helpers::App
12
+
13
+ desc 'ssh COMMAND', 'Run a command against an app'
14
+ long_desc <<-LONGDESC
15
+ Runs an interactive command against a remote Aptible app
16
+
17
+ If specifying an app, invoke via: aptible ssh [--app=APP] COMMAND
18
+ LONGDESC
19
+ option :app
20
+ def ssh(*args)
21
+ app = ensure_app(options)
22
+ host = app.account.bastion_host
23
+ port = app.account.bastion_port
24
+
25
+ ENV['ACCESS_TOKEN'] = fetch_token
26
+ ENV['APTIBLE_COMMAND'] = command_from_args(*args)
27
+ ENV['APTIBLE_APP'] = options[:app]
28
+
29
+ Kernel.exec "ssh -o 'SendEnv=*' -p #{port} root@#{host}"
30
+ end
31
+
32
+ private
33
+
34
+ def command_from_args(*args)
35
+ Shellwords.join(args)
36
+ end
37
+ end
38
+ end
39
+ # rubocop:enable MethodLength
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module CLI
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
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.2.0
4
+ version: 0.3.0
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-03-28 00:00:00.000000000 Z
11
+ date: 2014-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -159,6 +159,7 @@ files:
159
159
  - lib/aptible/cli/helpers/operation.rb
160
160
  - lib/aptible/cli/helpers/token.rb
161
161
  - lib/aptible/cli/subcommands/config.rb
162
+ - lib/aptible/cli/subcommands/ssh.rb
162
163
  - lib/aptible/cli/version.rb
163
164
  - spec/aptible/cli/agent_spec.rb
164
165
  - spec/spec_helper.rb
@@ -182,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
183
  version: '0'
183
184
  requirements: []
184
185
  rubyforge_project:
185
- rubygems_version: 2.2.1
186
+ rubygems_version: 2.2.2
186
187
  signing_key:
187
188
  specification_version: 4
188
189
  summary: Command-line interface for Aptible services