我試圖建立Guard
使用this教程,但是當我運行bundle exec guard init
或bundle exec guard init rspec
故障與保護init命令
我在OSX,運行RVM 1.14.1和Rails 3.2.5。
我收到以下錯誤:
[myapplication]$ bundle exec guard init rspec
/Users/ash/.rvm/gems/[email protected]/gems/guard-1.1.0/lib/guard/cli.rb:145:in `init': undefined method `create_guardfile' for Guard:Module (NoMethodError)
from /Users/ash/.rvm/gems/[email protected]/gems/thor-0.15.2/lib/thor/task.rb:27:in `run'
from /Users/ash/.rvm/gems/[email protected]/gems/thor-0.15.2/lib/thor/invocation.rb:120:in `invoke_task'
from /Users/ash/.rvm/gems/[email protected]/gems/thor-0.15.2/lib/thor.rb:275:in `dispatch'
from /Users/ash/.rvm/gems/[email protected]/gems/thor-0.15.2/lib/thor/base.rb:408:in `start'
from /Users/ash/.rvm/gems/[email protected]/gems/guard-1.1.0/bin/guard:6:in `<top (required)>'
from /Users/ash/.rvm/gems/[email protected]/bin/guard:19:in `load'
from /Users/ash/.rvm/gems/[email protected]/bin/guard:19:in `<main>'
RSpec
運行良好:
[myapplication]$ bundle exec rspec
F
Failures:
1) StaticPages GET /static_pages works! (now write some real specs)
Failure/Error: get static_pages_index_path
NameError:
undefined local variable or method `static_pages_index_path' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fd6d176a020>
# ./spec/requests/static_pages_spec.rb:7:in `block (3 levels) in <top (required)>'
Finished in 0.00887 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:5 # StaticPages GET /static_pages works! (now write some real specs)
也是我的Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.5'
group :development, :test do
gem 'rspec-rails'
gem 'guard-rspec'
gem 'growl'
gem 'rb-fsevent'
gem 'spork-rails'
gem 'guard-spork'
end
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
你是對的降級修復它。顯然這是一個已知的問題 - https://github.com/guard/guard/issues/283#issuecomment-6078721。您可以降級到版本'1.0.3'來解決這個問題。 – Ash