2013-06-03 6 views
0

Rails 튜토리얼 3.6 장을 통해 Rspec, Guard 및 Spork를 구현하려고합니다. 이 시점에서 모든 것이 제대로 작동하는 것 같지만 Guard가 시작될 때 EADDRINUSE 오류가 발생합니다. 내 환경은 Windows 8 x64, BiNami Rubystack 1.9.3-6, Ruby 1.9.3p392, Rails 3.2.13 및 RubyMine 5.4.2입니다. RubyMine이나 CLI에서도 같은 오류가 발생합니다.Ruby Guard는 다음을 수신합니다. 일반적으로 각 소켓 주소의 한 가지 용도 만 허용됩니다. Errno :: EADDRINUSE

나는 netstat를 사용하여 Guard가 시작되기 전에 그리고 Guard가 종료 된 후에 포트가 사용 중이 아닌지 확인했습니다. 그래서 가드가 유일한 요인 인 것 같습니다. 비슷한 문제를 조사하고 내가 찾은 문제와 일치하지 않는지 확인했습니다. 성공하지 못하면 문제를 격리하기 위해 환경을 최소화하려고 노력했습니다. 예를 들어, 과도한 보석을 없애고 버전 사양이없는 일반용으로 지정하려고했습니다. 내가 한 일은 아무런 차이를 만들지 못했습니다.

내 Gemfile :

source 'https://rubygems.org' 

gem 'rails', '3.2.13' 

group :development, :test do 
    gem 'rspec-rails', '2.13.2' 
    gem 'database_cleaner' 
    gem 'guard' 
    gem 'win32console' 
    gem 'growl' 
    gem 'ruby_gntp' 
    gem 'rb-notifu' 
    gem 'guard-rspec' 
    gem 'wdm' 
    gem 'guard-spork', '1.2.0' 
    gem 'childprocess', '0.3.6' 
    gem 'spork', '1.0.0rc3' 
    gem 'spork-rails' 
    gem 'cucumber' 
    gem 'cucumber-rails', :require => false 
end 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'mysql2' 


# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', :platforms => :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

내 Guardfile :

require 'active_support/core_ext' 

guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do 
    watch('config/application.rb') 
    watch('config/environment.rb') 
    watch(%r{^config/environments/.+\.rb$}) 
    watch(%r{^config/initializers/.+\.rb$}) 
    watch('Gemfile') 
    watch('Gemfile.lock') 
    watch('spec/spec_helper.rb') 
    watch('test/test_helper.rb') 
    watch('spec/support/') 
end 

오류 기록 :

D:\BitNami\rubystack-1.9.3-6\ruby\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/BitNami/rubystack-1.9.3-6/ruby/bin/bundle exec guard 
17:03:39 - INFO - Guard uses GNTP to send notifications. 
17:03:39 - INFO - Guard uses TerminalTitle to send notifications. 

17:03:40 - INFO - Starting Spork for RSpec, Cucumber 
Using RSpec, Rails 
Using Cucumber, Rails 
    -- Rinda Ring Server listening for connections... 

D:/BitNami/rubystack-1.9.3-6/ruby/lib/ruby/1.9.1/rinda/ring.rb:35:in `bind': Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2) (Errno::EADDRINUSE) 
    from D:/BitNami/rubystack-1.9.3-6/ruby/lib/ruby/1.9.1/rinda/ring.rb:35:in `initialize' 
    from ring_server.rb:7:in `new' 
    from ring_server.rb:7:in `<main>' 
    -- Starting to fill pool... 
    Wait until at least one slave is provided before running tests... 
    ** CTRL+BREAK to stop Spork and kill all ruby slave processes ** 
    -- Starting to fill pool... 
    Wait until at least one slave is provided before running tests... 
    ** CTRL+BREAK to stop Spork and kill all ruby slave processes ** 
Spork is ready and listening on 8989! 
Spork is ready and listening on 8990! 
    -- build slave 1... 
    -- build slave 2... 
Preloading Rails environment 
    -- build slave 1... 
    -- build slave 2... 
Preloading Rails environment 
Preloading Rails environment 
Preloading Rails environment 
Loading Spork.prefork block... 
Loading Spork.prefork block... 
Loading Spork.prefork block... 
Loading Spork.prefork block... 
    --> DRb magazine_slave_service: 1 provided... 
    --> DRb magazine_slave_service: 2 provided... 
    --> DRb magazine_slave_service: 1 provided... 
    --> DRb magazine_slave_service: 2 provided... 

17:03:59 - INFO - Spork server for RSpec, Cucumber successfully started 
17:03:59 - INFO - Guard is now watching at 'D:/BitNami/rubystack-1.9.3-6/projects/sample_app' 
]2;[Spork] RSpec, Cucumber successfully started 
ain)> 

ain)> 

내 spec_helper.rb

require 'rubygems' 
require 'spork' 

#uncomment the following line to use spork with the debugger 
#require 'spork/ext/ruby-debug' 

Spork.prefork do 
    # Loading more in this block will cause your tests to run faster. However, 
    # if you change any configuration or code from libraries loaded here, you'll 
    # need to restart spork for it take effect. 

    # This file is copied to spec/ when you run 'rails generate rspec:install' 
    ENV["RAILS_ENV"] ||= 'test' 
    require File.expand_path("../../config/environment", __FILE__) 
    require 'rspec/rails' 
    require 'rspec/autorun' 

    #20130530 RGR Installing Spork. The following code existed and was moved to Spork.prefork 
    # Requires supporting ruby files with custom matchers and macros, etc, 
    # in spec/support/ and its subdirectories. 
    Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 

    RSpec.configure do |config| 
    # ## Mock Framework 
    # 
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 
    # 
    # config.mock_with :mocha 
    # config.mock_with :flexmock 
    # config.mock_with :rr 
    config.mock_with :rspec 

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 
    config.fixture_path = "#{::Rails.root}/spec/fixtures" 

    # If you're not using ActiveRecord, or you'd prefer not to run each of your 
    # examples within a transaction, remove the following line or assign false 
    # instead of true. 
    config.use_transactional_fixtures = true 

    # If true, the base class of anonymous controllers will be inferred 
    # automatically. This will be the default behavior in future versions of 
    # rspec-rails. 
    config.infer_base_class_for_anonymous_controllers = false 
end 

Spork.each_run do 
    # This code will be run each time you run your specs. 

    end 
end 
+0

가드 파일을 읽었습니까? 그것은 Spork를 두 번 시작하며 다른 일을 시작하는 것으로 보입니다. 이것이 전체 Guardfile이 아닌 경우 전체 파일에 대한 링크를 제공하십시오. –

+0

해당 Guardfile을 변경하면 해당 내용이 출력에 반영되므로 해당 내용이 확실합니다. Guardfile은 꽤 크지 만, 나는 = begin과 함께 제공되는 것 아래에 모든 것을 주석 처리했다. 나는 두 개의 Sporks가 Rspec과 Cucumber라고 생각해, 맞습니까? 그러나, 나는 현재 오이를 사용하지 않고있다. 내가 보석을 제거하고 명령을 주석으로 완전히 비활성화하려고했지만 그게 더 많은 문제가 발생했습니다. –

답변

0

이 문제는 BitNami Rubystack을 다시 설치하면 해결되었습니다.