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.
@@ -0,0 +1,6 @@
1
+ # This file is required because Vagrant's plugin system expects
2
+ # a eponymous ruby file matching the rubygem.
3
+ #
4
+ # So this gem is called 'vagrant-port' and thus vagrant tries
5
+ # to require "vagrant-port"
6
+ require "vagrant-port/port"
@@ -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,10 @@
1
+ module VagrantPort
2
+ class Plugin < Vagrant.plugin("2")
3
+ name "Query forwarded ports for guests."
4
+
5
+ command "port" do
6
+ require_relative "command"
7
+ next VagrantPort::Command
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module VagrantPort
2
+ VERSION = "0.0.2"
3
+ 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.1
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-18 00:00:00.000000000 Z
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.25
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: