vagrant-notify 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ before_script:
3
+ - sudo apt-get install virtualbox
4
+ rvm:
5
+ - 1.9.3
6
+ - 1.8.7
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-notify.gemspec
4
+ gemspec
5
+
6
+ gem 'rb-inotify'
7
+ gem 'guard'
8
+ gem 'guard-rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,60 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vagrant-notify (0.0.1)
5
+ vagrant
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ archive-tar-minitar (0.5.2)
11
+ childprocess (0.3.6)
12
+ ffi (~> 1.0, >= 1.0.6)
13
+ diff-lcs (1.1.3)
14
+ erubis (2.7.0)
15
+ ffi (1.1.5)
16
+ guard (1.4.0)
17
+ listen (>= 0.4.2)
18
+ thor (>= 0.14.6)
19
+ guard-rspec (2.1.0)
20
+ guard (>= 1.1)
21
+ rspec (~> 2.11)
22
+ i18n (0.6.1)
23
+ json (1.5.4)
24
+ listen (0.5.3)
25
+ log4r (1.1.10)
26
+ net-scp (1.0.4)
27
+ net-ssh (>= 1.99.1)
28
+ net-ssh (2.2.2)
29
+ rake (0.9.2.2)
30
+ rb-inotify (0.8.8)
31
+ ffi (>= 0.5.0)
32
+ rspec (2.11.0)
33
+ rspec-core (~> 2.11.0)
34
+ rspec-expectations (~> 2.11.0)
35
+ rspec-mocks (~> 2.11.0)
36
+ rspec-core (2.11.1)
37
+ rspec-expectations (2.11.3)
38
+ diff-lcs (~> 1.1.3)
39
+ rspec-mocks (2.11.3)
40
+ thor (0.16.0)
41
+ vagrant (1.0.5)
42
+ archive-tar-minitar (= 0.5.2)
43
+ childprocess (~> 0.3.1)
44
+ erubis (~> 2.7.0)
45
+ i18n (~> 0.6.0)
46
+ json (~> 1.5.1)
47
+ log4r (~> 1.1.9)
48
+ net-scp (~> 1.0.4)
49
+ net-ssh (~> 2.2.2)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ guard
56
+ guard-rspec
57
+ rake
58
+ rb-inotify
59
+ rspec
60
+ vagrant-notify!
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/vagrant-notify/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Fabio Rehm
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Vagrant::Notify
2
+
3
+ [![Build Status](https://travis-ci.org/fgrehm/vagrant-notify.png)](https://travis-ci.org/fgrehm/vagrant-notify)
4
+
5
+ A Vagrant plugin that forwards `notify-send` from guest to host machine, tested
6
+ using Ubuntu as guest and host machine.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'vagrant-notify'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install vagrant-notify
21
+
22
+ ## Usage
23
+
24
+ After installing the gem, whenever you run `vagrant up`, a Ruby
25
+ [TCPServer](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/TCPServer.html)
26
+ will fire up on `8081` port and a [script](https://github.com/fgrehm/vagrant-notify/blob/master/files/notify-send.erb)
27
+ will be installed on the guest machine to replace the original `notify-send`
28
+ command.
29
+
30
+ If by any change your IP changes, you can run `vagrant provision` in order to
31
+ update the guest script with the new IP.
32
+
33
+ In case you need to run the notification server on a different port, you can set
34
+ it from your `Vagrantfile`:
35
+
36
+ ```ruby
37
+ Vagrant::Notify::server_port = 8888
38
+ ```
39
+
40
+ ## TODO
41
+
42
+ * Display guest machine icons
43
+ * Support for Multi-VM environments
44
+ * Notify provisioning status
45
+ * Support for Mac OS
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.pattern = "spec/**/*_spec.rb"
6
+ end
7
+
8
+ desc 'Outpus some information about Vagrant middleware stack useful for development (use ACTION=action_name to filter out actions)'
9
+ task 'vagrant-stack' do
10
+ require 'vagrant'
11
+ Vagrant.actions.to_hash.each do |action, stack|
12
+ next unless !ENV['ACTION'] || ENV['ACTION'] == action.to_s
13
+
14
+ puts action
15
+ stack.send(:stack).each do |middleware|
16
+ puts " #{middleware[0]}"
17
+ puts " -> #{middleware[1].inspect}" unless middleware[1].empty?
18
+ end
19
+ end
20
+ end
21
+
22
+ task :default => :spec
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+ # vi: set ft=ruby :
4
+
5
+ # This is the wrapper around Ubuntu's notify-send that connects to the host machine
6
+ # when sending notifications
7
+
8
+ require 'rubygems'
9
+ require 'socket'
10
+ require 'optparse'
11
+
12
+ options = {}
13
+ OptionParser.new do |opts|
14
+ opts.banner = "Usage: example.rb [options]"
15
+
16
+ opts.on('-u', '--urgency LEVEL') { |v| options[:u] = v }
17
+ opts.on('-t', '--expire-time TIME') { |v| options[:t] = v }
18
+ opts.on('-a', '--app-name APP_NAME') { |v| options[:a] = v }
19
+ opts.on('-i', '--icon ICON[,ICON...]') { |v| options[:i] = v }
20
+ opts.on('-c', '--category TYPE[,TYPE...]') { |v| options[:c] = v }
21
+ opts.on('-h', '--hint TYPE:NAME:VALUE') { |v| options[:h] = v }
22
+ opts.on('-v', '--version') { |v| options[:v] = v }
23
+
24
+ end.parse!
25
+
26
+ cmd = options.map do |key, value|
27
+ "-#{key} '#{value}'"
28
+ end.join(' ')
29
+
30
+ # TODO: Need to escape values
31
+ unless ARGV.empty?
32
+ cmd << ' -- '
33
+ cmd << ARGV.map{|a| "'#{a}'"}.join(' ')
34
+ end
35
+
36
+ TCPSocket.open "<%= host_ip %>", <%= host_port %> do |s|
37
+ s.send cmd, 0
38
+ end
@@ -0,0 +1,32 @@
1
+ require 'vagrant'
2
+ require 'socket'
3
+ require 'erb'
4
+ require 'ostruct'
5
+
6
+ require 'vagrant-notify/middleware'
7
+ require 'vagrant-notify/server'
8
+ require "vagrant-notify/version"
9
+
10
+ module Vagrant
11
+ module Notify
12
+ class << self
13
+ def server_port
14
+ @@server_port ||= 8081
15
+ end
16
+ def server_port=(server_port)
17
+ @@server_port = server_port
18
+ end
19
+
20
+ def files_path
21
+ @file_path ||= File.expand_path(File.dirname(__FILE__) + '/../files')
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ Vagrant.actions[:start].tap do |start|
28
+ start.use Vagrant::Notify::Middleware::StartServer
29
+ start.insert_after Vagrant::Action::VM::Boot, Vagrant::Notify::Middleware::InstallCommand
30
+ end
31
+ Vagrant.actions[:halt].use Vagrant::Notify::Middleware::StopServer
32
+ Vagrant.actions[:provision].use Vagrant::Notify::Middleware::InstallCommand
@@ -0,0 +1,3 @@
1
+ Dir[File.dirname(__FILE__) + '/middleware/**/*.rb'].each do |file|
2
+ require file
3
+ end
@@ -0,0 +1,43 @@
1
+ module Vagrant
2
+ module Notify
3
+ module Middleware
4
+ class InstallCommand
5
+ def initialize(app, env)
6
+ @app = app
7
+ @command_template_file = Vagrant::Notify.files_path + '/notify-send.erb'
8
+ end
9
+
10
+ def call(env)
11
+ env[:ui].info('Compiling and installing notify-send script on guest machine')
12
+ path = compile_command(env)
13
+ install_command_on_guest(env, path)
14
+ @app.call(env)
15
+ end
16
+
17
+ def host_ip(env)
18
+ ip = nil
19
+ env[:vm].channel.execute('echo -n $SSH_CLIENT | cut -d" " -f1') do |buffer, data|
20
+ ip = data.chomp if buffer == :stdout
21
+ end
22
+ ip
23
+ end
24
+
25
+ private
26
+
27
+ def compile_command(env)
28
+ host_port = Vagrant::Notify::server_port
29
+ template_binding = OpenStruct.new(:host_ip => host_ip(env), :host_port => host_port)
30
+ command = ERB.new(File.read(@command_template_file)).result(template_binding.instance_eval { binding })
31
+ File.open(env[:vm].env.tmp_path + 'vagrant-notify-send', 'w') { |f| f.write(command) }
32
+ end
33
+
34
+ def install_command_on_guest(env, command_path)
35
+ # DISCUSS: Should we back up the original command if present?
36
+ source = env[:vm].env.tmp_path + 'vagrant-notify-send'
37
+ env[:vm].channel.upload(source.to_s, '/tmp/notify-send')
38
+ env[:vm].channel.sudo('mv /tmp/notify-send /usr/bin/notify-send && chmod +x /usr/bin/notify-send')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,48 @@
1
+ module Vagrant
2
+ module Notify
3
+ module Middleware
4
+ class StartServer
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ if pid = server_is_running?(env)
11
+ env[:ui].info "Notification server is already running (#{pid})"
12
+ else
13
+ pid = run_server(env)
14
+ env[:ui].info "Notification server fired up (#{pid})"
15
+ end
16
+
17
+ @app.call(env)
18
+ end
19
+
20
+ private
21
+
22
+ def run_server(env)
23
+ pid = Server.run
24
+
25
+ local_data = env[:vm].env.local_data
26
+ local_data['vagrant-notify'] ||= Vagrant::Util::HashWithIndifferentAccess.new
27
+ local_data['vagrant-notify']['pid'] = pid
28
+ local_data.commit
29
+
30
+ pid
31
+ end
32
+
33
+ # REFACTOR: This is duplicated on Middleware::StopServer
34
+ def server_is_running?(env)
35
+ begin
36
+ pid = env[:vm].env.local_data.fetch('vagrant-notify', {}).fetch('pid', nil)
37
+ return false unless pid
38
+
39
+ Process.getpgid(pid)
40
+ pid
41
+ rescue Errno::ESRCH
42
+ false
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,49 @@
1
+ module Vagrant
2
+ module Notify
3
+ module Middleware
4
+ class StopServer
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ # TODO: Need to handle multi VMs setup
11
+
12
+ if pid = server_is_running?(env)
13
+ env[:ui].info('Stopping notification server...')
14
+ stop_server(pid)
15
+ cleanup_local_data(env)
16
+ end
17
+
18
+ @app.call(env)
19
+ end
20
+
21
+ private
22
+
23
+ def stop_server(pid)
24
+ Process.kill('KILL', pid.to_i) rescue nil
25
+ end
26
+
27
+ def cleanup_local_data(env)
28
+ local_data = env[:vm].env.local_data
29
+ local_data['vagrant-notify'] ||= Vagrant::Util::HashWithIndifferentAccess.new
30
+ local_data['vagrant-notify'].delete('pid')
31
+ local_data.commit
32
+ end
33
+
34
+ # REFACTOR: This is duplicated on Middleware::StartServer
35
+ def server_is_running?(env)
36
+ begin
37
+ pid = env[:vm].env.local_data.fetch('vagrant-notify', {}).fetch('pid', nil)
38
+ return false unless pid
39
+
40
+ Process.getpgid(pid.to_i)
41
+ pid
42
+ rescue Errno::ESRCH
43
+ false
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,28 @@
1
+ module Vagrant
2
+ module Notify
3
+ class Server
4
+ def receive_data(client)
5
+ args = ''
6
+ while tmp = client.gets
7
+ args << tmp
8
+ end
9
+ client.close
10
+
11
+ system("notify-send #{args}")
12
+ end
13
+
14
+ def self.run
15
+ fork do
16
+ $0 = 'vagrant-notify-server'
17
+ tcp_server = TCPServer.open(Vagrant::Notify::server_port)
18
+ server = self.new
19
+ loop {
20
+ Thread.start(tcp_server.accept) do |client|
21
+ server.receive_data(client)
22
+ end
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Notify
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # This file is automatically loaded by Vagrant to load any
2
+ # plugins. This file kicks off this plugin.
3
+
4
+ require 'vagrant-notify'
@@ -0,0 +1,59 @@
1
+ describe Vagrant::Notify::Middleware::InstallCommand do
2
+ let(:start_stack) { Vagrant.actions[:start].send(:stack) }
3
+ let(:provision_stack) { Vagrant.actions[:provision].send(:stack) }
4
+ let(:host_ip) { 'host-ip' }
5
+ let(:host_port) { Vagrant::Notify::server_port }
6
+ let(:template) { ERB.new('<%= host_ip %> <%= host_port %>') }
7
+ let(:compiled_command_path) { @env[:vm].env.tmp_path + 'vagrant-notify-send' }
8
+ let(:target_tmp_path) { '/tmp/notify-send' }
9
+ let(:target_path) { '/usr/bin/notify-send' }
10
+ let(:channel) { mock(:channel, :sudo => true, :upload => true, :execute => true) }
11
+ let(:get_ip_command) { 'echo -n $SSH_CLIENT | cut -d" " -f1' }
12
+
13
+ subject { described_class.new(@app, @env) }
14
+
15
+ before do
16
+ @app, @env = action_env(vagrant_env.vms.values.first.env)
17
+ @env[:vm].stub(:channel => channel)
18
+ ERB.stub(:new => template)
19
+ end
20
+
21
+ it 'gets called after boot middleware when starting machine' do
22
+ boot_index = start_stack.index([Vagrant::Action::VM::Boot, [], nil])
23
+ middleware_index = start_stack.index([described_class, [], nil])
24
+
25
+ boot_index.should < middleware_index
26
+ end
27
+
28
+ it 'gets called when provisioning machine' do
29
+ provision_stack.should include([described_class, [], nil])
30
+ end
31
+
32
+ it "is able to identify host's ip" do
33
+ channel.should_receive(:execute).with(get_ip_command).and_yield(:stdout, host_ip + "\n")
34
+ subject.host_ip(@env).should == host_ip
35
+ end
36
+
37
+ it 'compiles command script passing host ip and server port' do
38
+ subject.stub(:host_ip => host_ip)
39
+ subject.call(@env)
40
+ File.read(compiled_command_path).should == "#{host_ip} #{host_port}"
41
+ end
42
+
43
+ it 'uploads compiled command script over to guest machine' do
44
+ channel.should_receive(:upload).with(compiled_command_path.to_s, target_tmp_path)
45
+ subject.stub(:host_ip => host_ip)
46
+ subject.call(@env)
47
+ end
48
+
49
+ it 'installs command for all users' do
50
+ channel.should_receive(:sudo).with("mv #{target_tmp_path} #{target_path} && chmod +x #{target_path}")
51
+ subject.stub(:host_ip => host_ip)
52
+ subject.call(@env)
53
+ end
54
+
55
+ it 'notifies user about script installation' do
56
+ @env[:ui].should_receive(:info).with('Compiling and installing notify-send script on guest machine')
57
+ subject.call(@env)
58
+ end
59
+ end
@@ -0,0 +1,69 @@
1
+ describe Vagrant::Notify::Middleware::StartServer do
2
+ let(:start_stack) { Vagrant.actions[:start].send(:stack) }
3
+ let(:server_pid) { 1234 }
4
+ let(:local_data) { Hash.new }
5
+
6
+ subject { described_class.new(@app, @env) }
7
+
8
+ before do
9
+ @app, @env = action_env(vagrant_env.vms.values.first.env)
10
+ @env[:vm].env.stub(:local_data => local_data)
11
+ local_data.stub(:commit)
12
+ Vagrant::Notify::Server.stub(:run => server_pid)
13
+ end
14
+
15
+ it 'gets called when starting machine' do
16
+ start_stack.should include([described_class, [], nil])
17
+ end
18
+
19
+ context 'server is down' do
20
+ before { Process.stub(:getpgid).and_raise(Errno::ESRCH) }
21
+
22
+ it 'fires up notification server when called' do
23
+ Vagrant::Notify::Server.should_receive(:run)
24
+ subject.call(@env)
25
+ end
26
+
27
+ it 'notifies user about server start' do
28
+ @env[:ui].should_receive(:info).with("Notification server fired up (#{server_pid})")
29
+ subject.call(@env)
30
+ end
31
+
32
+ it "persists server PID on local data" do
33
+ local_data.should_receive(:commit)
34
+ subject.call(@env)
35
+ local_data['vagrant-notify']['pid'].should == server_pid
36
+ end
37
+
38
+ context "and a PID is present on Vagrant's local data" do
39
+ let(:new_pid) { server_pid + 1 }
40
+
41
+ before do
42
+ Vagrant::Notify::Server.stub(:run => new_pid)
43
+ local_data['vagrant-notify'] = { 'pid' => server_pid }
44
+ end
45
+
46
+ it 'updates server PID' do
47
+ subject.call(@env)
48
+ local_data['vagrant-notify']['pid'].should == new_pid
49
+ end
50
+ end
51
+ end
52
+
53
+ context 'server is up' do
54
+ before do
55
+ Process.stub(:getpgid => true)
56
+ local_data['vagrant-notify'] = { 'pid' => server_pid }
57
+ end
58
+
59
+ it 'does not start a new server instance' do
60
+ Vagrant::Notify::Server.should_not_receive(:run)
61
+ subject.call(@env)
62
+ end
63
+
64
+ it 'notifies user that server is already running' do
65
+ @env[:ui].should_receive(:info).with("Notification server is already running (#{server_pid})")
66
+ subject.call(@env)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,49 @@
1
+ describe Vagrant::Notify::Middleware::StopServer do
2
+ let(:halt_stack) { Vagrant.actions[:halt].send(:stack) }
3
+ let(:server_pid) { '1234' }
4
+ let(:local_data) { { 'vagrant-notify' => { 'pid' => server_pid } } }
5
+
6
+ subject { described_class.new(@app, @env) }
7
+
8
+ before do
9
+ @app, @env = action_env(vagrant_env.vms.values.first.env)
10
+ @env[:vm].env.stub(:local_data => local_data)
11
+ local_data.stub(:commit)
12
+ end
13
+
14
+ it 'gets called when halting machine' do
15
+ halt_stack.should include([described_class, [], nil])
16
+ end
17
+
18
+ context 'server is down' do
19
+ before { Process.stub(:getpgid).and_raise(Errno::ESRCH) }
20
+
21
+ it 'does not notify user about server stop' do
22
+ @env[:ui].should_not_receive(:info)
23
+ subject.call(@env)
24
+ end
25
+ end
26
+
27
+ context 'server is up' do
28
+ before do
29
+ Process.stub(:getpgid => true)
30
+ local_data['vagrant-notify'] = { 'pid' => server_pid }
31
+ end
32
+
33
+ it 'notifies user that server is stopping' do
34
+ @env[:ui].should_receive(:info).with('Stopping notification server...')
35
+ subject.call(@env)
36
+ end
37
+
38
+ it 'kills notification server' do
39
+ Process.should_receive(:kill).with('KILL', server_pid.to_i)
40
+ subject.call(@env)
41
+ end
42
+
43
+ it "removes server PID on local data" do
44
+ local_data.should_receive(:commit)
45
+ subject.call(@env)
46
+ local_data['vagrant-notify']['pid'].should be_nil
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,18 @@
1
+ describe Vagrant::Notify::Server do
2
+ let(:arguments) { "-- '20 examples, 1 failure\n10 seconds'" }
3
+ let(:client) { StringIO.new(arguments) }
4
+
5
+ before do
6
+ subject.stub(:system => true)
7
+ end
8
+
9
+ it 'runs notify-send with received data from client' do
10
+ subject.should_receive(:system).with("notify-send #{arguments}")
11
+ subject.receive_data(client)
12
+ end
13
+
14
+ it 'closes connection after reading data' do
15
+ client.should_receive(:close)
16
+ subject.receive_data(client)
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ require 'vagrant-notify'
2
+
3
+ RSpec.configure do |config|
4
+ config.treat_symbols_as_metadata_keys_with_true_values = true
5
+ config.run_all_when_everything_filtered = true
6
+ config.filter_run :focus
7
+
8
+ # Run specs in random order to surface order dependencies. If you find an
9
+ # order dependency and want to debug it, you can fix the order by providing
10
+ # the seed, which is printed after each run.
11
+ # --seed 1234
12
+ config.order = 'random'
13
+
14
+ config.include Vagrant::TestHelpers
15
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-notify/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "vagrant-notify"
8
+ gem.version = Vagrant::Notify::VERSION
9
+ gem.authors = ["Fabio Rehm"]
10
+ gem.email = ["fgrehm@gmail.com"]
11
+ gem.description = 'A Vagrant plugin that redirects system notifications from guest to host machine.'
12
+ gem.summary = gem.description
13
+ gem.homepage = "https://github.com/fgrehm/vagrant-notify"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'vagrant'
21
+
22
+ gem.add_development_dependency 'rake'
23
+ gem.add_development_dependency 'rspec'
24
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-notify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fabio Rehm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: vagrant
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: A Vagrant plugin that redirects system notifications from guest to host
63
+ machine.
64
+ email:
65
+ - fgrehm@gmail.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - .rspec
72
+ - .travis.yml
73
+ - Gemfile
74
+ - Gemfile.lock
75
+ - Guardfile
76
+ - LICENSE.txt
77
+ - README.md
78
+ - Rakefile
79
+ - files/notify-send.erb
80
+ - lib/vagrant-notify.rb
81
+ - lib/vagrant-notify/middleware.rb
82
+ - lib/vagrant-notify/middleware/install_command.rb
83
+ - lib/vagrant-notify/middleware/start_server.rb
84
+ - lib/vagrant-notify/middleware/stop_server.rb
85
+ - lib/vagrant-notify/server.rb
86
+ - lib/vagrant-notify/version.rb
87
+ - lib/vagrant_init.rb
88
+ - spec/middleware/install_command_spec.rb
89
+ - spec/middleware/start_server_spec.rb
90
+ - spec/middleware/stop_server_spec.rb
91
+ - spec/server_spec.rb
92
+ - spec/spec_helper.rb
93
+ - vagrant-notify.gemspec
94
+ homepage: https://github.com/fgrehm/vagrant-notify
95
+ licenses: []
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ segments:
107
+ - 0
108
+ hash: -675474948593784751
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ segments:
116
+ - 0
117
+ hash: -675474948593784751
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 1.8.23
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: A Vagrant plugin that redirects system notifications from guest to host machine.
124
+ test_files:
125
+ - spec/middleware/install_command_spec.rb
126
+ - spec/middleware/start_server_spec.rb
127
+ - spec/middleware/stop_server_spec.rb
128
+ - spec/server_spec.rb
129
+ - spec/spec_helper.rb