viaduct-toolkit 1.0.11 → 1.0.12

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: d69e7eacde021a7d6e0d6d22f1c7aa8139303895
4
- data.tar.gz: 5a14ab41432ca81b60a27b7c4ce1df7e82ff428d
3
+ metadata.gz: bbd179f34ce8f31b941d55e67f5dee51188d5d3d
4
+ data.tar.gz: 38bd556c0c5bb1530e8af2da790bbf317f8bd536
5
5
  SHA512:
6
- metadata.gz: ee6d8ab691d2f8dbe34ac9e58c07a0c8bc09e79720abd6b1a0535891d11af169448434ed04680fc92878f344ae37be840a488c0cd8a4dc20dc2c4355991ec30c
7
- data.tar.gz: 2c63c45a2639c3b15482e9f3690d53c3f3c94bf37516aadba5a41c6a78f13222b758e07959a1621a58d7155aee0118fe2d4255859e9165a5184fc51ca80bcb53
6
+ metadata.gz: b0bbc588e1acc69dcaf550dd249e2c34c752778571279fda820ea12f0638d99304ce8c3812b5de4b360ab4db3eb5e24b85c97e4dd60fee34f1c16a900e1966c7
7
+ data.tar.gz: 57c6ef49791f621901be38e44ddf2a39c17c568c4069aa8588441fe51047bf82a94c682c2d2d1cf9a3b1150187c2bf2368c02d558e3551472678310a9570b58b
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gem "terminal-table", '~> 1.4', '>= 1.4.5'
6
6
  gem "launchy", ">= 2.4.2", "< 3.0"
7
7
  gem "eventmachine", ">= 1.0.7", "< 1.1"
8
8
  gem 'rake'
9
+ gem 'json', '~> 1.8.3'
@@ -10,7 +10,7 @@ GEM
10
10
  eventmachine (>= 0.12.0)
11
11
  websocket-driver (>= 0.4.0)
12
12
  highline (1.6.21)
13
- json (1.8.1)
13
+ json (1.8.3)
14
14
  launchy (2.4.3)
15
15
  addressable (~> 2.3)
16
16
  moonrope-client (1.0.1)
@@ -29,10 +29,11 @@ DEPENDENCIES
29
29
  colorize (~> 0.7)
30
30
  commander (~> 4.2)
31
31
  eventmachine (>= 1.0.7, < 1.1)
32
+ json (~> 1.8.3)
32
33
  launchy (>= 2.4.2, < 3.0)
33
34
  rake
34
35
  terminal-table (~> 1.4, >= 1.4.5)
35
36
  viaduct-api (~> 1.0, >= 1.0.7)
36
37
 
37
38
  BUNDLED WITH
