【问题标题】:Trouble with Guard init commandGuard init 命令的问题
【发布时间】:2015-01-23 05:54:19
【问题描述】:

我正在尝试使用this 教程设置Guard,但是当我运行bundle exec guard initbundle exec guard init rspec

我在 OSX 上,运行 RVM 1.14.1 和 Rails 3.2.5。

我收到以下错误:

[myapplication]$ bundle exec guard init rspec
/Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/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/ruby-1.9.2-p290@myapplication/gems/thor-0.15.2/lib/thor/task.rb:27:in `run'
    from /Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/gems/thor-0.15.2/lib/thor/invocation.rb:120:in `invoke_task'
    from /Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/gems/thor-0.15.2/lib/thor.rb:275:in `dispatch'
    from /Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/gems/thor-0.15.2/lib/thor/base.rb:408:in `start'
    from /Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/gems/guard-1.1.0/bin/guard:6:in `<top (required)>'
    from /Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/bin/guard:19:in `load'
    from /Users/ash/.rvm/gems/ruby-1.9.2-p290@myapplication/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'

【问题讨论】:

    标签: ruby-on-rails-3 guard


    【解决方案1】:

    我刚刚在 Ubuntu Server 11.10 中遇到了同样的问题。就我而言,宝石的版本存在一些问题。我将 Gemfile 中的保护 gem 版本从 1.1.0 更改为 0.10.0 并且它有效。这是我的 Gemfile:

    source 'https://rubygems.org'
    
    gem 'rails', '3.2.3'
    gem 'pg', '0.12.2'
    
    group :development, :test do
      #gem 'sqlite3', '1.3.5'
      gem 'pg', '0.12.2'
      gem 'guard','0.10.0'
      gem 'rspec-rails', '2.9.0'
      gem 'guard-rspec', '0.5.5'
      gem 'guard-bundler'
    
    end
    
    # Gems used only for assets and not required
    # in production environments by default.
    group :assets do
      gem 'sass-rails',   '3.2.4'
      gem 'coffee-rails', '3.2.2'
      gem 'uglifier', '1.2.3'
    end
    
    gem 'jquery-rails', '2.0.0'
    
    group :test do
      gem 'capybara', '1.1.2'
      gem 'rb-inotify', '0.8.8'
      gem 'libnotify', '0.5.9'
    end
    
    group :production do
      gem 'pg', '0.12.2'
    end
    

    【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-16
      • 2011-02-21
      • 1970-01-01
      • 1970-01-01
      • 2018-08-05
      • 2020-07-23
      • 2013-12-17
      • 2021-04-27
      相关资源
      最近更新 更多