Abhilash Abhilash - 4 months ago 24
Ruby Question

Warning regarding not using bundler when running guard init

In my Rails app am getting this warning when running

guard init rspec
:

Warning: you have a Gemfile, but you're not using bundler or
RUBYGEMS_GEMDEPS
14:54:15 - INFO - Writing new Guardfile to
/home/ubuntu/railsprojects/sillyfish/Guardfile 14:54:16 - INFO - rspec
guard added to Guardfile, feel free to edit it


I don't understand why it's showing. Is it okay to ignore this warning?

Here is my Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.4'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
gem 'rspec-rails', '3.3.3'
gem 'guard-rspec', require: false
gem 'spring-commands-rspec'
gem 'byebug'
end

group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end

group :test do
gem 'capybara', '2.5.0'
end

#custom gems
gem 'puma'
gem 'bootstrap-sass', '~> 3.3.5'
gem 'devise', '~> 3.5.2'

Answer

If you run guard init rspec, it will use the globally installed guard-rails. To run the one installed through your Gemfile, use bundle exec guard init rspec. This is also what is recommended in the documentation.

From the README:

It's important that you always run Guard through Bundler to avoid errors.

So it's probably best to take this warning seriously, to avoid issues down the line.