fgrehm / vagrant-notify

Vagrant plugin that redirects `notify-send` from guest to host machine and notifies provisioning status.
MIT License
181 stars 12 forks source link

terminal-notifier is not part of the bundle. Add it to Gemfile. (Gem::LoadError) #19

Closed stuffaboutpete closed 8 years ago

stuffaboutpete commented 10 years ago

I'm getting the following error whilst trying to get this workflow set up.

/Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/rubygems_integration.rb:240:in `block in replace_gem': terminal-notifier is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /usr/bin/terminal-notifier:22:in `<main>'

All I've done is install the plugin vagrant plugin install vagrant-notify, created the following script at /usr/local/bin/notify-send (on OSX) and run vagrant up.

#!/bin/bash
terminal-notifier -title "Vagrant Machine" -message "$*"

The machine provisions without issue and then the error appears whenever notify-send is called on the virtual machine. In this case it's a 32bit Ubuntu 13.10 machine.

I can't get get my head around what the error is telling me; it seems like the host vagrant installation doesn't have access to a 'terminal-notifier' command. But I wouldn't know how to fix or get round that.

Any thoughts?

fgrehm commented 10 years ago

Weird.... I'm not a Mac user, so I can't help you much here =/

Why didn't you use grownotify as shown on the readme?

stuffaboutpete commented 10 years ago

Ok, no worries. I only used notification center because it's native and thought it would be simple; it is also mentioned in the readme.

I'll let you know if I get anywhere.

osrochabr commented 10 years ago

+1

fgrehm commented 10 years ago

Something just crossed my mind. Have you tried specifying the full path to the terminal-notifier executable on the /usr/local/bin/notify-send script? Maybe there's some Ruby / Bundler PATH black magic happening and it gets confused about which terminal-notifier it has to run.

osrochabr commented 10 years ago

@fgrehm Actually, i did it, and the error message remain the same. There's some black magic here. When i run /usr/local/bin/notify-send script directly on the host (OS X), this work fine.

stuffaboutpete commented 10 years ago

Yeah same for me, it doesn't make a difference. I've set Growl up now which was very simple :+1:

fgrehm commented 10 years ago

Awesome! I'm working on extracting the notification server out to a separate project and it is likely that it will fix those issues and might make the Mac / Windows integration a bit simpler

stuffaboutpete commented 10 years ago

Ok cool, I'll watch this space.

Cheers for the work, very useful.

maikelvl commented 10 years ago

Any updates on this? Also ran into this. Please share.

stuffaboutpete commented 10 years ago

I've just been using Growl. I'd recommend that route unless you have any specific reason not to...

maikelvl commented 10 years ago

I like native, but for now I use Growl as well. tnx

fgrehm commented 10 years ago

This is what is likely to become the foundation of vagrant-notify 1.0: https://github.com/fgrehm/notify-send-http

I don't own a mac so I'll need some help to try things out over there once I'm able to get a Mac version of the server in place.

stuffaboutpete commented 10 years ago

Sounds interesting. Happy to help, let me know what you need.

c960657 commented 10 years ago

Adding unset GEM_PATH RUBYOPT to your wrapper script in /usr/local/bin/notify-send fixes the issue. I don't know enough about Ruby to tell whether this is a fix or a workaround.

stuffaboutpete commented 10 years ago

Makes no difference for me unfortunately.

c960657 commented 10 years ago

There are a number of other Ruby-specific environment variables that leak into the script (BUNDLE_BIN_PATH, BUNDLE_APP_CONFIG, BUNDLE_CONFIG, RUBYLIB, BUNDLE_GEMFILE, GEMRC - and possibly others) that may also need to be unset.

stuffaboutpete commented 10 years ago

Excellent, it's now working for me. I had to unset GEM_PATH RUBYOPT and BUNDLE_GEMFILE.

Thank you!

fgrehm commented 9 years ago

Support for Mac OS has just landed into notify-send-http. This will be fixed when this plugin gets updated to use that.

richardriman commented 8 years ago

I have solution for terminal-notifier. I solved it this way:

#!/bin/bash
shift
/usr/local/bin/terminal-notifier -title "Vagrant Machine" -message "$*"

It's because notify-send sends '--' as a first argument and terminal-notifier not understand this syntax.

alpha01 commented 8 years ago

Closing. Use https://github.com/fgrehm/vagrant-notify/blob/master/examples/osx/notify-send_terminal-notifier