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

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 关于在运行guard init时不使用bundler的警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的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,它将使用全局安装的护栏.要运行通过Gemfile安装的那个,请使用bundle exec guard init rspec.这也是 the documentation推荐的.

来自README:

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

所以最好认真对待这个警告,以避免问题.

猜你在找的Ruby相关文章