Codaisseur / terminal-notifier-guard

Mac OS X User Notifications for Guard
Other
163 stars 25 forks source link

Avoid gem in gemfile for Heroku or Travis CI #38

Closed moisesnandres closed 7 years ago

moisesnandres commented 7 years ago

Hi, I'm using the gem in my development group

group :development do
  gem 'quiet_assets'
  gem 'better_errors'
  gem 'binding_of_caller', :platforms => [:mri_19, :rbx]

  gem 'guard-rspec'
  gem 'guard-rubocop'
  gem 'pry-rails'
  gem 'spring'
  gem 'web-console', '~> 2.0'
  gem 'libnotify' if /linux/ =~ RUBY_PLATFORM
  gem 'terminal-notifier-guard', '~> 1.6.1' if /darwin/ =~ RUBY_PLATFORM
end

It works good but when I push to heroku this happen

remote:        Bundler Output: Warning: the running version of Bundler (1.13.7) is older than the version that created the lockfile (1.15.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote:        You are trying to install in deployment mode after changing
remote:        your Gemfile. Run `bundle install` elsewhere and add the
remote:        updated Gemfile.lock to version control.
remote:
remote:        You have added to the Gemfile:
remote:        * libnotify
remote:
remote:        You have deleted from the Gemfile:
remote:        * terminal-notifier-guard (~> 1.6.1)
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed

I also did bundle install to update the gemfile.lock Travis CI also throw a similar error.

Is there a way to ignore the gem in the gemfile.lock or use it without being in the gemfile?

mattbrictson commented 7 years ago

Try install_if as explained the Bundler docs:

install_if -> { RUBY_PLATFORM =~ /darwin/ } do
  gem "terminal-notifier-guard", "~> 1.6.1"
end
install_if -> { RUBY_PLATFORM =~ /linux/ } do
  gem "libnotify"
end

http://bundler.io/v1.15/man/gemfile.5.html#INSTALL_IF

moisesnandres commented 7 years ago

It works! Thank you!