vagrant-serial 0.0.17 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,34 +1,30 @@
1
1
  # Vagrant::Serial
2
2
 
3
- TODO: Write a gem description
3
+ Vagrant::Serial allows to configure serial ports forwarding with Vagrant.
4
+ Tested with vagrant version 1.0.5.
4
5
 
5
6
  ## Installation
6
7
 
7
- Add this line to your application's Gemfile:
8
+ $ vagrant gem install vagrant-serial
8
9
 
9
- gem 'vagrant-serial'
10
+ ## Configuration
10
11
 
11
- And then execute:
12
+ There is an restriction in VertualBox that you can use only 2 serial ports.
13
+ So the basic `Vagrantfile` would look like this:
12
14
 
13
- $ bundle
15
+ ```ruby
16
+ Vagrant::Config.run do |config|
17
+ # Map COM1 port in virtual machine to 1024 port on the host
18
+ config.serial.forward_com1 = 1024
14
19
 
15
- Or install it yourself as:
20
+ # Map COM2 port in virtual machine to 1025 port on the host
21
+ config.serial.forward_com2 = 1025
16
22
 
17
- $ gem install vagrant-serial
23
+ # Default: ~/.vagrant.d/serial
24
+ # Override sockets path
25
+ # config.serial.sockets_path = "/path/to/sockets/dir"
26
+ end
27
+ ```
18
28
 
19
- ## To Do
20
-
21
- 1. Good readme file
22
- 2. Add logging
23
-
24
- ## Usage
25
-
26
- TODO: Write usage instructions here
27
-
28
- ## Contributing
29
-
30
- 1. Fork it
31
- 2. Create your feature branch (`git checkout -b my-new-feature`)
32
- 3. Commit your changes (`git commit -am 'Added some feature'`)
33
- 4. Push to the branch (`git push origin my-new-feature`)
34
- 5. Create new Pull Request
29
+ ## Copyright
30
+ Copyright (c) 2012 Anton Mironov and 7 Pikes, Inc.
@@ -6,7 +6,8 @@ module Vagrant
6
6
  attr_accessor :sockets_path
7
7
 
8
8
  def sockets_path
9
- @sockets_path.nil? ? (@sockets_path = "#{File.expand_path(Vagrant::Environment::DEFAULT_HOME)}/serial") : @sockets_path
9
+ @sockets_path.nil? ? (@sockets_path = "#{Vagrant::Environment::DEFAULT_HOME}/serial") : @sockets_path
10
+ File.expand_path(@sockets_path)
10
11
  end
11
12
 
12
13
  def set?
@@ -10,6 +10,7 @@ module Vagrant
10
10
  if env[:vm].config.serial.set?
11
11
  FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
12
12
 
13
+ env[:ui].success "Stopping serial ports forwarding..."
13
14
  if env[:vm].config.serial.forward_com1
14
15
  `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid`
15
16
  end
@@ -12,10 +12,12 @@ module Vagrant
12
12
 
13
13
  if env[:vm].config.serial.forward_com1
14
14
  `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com1},reuseaddr,fork UNIX-CONNECT:#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1`
15
+ env[:ui].success "COM1 => #{env[:vm].config.serial.forward_com1}"
15
16
  end
16
17
 
17
18
  if env[:vm].config.serial.forward_com2
18
19
  `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com2},reuseaddr,fork UNIX-CONNECT:#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com2`
20
+ env[:ui].success "COM2 => #{env[:vm].config.serial.forward_com2}"
19
21
  end
20
22
  end
21
23
 
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Serial
3
- VERSION = "0.0.17"
3
+ VERSION = "1.0.0"
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.17
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: