2012-06-21 65 views
1

這是Gemfile的rspec-expectations爲什麼使用Gemfile作爲寶石

source "http://rubygems.org" 

gemspec 

%w[rspec rspec-core rspec-expectations rspec-mocks].each do |lib| 
    library_path = File.expand_path("../../#{lib}", __FILE__) 
    if File.exist?(library_path) 
    gem lib, :path => library_path 
    else 
    gem lib, :git => "git://github.com/rspec/#{lib}.git" 
    end 
end 

### deps for rdoc.info 
gem 'yard',   '0.8.0', :require => false 
gem 'redcarpet',  '2.1.1' 
gem 'github-markup', '0.7.2' 

platforms :jruby do 
    gem "jruby-openssl" 
end 

eval File.read('Gemfile-custom') if File.exist?('Gemfile-custom') 

This is .gemspec

正如你可以看到.gemspec定義了diff-lcs只有一個單一的依賴。這是更進一步validated by rubygems page

我的問題是什麼是使用Gemfile。我知道捆綁商使用它。但爲了什麼?

+0

定義依賴關係。 –

+0

@DaveNewton,因爲我提到rubygems頁面顯示Gemfile依賴關係沒有聲明爲依賴關係。 –

回答

0

Gemfile適用於rspec貢獻者的開發依賴項。它不附帶寶石,但它抓住了gemspec deps,所以我們不必重複gemfile中的dep。合理?

+0

啊。這裏的關鍵字是「開發依賴」。所以所有生產(讀取運行時)依賴關係都轉到.gemspec。大衛:可以說在開發過程中我正在進行測試。我看着spec_helper,但我沒有看到任何打往Bundler的電話。那麼Gemfile如何以及在哪裏幫助您進行rspec-expecations的開發。或者是因爲rspec-期望是更大的生態系統的一部分(rspec),Gemfile依賴於「rspec rspec-core rspec-expectations rspec-mocks」。 感謝您對rspec的所有工作。 –

相關問題