So, there's an issue with cross-platform development.
Guard is happiest when it has something other than polling, of course, so the naïve Linuxer adds this to his Gemfile:
Then he makes his OS X coworker so sad when that won't install. The OS X
coworker then does:
And it sort of works, but then he ends up comitting a diff into Gemfile.lock
removing rb-inotify and adding rb-fsevent. Then the two play
tug-of-Gemfile.lock until one or the other ragequits the project.
I talked to @injekt, and he said it would be nice if Gemfile.locks had
platform-specific blocks, but there are issues with that (e.g. you can't
extend the grammar of Gemfile.lock without causing existing Bundlers to blow
I kicked around a few dumb ideas, but (thanks to @rf-) I think we've got a
non-dumb idea to propose:
Step 1: Create a generic polling gem that does the job of guards poll stuff plus a conditional, optional C piece for either libnotify or libfsevent.
Step 2: Depend on it, unconditionally.
Step 3: Figure out what the user experience should be if they're on Linux without libnotify, etc.
BTW my proposed name for this thing is either libfisneovteinfty or
libifnsoetviefnyt. Just (mostly) kidding.
We already have that discussion for the Listen gem: https://github.com/guard/listen/issues/search?q=dependencies
In your case the solution would be to required all dependencies without the RUBY_PLATFORM case:
It should work everywhere. (Listen was using this approach first).
Oh man, that's so simple.
I don't think I can climb out of the idiot hole on this one, but for what it's
worth, these don't say the gems work fine on other OS's:
(And, interestingly, the wdm gem does not behave in this mild-mannered manner).
Thanks for the solution, though!
(rb-fchange actually doesn't complain when you gem install it, but it does complain when you require it — but it's not mentioned on the guard README.md)
Ok, just add :require => false on your Gemfile. Listen will automatically require the good one.
:require => false
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
gem 'rb-fchange', :require => false
Looks good to me. Could this be added to the docs (or perhaps be made part of guard/listen)?
Yeah adding that in the Guard README is a good idea, can you submit a pull request please? Thanks.
Update for Gemfile solution. Addresses #340.
Note that I dropped the mention of the `wdm` gem. I don't see that it
does something better than `rb-fchange`, and it also fails loudly upon
attempted install onto Linux.