vagrant-notify 0.6.0 → 0.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/files/notify-send.erb +1 -1
- data/lib/vagrant-notify/action/start_server.rb +1 -1
- data/lib/vagrant-notify/version.rb +1 -1
- data/spec/action/install_command_spec.rb +8 -8
- data/spec/action/prepare_data_spec.rb +1 -1
- data/spec/action/server_is_running_spec.rb +3 -3
- data/spec/action/start_server_spec.rb +4 -4
- data/spec/action/stop_server_spec.rb +5 -5
- data/spec/server_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1465c9895322fd9c935e8217b9232edd8c7bf8b1d2acce838ea4fdc503f4573
|
4
|
+
data.tar.gz: fdac2a4778a4eb69411321c146d5b99e2c4c3c7a79a14e6e53752ab82dd2c332
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 340cc11227f68d407b83c8b1d5741e0c9fe3d07c11acc055788af4dc00a665f48c267cd9dace64251486e82cd1ceea4510b991d3df89980e24d1f2bd65b06e5c
|
7
|
+
data.tar.gz: a90102d0f68f30b4fc5c5661da637a1da117f49aefe474edbe1e8a4e81246b6d182deb059ebca111f39586ce4b98da4fa2c249025863ddde5694fe1e07d90a5a
|
data/CHANGELOG.md
CHANGED
@@ -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
data/LICENSE.txt
CHANGED
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
|
data/files/notify-send.erb
CHANGED
@@ -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
|
@@ -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) {
|
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) {
|
11
|
+
let(:ui) { double(warn: true)}
|
12
12
|
let(:name) { 'test-vm' }
|
13
|
-
let(:machine) {
|
14
|
-
let(:communicator) {
|
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:
|
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
|
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
|
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
|
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) {
|
11
|
-
let(:ui) {
|
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) {
|
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) {
|
8
|
-
let(:communicator) {
|
9
|
-
let(:ui) {
|
10
|
-
let(:machine) {
|
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
|
data/spec/server_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|