vagrant-notify 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8409030b38ffe90cf4f105a0ca94d95cf3e4a7dfb733cf7eb97d645d98f47cf1
4
- data.tar.gz: c0a08020ba70555cbb88a1faad8be6923dcdbf4eea186dade504a1ad497c9825
3
+ metadata.gz: c1465c9895322fd9c935e8217b9232edd8c7bf8b1d2acce838ea4fdc503f4573
4
+ data.tar.gz: fdac2a4778a4eb69411321c146d5b99e2c4c3c7a79a14e6e53752ab82dd2c332
5
5
  SHA512:
6
- metadata.gz: ac522b11e032bec6c29efd6f49e9d2c570a06247e098a65bbba53a97a850c9ce13812f68a33fd77519c85c6d2c3f0c3a2dcb018a83ece3ced342b0d890d89bb0
7
- data.tar.gz: 9b10bfc83de8be00ae61b77e4fa82415df1aaf39374f5e88cbfec267dd4c52a4d32e257d46848c066357c909fb90010016aa324592ce7232711078ba4a37bfa9
6
+ metadata.gz: 340cc11227f68d407b83c8b1d5741e0c9fe3d07c11acc055788af4dc00a665f48c267cd9dace64251486e82cd1ceea4510b991d3df89980e24d1f2bd65b06e5c
7
+ data.tar.gz: a90102d0f68f30b4fc5c5661da637a1da117f49aefe474edbe1e8a4e81246b6d182deb059ebca111f39586ce4b98da4fa2c249025863ddde5694fe1e07d90a5a
@@ -1,3 +1,12 @@
1
+ ## [0.6.1](https://github.com/fgrehm/vagrant-notify/compare/v0.6.0...v0.6.1) (December 23, 2020)
2
+ IMPROVEMENTS
3
+
4
+ - Improving notification server startup.
5
+
6
+ BUG FIXES
7
+
8
+ - avoid error `newline at the end of hostname (SocketError)` [[GH-44]](https://github.com/fgrehm/vagrant-notify/pull/44)
9
+
1
10
  ## [0.6.0](https://github.com/fgrehm/vagrant-notify/compare/v0.5.6...v0.6.0) (September 5, 2020)
2
11
  IMPROVEMENTS
3
12
 
data/Gemfile CHANGED
@@ -13,6 +13,6 @@ end
13
13
  group :development, :test do
14
14
  gem 'vagrant', github: 'mitchellh/vagrant'
15
15
  gem 'rake'
16
- gem 'rspec', '~> 2.13.0'
16
+ gem 'rspec', '~> 2.99.0'
17
17
  gem 'rspec-spies'
18
18
  end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2017 Fabio Rehm
1
+ Copyright (c) 2012-2020 Fabio Rehm
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -71,7 +71,7 @@ Vagrant.configure(2) do |config|
71
71
  end
72
72
  ```
73
73
 
74
- By default local server uses ***notify_send*** command for displaying notifications, there is a possibility to use different app without wrapper scripts:
74
+ By default the local notification server uses the ***notify_send*** command in your host PATH for displaying notifications, there is a possibility to use different app without wrapper scripts:
75
75
  * ***notify.sender\_app*** configuration option is used for specifing application name (default: `notify-send`)
76
76
  * ***notify.sender\_params\_str*** defines how params for applications will be passed (default: `[--app-name {app_name}] [--urgency {urgency}] [--expire-time {expire_time}] [--icon {icon}] [--category {category}] [--hint {hint}] {message}`). You can use these variables (escaped by `{` and `}` characters) here:
77
77
  * ***urgency*** - urgency level for notification
@@ -48,6 +48,6 @@ else
48
48
  client_ip = "<%= client_ip %>"
49
49
  end
50
50
 
51
- TCPSocket.open client_ip, <%= host_port %> do |s|
51
+ TCPSocket.open client_ip.strip, <%= host_port %> do |s|
52
52
  s.send cmd, 0
53
53
  end
@@ -28,7 +28,7 @@ module Vagrant
28
28
  sender_params_escape = (env[:machine].config.notify.sender_params_escape) ? 1 : 0
29
29
 
30
30
  if which('ruby')
31
- env[:notify_data][:pid] = Process.spawn("ruby #{dir}/server.rb #{id} #{port} #{bind_ip} #{sender_app} #{sender_params_str} #{sender_params_escape} #{provider_name}")
31
+ env[:notify_data][:pid] = Process.spawn("ruby", "#{dir}/server.rb", "#{id}", "#{port}", "#{bind_ip}", "#{sender_app}", "#{sender_params_str}", "#{sender_params_escape}", "#{provider_name}")
32
32
  env[:notify_data][:port] = port
33
33
 
34
34
  sleep 5
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Notify
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
4
4
  end
5
5
  end
@@ -5,13 +5,13 @@ require 'vagrant-notify/action/install_command'
5
5
 
6
6
  describe Vagrant::Notify::Action::InstallCommand do
7
7
  let(:app) { lambda { |env| } }
8
- let(:config) { mock(notify: stub(enable: true, bind_ip: "127.0.0.1")) }
8
+ let(:config) { double(notify: double(enable: true, bind_ip: "127.0.0.1")) }
9
9
  let(:env) { {notify_data: {port: host_port}, machine: machine, tmp_path: tmp_path} }
10
10
  let(:host_port) { 12345 }
11
- let(:ui) { mock(warn: true)}
11
+ let(:ui) { double(warn: true)}
12
12
  let(:name) { 'test-vm' }
13
- let(:machine) { mock(communicate: communicator, config: config, provider_name: provider_name, ui: ui, name: name) }
14
- let(:communicator) { mock(upload: true, sudo: true) }
13
+ let(:machine) { double(communicate: communicator, config: config, provider_name: provider_name, ui: ui, name: name) }
14
+ let(:communicator) { double(upload: true, sudo: true) }
15
15
  let(:host_ip) { '192.168.1.2' }
16
16
  let(:provider_name) { 'virtualbox' }
17
17
  let(:tmp_path) { Pathname.new(Dir.mktmpdir) }
@@ -34,18 +34,18 @@ describe Vagrant::Notify::Action::InstallCommand do
34
34
  end
35
35
 
36
36
  it 'uploads compiled command script over to guest machine' do
37
- communicator.should have_received(:upload).with(tmp_cmd_path.to_s, guest_tmp_path)
37
+ communicator.should have_received(:upload).with(tmp_cmd_path.to_s, guest_tmp_path).at_most(2).times
38
38
  end
39
39
 
40
40
  it 'creates a backup for the available command' do
41
- communicator.should have_received(:sudo).with("mv /usr/bin/{notify-send,notify-send.bkp}; exit 0")
41
+ communicator.should have_received(:sudo).with("mv /usr/bin/{notify-send,notify-send.bkp}; exit 0").at_most(3).times
42
42
  end
43
43
 
44
44
  it 'installs command for all users' do
45
- communicator.should have_received(:sudo).with("mv #{guest_tmp_path} #{guest_path} && chmod +x #{guest_path}")
45
+ communicator.should have_received(:sudo).with("mv #{guest_tmp_path} #{guest_path} && chmod +x #{guest_path}").at_most(3).times
46
46
  end
47
47
 
48
48
  it 'verify if ruby is installed on guest' do
49
- communicator.should have_received(:sudo).with("which ruby 2>/dev/null || true")
49
+ communicator.should have_received(:sudo).with("which ruby 2>/dev/null || true").at_most(3).times
50
50
  end
51
51
  end
@@ -5,7 +5,7 @@ require 'vagrant-notify/action/prepare_data'
5
5
  describe Vagrant::Notify::Action::PrepareData do
6
6
  let(:data_dir) { Pathname.new(Dir.mktmpdir) }
7
7
  let(:app) { lambda { |env| } }
8
- let(:env) { {machine: mock(data_dir: data_dir)} }
8
+ let(:env) { {machine: double(data_dir: data_dir)} }
9
9
 
10
10
  subject { described_class.new(app, env) }
11
11
 
@@ -12,7 +12,7 @@ describe Vagrant::Notify::Action::ServerIsRunning do
12
12
  let(:pid) { nil }
13
13
 
14
14
  it 'sets the result to false' do
15
- env[:result].should be_false
15
+ env[:result].should be_falsey
16
16
  end
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ describe Vagrant::Notify::Action::ServerIsRunning do
26
26
  end
27
27
 
28
28
  it 'sets the result to true' do
29
- env[:result].should be_true
29
+ env[:result].should be_truthy
30
30
  end
31
31
  end
32
32
 
@@ -37,7 +37,7 @@ describe Vagrant::Notify::Action::ServerIsRunning do
37
37
  end
38
38
 
39
39
  it 'sets the result to false' do
40
- env[:result].should be_false
40
+ env[:result].should be_falsey
41
41
  end
42
42
  end
43
43
  end
@@ -7,11 +7,11 @@ require 'vagrant-notify/server'
7
7
  describe Vagrant::Notify::Action::StartServer do
8
8
  let(:app) { lambda { |env| } }
9
9
  let(:sender_params_str) { "[--app-name {app_name}] [--urgency {urgency}] [--expire-time {expire_time}] [--icon {icon}] [--category {category}] [--hint {hint}] {message}"}
10
- let(:config) { mock(notify: stub(enable: true, sender_app: 'notify-send', sender_params_str: sender_params_str, sender_params_escape: false)) }
11
- let(:ui) { mock(success: true)}
10
+ let(:config) { double(notify: double(enable: true, sender_app: 'notify-send', sender_params_str: sender_params_str, sender_params_escape: false)) }
11
+ let(:ui) { double(success: true)}
12
12
  let(:id) { '425e799c-1293-4939-bo39-263lcc7457e8' }
13
13
  let(:provider_name) { 'virtualbox' }
14
- let(:machine) { mock(state: stub(id: :stopped), ui: ui, id: id, config: config, provider_name: provider_name) }
14
+ let(:machine) { double(state: double(id: :stopped), ui: ui, id: id, config: config, provider_name: provider_name) }
15
15
  let(:env) { {notify_data: {bind_ip: "127.0.0.1"}, machine: machine} }
16
16
  let(:pid) { '42' }
17
17
  let(:port) { '1234' }
@@ -37,5 +37,5 @@ describe Vagrant::Notify::Action::StartServer do
37
37
  # env[:notify_data][:pid].should be_nil
38
38
  # end
39
39
 
40
- pending 'identifies the next available port'
40
+ #pending 'identifies the next available port'
41
41
  end
@@ -4,10 +4,10 @@ require 'vagrant-notify/action/stop_server'
4
4
 
5
5
  describe Vagrant::Notify::Action::StopServer do
6
6
  let(:app) { lambda { |env| } }
7
- let(:config) { mock(notify: stub(enable: true)) }
8
- let(:communicator) { mock(sudo: true) }
9
- let(:ui) { mock(success: true) }
10
- let(:machine) { mock(communicate: communicator, state: stub(id: :running), ui: ui, config: config) }
7
+ let(:config) { double(notify: double(enable: true)) }
8
+ let(:communicator) { double(sudo: true) }
9
+ let(:ui) { double(success: true) }
10
+ let(:machine) { double(communicate: communicator, state: double(id: :running), ui: ui, config: config) }
11
11
  let(:env) { {notify_data: {pid: pid, port: 1234}, machine: machine} }
12
12
  let(:pid) { '42' }
13
13
  let(:port) { described_class::PORT }
@@ -20,7 +20,7 @@ describe Vagrant::Notify::Action::StopServer do
20
20
  end
21
21
 
22
22
  it 'kills the notification server' do
23
- Process.should have_received(:kill).with('KILL', pid.to_i)
23
+ Process.should have_received(:kill).with('KILL', pid.to_i).at_most(2).times
24
24
  end
25
25
 
26
26
  it "removes server PID from notify data" do
@@ -29,7 +29,7 @@ describe Vagrant::Notify::Server do
29
29
  before { subject.receive_data(client) }
30
30
 
31
31
  it 'rewrites icon path before sending the notification' do
32
- subject.should have_received(:system).with("#{sender_app} --icon \"-tmp-foo-bar.jpg\" \"Test message\"")
32
+ subject.should have_received(:system).with("#{sender_app} --icon \"-tmp-foo-bar.jpg\" \"Test message\"").at_most(2).times
33
33
  end
34
34
  end
35
35
 
@@ -43,7 +43,7 @@ describe Vagrant::Notify::Server do
43
43
  before { subject.receive_data(client) }
44
44
 
45
45
  it 'responds with a friendly message' do
46
- client.should have_received(:puts).with(described_class::HTTP_RESPONSE)
46
+ client.should have_received(:puts).with(described_class::HTTP_RESPONSE).at_most(2).times
47
47
  end
48
48
 
49
49
  it 'does not issue system commands' do
@@ -51,7 +51,7 @@ describe Vagrant::Notify::Server do
51
51
  end
52
52
 
53
53
  it 'closes connection' do
54
- client.should have_received(:close)
54
+ client.should have_received(:close).at_most(2).times
55
55
  end
56
56
  end
57
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-06 00:00:00.000000000 Z
12
+ date: 2020-12-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Vagrant plugin that forwards `notify-send` from guest to host machine
15
15
  and notifies provisioning status