Class: VagrantPlugins::Share::Command::Connect
- Inherits:
-
Object
- Object
- VagrantPlugins::Share::Command::Connect
show all
- Includes:
- Ngrok::Connect
- Defined in:
- lib/vagrant-share/command/connect.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#connect_to_share, #execute_connect, #execute_ssh
Class Method Details
.synopsis ⇒ Object
19
20
21
|
# File 'lib/vagrant-share/command/connect.rb', line 19
def self.synopsis
"connect to a remotely shared Vagrant environment"
end
|
Instance Method Details
#execute ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/vagrant-share/command/connect.rb', line 23
def execute
@logger = Log4r::Logger.new("vagrant::share::command::connect")
options = {}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant connect NAME"
o.separator ""
o.separator "Gives you access to any Vagrant environment shared using "
o.separator "`vagrant share`. The NAME parameter should be the unique name"
o.separator "that was outputted with `vagrant share` on the remote side."
o.separator ""
o.separator "Vagrant will give you an IP that you can use to access the"
o.separator "remote environment. You'll be able to access any ports that"
o.separator "the shared environment has authorized."
o.separator ""
o.on("--disable-static-ip", "No static IP, only a SOCKS proxy") do |s|
options[:disable_static_ip] = s
end
o.on("--static-ip IP", String, "Manually override static IP chosen") do |ip|
begin
IPAddr.new(ip)
rescue IPAddr::InvalidAddressError
raise Errors::IPInvalid, ip: ip
end
options[:static_ip] = ip
end
o.on("--ssh", "SSH into the remote machine") do |ssh|
options[:ssh] = ssh
end
o.on("--driver DRIVER", "Deprecated option for compatibility") do |driver|
options[:driver] = driver
end
o.on("--share-password", "Custom share password") do |p|
options[:share_password] = p
end
end
argv = parse_options(opts)
return if !argv
if argv.empty? || argv.length > 1
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp
end
if options[:ssh]
return execute_ssh(argv, options)
else
return execute_connect(argv, options)
end
end
|