38
- 1.10.6
39
+ 1.11.2
@@ -0,0 +1,50 @@
1
+ Viaduct::Toolkit.cli.command "app:tunnel" do |c|
2
+
3
+ c.syntax = "app:tunnel"
4
+ c.description = "Start a new SSH tunnel session so you can securely connect to internal parts of your application"
5
+ c.option "--ip REMOTE_IP", String, "The remote IP address to tunnel to"
6
+ c.option "-r REMOTE_PORT", "--remote REMOTE_PORT", String, "The remote port to tunnel to"
7
+ c.option "-l LOCAL_PORT", "--local LOCAL_PORT", String, "The local port to point to the remote port"
8
+ c.option "-d DATABASE_NAME", "--db DATABASE_NAME", String, "The name of a database to establish a tunnel to (no need to provide --ip or --remote)"
9
+ c.action do |args, opts|
10
+ include Commander::Methods
11
+ ensure_logged_in!
12
+ if app = find_application
13
+
14
+ chech_ssh_key_presence
15
+ console = get_application_console_port_forward(app)
16
+
17
+ remote_ip = opts.ip
18
+ remote_port = opts.remote
19
+ local_port = opts.local
20
+
21
+ if opts.db
22
+ database = find_database(app, opts.db)
23
+ remote_ip = database['database']['env_vars']["VDT_DB_#{opts.db.to_s.upcase}_HOST"]
24
+ remote_port = database['database']['env_vars']["VDT_DB_#{opts.db.to_s.upcase}_PORT"]
25
+ end
26
+
27
+ if remote_ip.nil?
28
+ error "Must specify an remote IP using --ip"
29
+ end
30
+
31
+ if remote_port.nil?
32
+ error "Must specify a remote port using --remote"
33
+ end
34
+
35
+ if local_port.nil?
36
+ error "Must specify a local port using --local"
37
+ end
38
+
39
+ ssh_opts = [
40
+ "-p #{console['port']}",
41
+ "-L #{local_port}:#{remote_ip}:#{remote_port}"
42
+ ]
43
+ cmd = "echo -n 'Your tunnel to \e[34m#{remote_ip}:#{remote_port}\e[0m is established on \e[32m127.0.0.1:#{local_port}\e[0m.\nPress CTRL+C to close this connection...'; sleep infinity"
44
+ exec_console_command(console, "ssh #{ssh_opts.join(' ')} vdt@#{console['ip_address']} \"#{cmd}\"")
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ Viaduct::Toolkit.cli.alias_command "tunnel", "app:tunnel"
@@ -142,17 +142,6 @@ module Viaduct
142
142
  puts " $ vdt ssh_key:add".blue
143
143
  puts
144
144
  exit(1)
145
- else
146
- stdout, stderr, status = run("ssh-add -l")
147
- if status == 0
148
- remote_fingerprints = response.data.map { |d| d['fingerprint'] }
149
- local_fingerprints = stdout.split(/\n/).map { |l| l.split(/\s+/)[1] }
150
- unless remote_fingerprints.any? { |f| local_fingerprints.include?(f) }
151
- puts "Warning: it doesn't seem as though your SSH key has been uploaded".yellow
152
- puts "to your Viaduct account. This session may not succeed. If it doesn't".yellow
153
- puts "ensure that you have uploaded to your SSH key to your Viaduct account.".yellow
154
- end
155
- end
156
145
  end
157
146
  else
158
147
  error "Couldn't verify remote SSH keys. Please try again."
@@ -1,5 +1,5 @@
1
1
  module Viaduct
2
2
  module Toolkit
3
- VERSION = '1.0.11'
3
+ VERSION = '1.0.12'
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'eventmachine', '= 1.0.7'
21
21
  s.add_dependency 'faye-websocket', '= 0.8.0'
22
22
  s.add_dependency 'highline', '= 1.6.21'
23
- s.add_dependency 'json', '= 1.8.1'
23
+ s.add_dependency 'json', '= 1.8.3'
24
24
  s.add_dependency 'launchy', '= 2.4.3'
25
25
  s.add_dependency 'moonrope-client', '= 1.0.1'
26
26
  s.add_dependency 'rake', '= 10.4.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viaduct-toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 1.8.1
117
+ version: 1.8.3
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.8.1
124
+ version: 1.8.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: launchy
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -232,6 +232,7 @@ files:
232
232
  - lib/viaduct/toolkit/commands/app_open.rb
233
233
  - lib/viaduct/toolkit/commands/app_public_key.rb
234
234
  - lib/viaduct/toolkit/commands/app_status.rb
235
+ - lib/viaduct/toolkit/commands/app_tunnel.rb
235
236
  - lib/viaduct/toolkit/commands/app_upload.rb
236
237
  - lib/viaduct/toolkit/commands/app_visit.rb
237
238
  - lib/viaduct/toolkit/commands/db_console.rb
@@ -265,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
266
  version: '0'
266
267
  requirements: []
267
268
  rubyforge_project:
268
- rubygems_version: 2.4.5
269
+ rubygems_version: 2.2.2
269
270
  signing_key:
270
271
  specification_version: 4
271
272
  summary: A developer toolkit for working with Viaduct from an CLI