在我的 Rails 应用程序中运行 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
我不明白为什么要显示它。可以忽略此警告吗?
这是我的 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'
最佳答案
如果您运行 guard init rspec
,它将使用全局安装的 guard-rails
。要运行通过 Gemfile 安装的程序,请使用 bundle exec guard init rspec
。这也是the documentation中推荐的。 .
自述文件:
It's important that you always run Guard through Bundler to avoid errors.
因此,最好认真对待此警告,以避免后续出现问题。
关于ruby-on-rails - 关于运行 guard init 时不使用 bundler 的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33052593/