vagrant-serial 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,11 @@
1
1
 
2
2
  require "vagrant"
3
3
  require "vagrant-serial/version"
4
- require "vagrant-serial/middleware/configure"
5
- require "vagrant-serial/middleware/forward"
4
+ require "vagrant-serial/middleware/configure_ports"
5
+ require "vagrant-serial/middleware/forward_ports"
6
+ require "vagrant-serial/middleware/clear_forwarded_ports"
6
7
 
7
- Vagrant.actions[:start].insert_after Vagrant::Action::VM::Customize, Vagrant::Serial::Middleware::Configure
8
- Vagrant.actions[:start].insert_after Vagrant::Action::VM::Boot, Vagrant::Serial::Middleware::Forward
8
+ Vagrant.actions[:start].insert_after Vagrant::Action::VM::Customize, Vagrant::Serial::Middleware::ConfigurePorts
9
+ Vagrant.actions[:start].insert_after Vagrant::Action::VM::Boot, Vagrant::Serial::Middleware::ForwardPorts
10
+ Vagrant.actions[:halt].insert_after Vagrant::Action::VM::CheckAccessible, Vagrant::Serial::Middleware::ClearForwardedPorts
11
+ Vagrant.actions[:suspend].insert_after Vagrant::Action::VM::CheckAccessible, Vagrant::Serial::Middleware::ClearForwardedPorts
@@ -0,0 +1,17 @@
1
+ module Vagrant
2
+ module Serial
3
+ module Middleware
4
+ class ClearForwardedPorts
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ `/sbin/start-stop-daemon --stop --quiet --pidfile #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com1.pid`
11
+ `/sbin/start-stop-daemon --stop --quiet --pidfile #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com2.pid --exec /usr/bin/socat && rm #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com2.pid`
12
+ @app.call(env)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,7 +1,7 @@
1
1
  module Vagrant
2
2
  module Serial
3
3
  module Middleware
4
- class Configure
4
+ class ConfigurePorts
5
5
  def initialize(app, env)
6
6
  @app = app
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Vagrant
2
2
  module Serial
3
3
  module Middleware
4
- class Forward
4
+ class ForwardPorts
5
5
  def initialize(app, env)
6
6
  @app = app
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Serial
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-serial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -24,8 +24,9 @@ files:
24
24
  - README.md
25
25
  - Rakefile
26
26
  - lib/vagrant-serial.rb
27
- - lib/vagrant-serial/middleware/configure.rb
28
- - lib/vagrant-serial/middleware/forward.rb
27
+ - lib/vagrant-serial/middleware/clear_forwarded_ports
28
+ - lib/vagrant-serial/middleware/configure_ports.rb
29
+ - lib/vagrant-serial/middleware/forward_ports.rb
29
30
  - lib/vagrant-serial/version.rb
30
31
  - lib/vagrant_init.rb
31
32
  - vagrant-serial.gemspec