vagrant-notify 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f220061039ad0bc6f804c6561f05ae7c8bed22c1
4
- data.tar.gz: 5d602de0a1ad6a73f2de0276971c3851cd98661e
3
+ metadata.gz: 1cc808b0736ce22d4855eafd7f920afa8d97834b
4
+ data.tar.gz: 51a1e2b03a29dac79356b8169a13ae7ee0f28bae
5
5
  SHA512:
6
- metadata.gz: eefc2a70255f14d573238f69e78d097e143e4b401653255cf2e0ae1f848f4b0ae8df6e265deb82fbe1c083819d54f55b4be271aa91aa8dcaeeae91a9fd2d488e
7
- data.tar.gz: 211c6257ee813b170a21ab18a05c5bcf0505e331dc8cac93041923036dac5f338b8124bd7e220af0e9d4b114e783f826e039b6bad4b73b691b4e3566dfcf5f3f
6
+ metadata.gz: 727b9a5fbe52de21b671fa23acec9a767f17b935daeb8f6bee6753ce0713bfee81a94f7d59840e6abdf05d8d7562b5cc4d606104bc87cb927ffe8262cf8ff031
7
+ data.tar.gz: 3cdcf5e597f15b9e4502b5cba71eccde7accff59322963af74129e19e5a87cc0ec03af66f8b507544287a294bd66cb366ad0135c2eef83692b3debf94c160265
@@ -1,3 +1,9 @@
1
+ ## [0.5.4](https://github.com/fgrehm/vagrant-notify/compare/v0.5.3...v0.5.4) (May 4, 2017)
2
+ IMPROVEMENTS
3
+
4
+ - Display warning if Ruby is not installed on guest. [[GH-35]](https://github.com/fgrehm/vagrant-notify/issues/35)
5
+ - Shell name included in provision notify message. [[GH-21]](https://github.com/fgrehm/vagrant-notify/issues/21)
6
+
1
7
  ## [0.5.3](https://github.com/fgrehm/vagrant-notify/compare/v0.5.2...v0.5.3) (November 18, 2016)
2
8
  IMPROVEMENTS
3
9
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2016 Fabio Rehm
1
+ Copyright (c) 2012-2017 Fabio Rehm
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -21,7 +21,7 @@ $ vagrant plugin install vagrant-notify
21
21
  ### `notify-send` from guest VMs
22
22
 
23
23
  Whenever you run `vagrant up`, a Ruby [TCPServer](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/TCPServer.html)
24
- will fire up on a port within the [usable port range](https://github.com/mitchellh/vagrant/blob/master/config/default.rb#L14)
24
+ will fire up on a port within the [usable port range](https://www.vagrantup.com/docs/vagrantfile/machine_settings.html)
25
25
  and a Ruby [script](https://github.com/fgrehm/vagrant-notify/blob/master/files/notify-send.erb)
26
26
  will be copied over to the guest machine to replace the original `notify-send`
27
27
  command.
@@ -11,6 +11,7 @@ module Vagrant
11
11
 
12
12
  path = compile_command(env, 'notify-send.erb')
13
13
  install_command_on_guest(env, path)
14
+ check_if_ruby_on_guest(env)
14
15
 
15
16
  @app.call env
16
17
  end
@@ -37,6 +38,14 @@ module Vagrant
37
38
  env[:machine].communicate.sudo("sed 's/\r\$//' -i /usr/bin/notify-send") # dos2unix
38
39
  end
39
40
  end
41
+
42
+ def check_if_ruby_on_guest(env)
43
+ ruby_check = ''
44
+ env[:machine].communicate.sudo("which ruby || true") {|type, data| ruby_check = data }
45
+ if ruby_check.empty?
46
+ env[:machine].ui.warn("Ruby is not installed on '#{env[:machine].name}' guest VM! vagrant-notify will not work until a version of Ruby is installed.")
47
+ end
48
+ end
40
49
  end
41
50
  end
42
51
  end
@@ -7,8 +7,8 @@ module Vagrant
7
7
  end
8
8
 
9
9
  def call(env)
10
-
11
- system("notify-send '[#{env[:machine].name}] Provisioning with \"#{env[:provisioner_name]}\"...'") unless env[:machine].config.notify.enable == false
10
+ message = notify_provision_messages(env) unless env[:machine].config.notify.enable == false
11
+ system(message[:start]) unless env[:machine].config.notify.enable == false
12
12
 
13
13
  begin
14
14
  @app.call(env)
@@ -16,9 +16,20 @@ module Vagrant
16
16
  system("notify-send '[#{env[:machine].name}] \"#{env[:provisioner_name]}\" provision failed!'") unless env[:machine].config.notify.enable == false
17
17
  env[:machine].ui.error("#{msg}")
18
18
  else
19
- system("notify-send '[#{env[:machine].name}] Finished provisioning with \"#{env[:provisioner_name]}\"'") unless env[:machine].config.notify.enable == false
19
+ system(message[:end]) unless env[:machine].config.notify.enable == false
20
20
  end
21
+ end
21
22
 
23
+ def notify_provision_messages(env)
24
+ message = Hash.new
25
+ if env[:provisioner_name].to_s == 'shell' and env[:provisioner].config.name
26
+ message[:start] = "notify-send '[#{env[:machine].name}] Provisioning with \"#{env[:provisioner_name]} (#{env[:provisioner].config.name})\"...'"
27
+ message[:end] = "notify-send '[#{env[:machine].name}] Finished provisioning with \"#{env[:provisioner_name]} (#{env[:provisioner].config.name})\"'"
28
+ else
29
+ message[:start] = "notify-send '[#{env[:machine].name}] Provisioning with \"#{env[:provisioner_name]}\"...'"
30
+ message[:end] = "notify-send '[#{env[:machine].name}] Finished provisioning with \"#{env[:provisioner_name]}\"'"
31
+ end
32
+ return message
22
33
  end
23
34
  end
24
35
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Notify
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -8,7 +8,9 @@ describe Vagrant::Notify::Action::InstallCommand do
8
8
  let(:config) { mock(notify: stub(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(:machine) { mock(communicate: communicator, config: config, provider_name: provider_name) }
11
+ let(:ui) { mock(warn: true)}
12
+ let(:name) { 'test-vm' }
13
+ let(:machine) { mock(communicate: communicator, config: config, provider_name: provider_name, ui: ui, name: name) }
12
14
  let(:communicator) { mock(upload: true, sudo: true) }
13
15
  let(:host_ip) { '192.168.1.2' }
14
16
  let(:provider_name) { 'virtualbox' }
@@ -42,4 +44,8 @@ describe Vagrant::Notify::Action::InstallCommand do
42
44
  it 'installs command for all users' do
43
45
  communicator.should have_received(:sudo).with("mv #{guest_tmp_path} #{guest_path} && chmod +x #{guest_path}")
44
46
  end
47
+
48
+ it 'verify if ruby is installed on guest' do
49
+ communicator.should have_received(:sudo).with("which ruby || true")
50
+ end
45
51
  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.5.3
4
+ version: 0.5.4
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: 2016-11-19 00:00:00.000000000 Z
12
+ date: 2017-05-04 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