vagrant-port 0.0.1 → 0.0.2
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.
- data/lib/vagrant-port.rb +6 -0
- data/lib/vagrant-port/command.rb +33 -0
- data/lib/vagrant-port/plugin.rb +10 -0
- data/lib/vagrant-port/version.rb +3 -0
- data/vagrant-port.gemspec +20 -0
- metadata +10 -4
data/lib/vagrant-port.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module VagrantPort
|
2
|
+
class Command < Vagrant.plugin("2", :command)
|
3
|
+
Settings = Struct.new(:machines)
|
4
|
+
def execute
|
5
|
+
require "optparse"
|
6
|
+
settings = Settings.new
|
7
|
+
settings.machines = []
|
8
|
+
options = OptionParser.new do |o|
|
9
|
+
o.banner = "Query which host port is mapped to the given guest port.\n" \
|
10
|
+
"Usage: vagrant port <guest_port_number>"
|
11
|
+
|
12
|
+
o.on("-m MACHINE", "The machine to query") do |value|
|
13
|
+
settings.machines << value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
settings.machines = ["default"] if settings.machines.empty?
|
17
|
+
|
18
|
+
argv = parse_options(options)
|
19
|
+
if argv.nil? || argv.empty?
|
20
|
+
puts options.help
|
21
|
+
return 1
|
22
|
+
end
|
23
|
+
|
24
|
+
with_target_vms(settings.machines) do |machine|
|
25
|
+
machine.provider.driver.read_forwarded_ports.each do |active, name, host, guest|
|
26
|
+
puts host if argv.include?(guest.to_s)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
return 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-port/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-port"
|
8
|
+
spec.version = VagrantPort::VERSION
|
9
|
+
spec.authors = ["Jordan Sissel"]
|
10
|
+
spec.email = ["jls@semicomplete.com"]
|
11
|
+
spec.description = 'vagrant forwarded-port querying plugin'
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-port
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: vagrant forwarded-port querying plugin
|
15
15
|
email:
|
@@ -17,7 +17,12 @@ email:
|
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
|
-
files:
|
20
|
+
files:
|
21
|
+
- lib/vagrant-port.rb
|
22
|
+
- lib/vagrant-port/command.rb
|
23
|
+
- lib/vagrant-port/plugin.rb
|
24
|
+
- lib/vagrant-port/version.rb
|
25
|
+
- vagrant-port.gemspec
|
21
26
|
homepage: ''
|
22
27
|
licenses:
|
23
28
|
- MIT
|
@@ -39,8 +44,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
44
|
version: '0'
|
40
45
|
requirements: []
|
41
46
|
rubyforge_project:
|
42
|
-
rubygems_version: 1.8.
|
47
|
+
rubygems_version: 1.8.24
|
43
48
|
signing_key:
|
44
49
|
specification_version: 3
|
45
50
|
summary: vagrant forwarded-port querying plugin
|
46
51
|
test_files: []
|
52
|
+
has_rdoc:
|