ruby-on-rails - 关于运行 guard init 时不使用 bundler 的警告

标签 ruby-on-rails ruby rspec guard

在我的 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/

相关文章:

ruby-on-rails - 如何更改 asset_path 的外观?

ruby-on-rails - rspec .reload 不重新加载对象

ruby - 无法确定测试是否在 after hook 中失败

ruby-on-rails - 如何在 Travis CI 上获取 Docker 主机 IP?

ruby-on-rails - rails : Self joins

ruby-on-rails - Rails (Mongoid) 模型中的条件默认值

ruby-on-rails - 如何在 Rails 3.2 中找到 "SystemStackError (stack level too deep)"的来源

Ruby 哈希 - 使用在哈希中创建的元素创建元素

ruby - 使用rest-client ruby​​ gem在elasticsearch中传递json数据获取请求

ruby - 如何使用 rspec 删除特定文件?