2017-06-17 23 views
-1

我有一個非常大的項目,在某些測試版本中開發的,項目運行良好,但是rspec,GemfileGemfile.lock有問題,一些開發人員已經更新了一些寶石,但並沒有刪除舊的Gemfile.lock ,所以我們沒有對該項目有任何問題,因爲Gemfile沒有與該項目墜毀。 太多後,我發現問題,我認爲是寶石之間的差異。Rails Gemes版本和`Gemfile`編譯有問題嗎?

當我複製並粘貼Gemfile.lock所有規格的最新版本運行良好,但如果我刪除舊Gemfile.lock並再次運行bundle install該項目將提出許多問題與規範我認爲這是對寶石版本,但我嘗試安裝相同的版本,我在舊的Gemfile.lock,我有同樣的問題,也有一些無法找到原始版本的寶石。

該項目是如此之大,我無法更新Gemfile我認爲可能的解決方案之一是用一個程序轉換Gemfile.lockGemfile不與我的規格任何錯誤

這是我的老Gemfile.lock,讓我跑rspec的好:

GEM 
    remote: https://rubygems.org/ 
    specs: 
    aasm (3.0.3) 
     activerecord 
    actionmailer (3.2.1) 
     actionpack (= 3.2.1) 
     mail (~> 2.4.0) 
    actionpack (3.2.1) 
     activemodel (= 3.2.1) 
     activesupport (= 3.2.1) 
     builder (~> 3.0.0) 
     erubis (~> 2.7.0) 
     journey (~> 1.0.1) 
     rack (~> 1.4.0) 
     rack-cache (~> 1.1) 
     rack-test (~> 0.6.1) 
     sprockets (~> 2.1.2) 
    active_median (0.0.1) 
    active_record_query_trace (1.5.4) 
    activemodel (3.2.1) 
     activesupport (= 3.2.1) 
     builder (~> 3.0.0) 
    activerecord (3.2.1) 
     activemodel (= 3.2.1) 
     activesupport (= 3.2.1) 
     arel (~> 3.0.0) 
     tzinfo (~> 0.3.29) 
    activeresource (3.2.1) 
     activemodel (= 3.2.1) 
     activesupport (= 3.2.1) 
    activesupport (3.2.1) 
     i18n (~> 0.6) 
     multi_json (~> 1.0) 
    addressable (2.2.7) 
    akami (1.0.0) 
     gyoku (>= 0.4.0) 
    algorithms (0.5.0) 
    arel (3.0.2) 
    awesome_nested_set (2.1.6) 
     activerecord (>= 3.0.0) 
    bcrypt-ruby (3.0.1) 
    bluepill (0.0.66) 
     activesupport (>= 3.0.0, < 4.0.0) 
     daemons (~> 1.1.4) 
     i18n (>= 0.5.0) 
     state_machine (~> 1.1) 
    bourne (1.6.0) 
     mocha (~> 1.1) 
    builder (3.0.0) 
    cancan (1.6.7) 
    capistrano (2.11.2) 
     highline 
     net-scp (>= 1.0.0) 
     net-sftp (>= 2.0.0) 
     net-ssh (>= 2.0.14) 
     net-ssh-gateway (>= 1.1.0) 
    coffee-rails (3.2.2) 
     coffee-script (>= 2.2.0) 
     railties (~> 3.2.0) 
    coffee-script (2.2.0) 
     coffee-script-source 
     execjs 
    coffee-script-source (1.2.0) 
    columnize (0.9.0) 
    daemons (1.1.9) 
    database_cleaner (0.7.2) 
    debugger (1.6.8) 
     columnize (>= 0.3.1) 
     debugger-linecache (~> 1.2.0) 
     debugger-ruby_core_source (~> 1.3.5) 
    debugger-linecache (1.2.0) 
    debugger-ruby_core_source (1.3.8) 
    devise (2.0.4) 
     bcrypt-ruby (~> 3.0) 
     orm_adapter (~> 0.0.3) 
     railties (~> 3.1) 
     warden (~> 1.1.1) 
    devise_lastseenable (0.0.6) 
     devise 
     rails (>= 3.0.4) 
    diff-lcs (1.1.3) 
    erubis (2.7.0) 
    exception_notification (2.6.1) 
     actionmailer (>= 3.0.4) 
    execjs (1.3.0) 
     multi_json (~> 1.0) 
    factory_girl (3.0.0) 
     activesupport (>= 3.0.0) 
    factory_girl_rails (3.0.0) 
     factory_girl (~> 3.0.0) 
     railties (>= 3.0.0) 
    faraday (0.7.6) 
     addressable (~> 2.2) 
     multipart-post (~> 1.1) 
     rack (~> 1.1) 
    geocoder (1.1.1) 
    groupdate (1.0.4) 
     activerecord (>= 3.0.0) 
    gyoku (0.4.4) 
     builder (>= 2.1.2) 
    highline (1.6.11) 
    hike (1.2.1) 
    holidays (3.3.0) 
    httpi (0.9.6) 
     rack 
    i18n (0.6.0) 
    i18n-inflector (2.6.6) 
     i18n (>= 0.4.1) 
    journey (1.0.3) 
    json (1.6.5) 
    kaminari (0.13.0) 
     actionpack (>= 3.0.0) 
     activesupport (>= 3.0.0) 
     railties (>= 3.0.0) 
    mail (2.4.4) 
     i18n (>= 0.4.0) 
     mime-types (~> 1.16) 
     treetop (~> 1.4.8) 
    metaclass (0.0.4) 
    mime-types (1.18) 
    mocha (1.2.1) 
     metaclass (~> 0.0.1) 
    multi_json (1.1.0) 
    multipart-post (1.1.5) 
    net-scp (1.0.4) 
     net-ssh (>= 1.99.1) 
    net-sftp (2.0.5) 
     net-ssh (>= 2.0.9) 
    net-ssh (2.9.2) 
    net-ssh-gateway (1.1.0) 
     net-ssh (>= 1.99.1) 
    newrelic_rpm (3.15.2.317) 
    nokogiri (1.5.2) 
    nori (1.1.0) 
    oauth (0.4.5) 
    oauth-plugin (0.4.0.rc2) 
     multi_json 
     oauth (~> 0.4.4) 
     oauth2 
     rack 
    oauth2 (0.5.2) 
     faraday (~> 0.7) 
     multi_json (~> 1.0) 
    orm_adapter (0.0.7) 
    passenger (5.0.28) 
     rack 
     rake (>= 0.8.1) 
    pg (0.18.4) 
    polyglot (0.3.3) 
    rabl (0.6.2) 
     activesupport (>= 2.3.14) 
     multi_json (~> 1.1.0) 
    rack (1.4.1) 
    rack-cache (1.2) 
     rack (>= 0.4) 
    rack-protection (1.2.0) 
     rack 
    rack-ssl (1.3.2) 
     rack 
    rack-test (0.6.1) 
     rack (>= 1.0) 
    rails (3.2.1) 
     actionmailer (= 3.2.1) 
     actionpack (= 3.2.1) 
     activerecord (= 3.2.1) 
     activeresource (= 3.2.1) 
     activesupport (= 3.2.1) 
     bundler (~> 1.0) 
     railties (= 3.2.1) 
    railties (3.2.1) 
     actionpack (= 3.2.1) 
     activesupport (= 3.2.1) 
     rack-ssl (~> 1.3.2) 
     rake (>= 0.8.7) 
     rdoc (~> 3.4) 
     thor (~> 0.14.6) 
    rake (11.1.2) 
    rdoc (3.12) 
     json (~> 1.4) 
    redis (2.2.2) 
    redis-actionpack (3.2.1) 
     actionpack (= 3.2.1) 
     redis-rack (~> 1.4.0) 
     redis-store (~> 1.1.0) 
    redis-activesupport (3.2.1) 
     activesupport (= 3.2.1) 
     redis-store (~> 1.1.0) 
    redis-namespace (1.0.3) 
     redis (< 3.0.0) 
    redis-rack (1.4.1) 
     rack (= 1.4.1) 
     redis-store (~> 1.1.0) 
    redis-rails (3.2.1) 
     redis-actionpack (~> 3.2.1) 
     redis-activesupport (~> 3.2.1) 
     redis-store (~> 1.1.0) 
    redis-store (1.1.0) 
     redis (~> 2.2.0) 
    resque (1.20.0) 
     multi_json (~> 1.0) 
     redis-namespace (~> 1.0.2) 
     sinatra (>= 0.9.2) 
     vegas (~> 0.1.2) 
    resque-scheduler (2.0.0) 
     redis (>= 2.0.1) 
     resque (>= 1.20.0) 
     rufus-scheduler 
    resque_mailer (2.0.3) 
     actionmailer (>= 3.0.0) 
     resque (>= 1.2.3) 
    resque_spec (0.12.2) 
     resque (>= 1.19.0) 
     rspec (>= 2.5.0) 
    rspec (2.9.0) 
     rspec-core (~> 2.9.0) 
     rspec-expectations (~> 2.9.0) 
     rspec-mocks (~> 2.9.0) 
    rspec-core (2.9.0) 
    rspec-expectations (2.9.0) 
     diff-lcs (~> 1.1.3) 
    rspec-mocks (2.9.0) 
    rspec-rails (2.9.0) 
     actionpack (>= 3.0) 
     activesupport (>= 3.0) 
     railties (>= 3.0) 
     rspec (~> 2.9.0) 
    rufus-scheduler (2.0.17) 
     tzinfo (>= 0.3.23) 
    rvm-capistrano (1.0.2) 
     capistrano (>= 2.0.0) 
    sass (3.1.15) 
    sass-rails (3.2.5) 
     railties (~> 3.2.0) 
     sass (>= 3.1.10) 
     tilt (~> 1.3) 
    savon (0.9.9) 
     akami (~> 1.0) 
     builder (>= 2.1.2) 
     gyoku (>= 0.4.0) 
     httpi (~> 0.9) 
     nokogiri (>= 1.4.0) 
     nori (~> 1.1) 
     wasabi (~> 2.1) 
    shoulda-matchers (1.5.6) 
     activesupport (>= 3.0.0) 
     bourne (~> 1.3) 
    simplecov (0.6.1) 
     multi_json (~> 1.0) 
     simplecov-html (~> 0.5.3) 
    simplecov-html (0.5.3) 
    sinatra (1.3.2) 
     rack (~> 1.3, >= 1.3.6) 
     rack-protection (~> 1.2) 
     tilt (~> 1.3, >= 1.3.3) 
    slack-notifier (1.5.1) 
    sprockets (2.1.2) 
     hike (~> 1.2) 
     rack (~> 1.0) 
     tilt (~> 1.1, != 1.3.0) 
    sqlite3 (1.3.5) 
    state_machine (1.2.0) 
    strip_attributes (1.1.0) 
     activemodel (~> 3.0) 
    sugarcrm (0.9.18) 
     activesupport (>= 2.3.10) 
     i18n 
     json 
    thor (0.14.6) 
    tilt (1.3.3) 
    timecop (0.8.1) 
    timezone (0.99.2) 
    treetop (1.4.10) 
     polyglot 
     polyglot (>= 0.3.1) 
    typhoeus (0.3.3) 
     mime-types 
    tzinfo (0.3.49) 
    uglifier (1.2.3) 
     execjs (>= 0.3.0) 
     multi_json (>= 1.0.2) 
    vegas (0.1.11) 
     rack (>= 1.0.0) 
    warden (1.1.1) 
     rack (>= 1.0) 
    wasabi (2.1.0) 
     nokogiri (>= 1.4.0) 

PLATFORMS 
    ruby 

DEPENDENCIES 
    aasm 
    active_median 
    active_record_query_trace 
    algorithms 
    awesome_nested_set 
    bluepill 
    cancan 
    capistrano 
    coffee-rails (~> 3.2.1) 
    database_cleaner (~> 0.7.1) 
    debugger 
    devise 
    devise_lastseenable 
    exception_notification (~> 2.6.1) 
    factory_girl_rails 
    geocoder 
    groupdate 
    holidays 
    i18n-inflector 
    kaminari 
    net-ssh (= 2.9.2) 
    newrelic_rpm 
    nokogiri 
    oauth-plugin (>= 0.4.0.pre1) 
    passenger 
    pg 
    rabl (~> 0.6.0) 
    rails (= 3.2.1) 
    redis-rails 
    resque (~> 1.20.0) 
    resque-scheduler 
    resque_mailer (~> 2.0.3) 
    resque_spec 
    rspec-rails (~> 2.4) 
    rvm-capistrano 
    sass-rails (~> 3.2.3) 
    savon (~> 0.9.9) 
    shoulda-matchers (~> 1.5.0) 
    simplecov 
    slack-notifier (~> 1.5, >= 1.5.1) 
    sqlite3 
    strip_attributes (~> 1.0) 
    sugarcrm 
    timecop 
    timezone 
    typhoeus (~> 0.3.3) 
    tzinfo (~> 0.3.49) 
    uglifier (>= 1.0.3) 

BUNDLED WITH 
    1.14.6 

,這裏是我的學嘗試的Gemfile.lock複製到Gemfile

source 'https://rubygems.org' 

gem 'rails', '3.2.1' 

gem 'pg', '~> 0.18.4', group: [:development, :test, :production] 

group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

group :production do 
    gem 'passenger', '~> 5.0.8' 
    # gem 'passenger', '~> 5.1.4' 
end 

gem 'devise' 
gem 'devise_lastseenable' 
gem 'cancan' 
gem 'oauth-plugin', ">= 0.4.0.pre1" 

group :test, :development, :vcr do 
    gem 'rspec', '~> 1.1.3' 
    gem "rspec-rails", "~> 2.99" 
    gem 'factory_girl_rails' 
    gem 'timecop' 
    gem 'shoulda-matchers', '~> 2.8.0'#, git: 'git://github.com/thoughtbot/shoulda-matchers.git' 
    gem 'debugger' 
    gem 'sqlite3' 
    gem 'database_cleaner', '~> 0.7.1' 
    gem 'simplecov' 
end 

group :test do 
    gem 'resque_spec' 
end 

gem 'rabl', '~> 0.6.0' 
gem 'aasm' 
gem 'net-ssh', '=2.9.2' 
gem 'holidays', '~> 3.1.2'#, git: 'https://github.com/sincola/holidays.git' 
gem 'capistrano', require: false 
gem 'rvm-capistrano', require: false 
gem 'newrelic_rpm', '~> 3.18.1' 

gem 'i18n-inflector' 

gem 'savon', '~> 0.9.9' 
gem "typhoeus", "~> 0.3.3" 

gem "exception_notification", "~> 2.6.1" 
gem "strip_attributes", "~> 1.0" 

gem 'resque', "~> 1.20.0" 
gem 'resque_mailer', "~> 2.0.3" 
gem 'resque-scheduler', :require => 'resque_scheduler' 

gem 'kaminari' 
gem 'redis-rails' 
gem 'algorithms' 

gem 'geocoder' 
gem 'timezone', '~> 1.0' 

gem 'sugarcrm' 
gem 'bluepill' 
gem 'groupdate' 
gem 'active_median' 

gem 'awesome_nested_set' 

gem 'tzinfo', '~> 0.3.49' 

gem 'active_record_query_trace' # source: https://github.com/ruckus/active-record-query-trace 

gem 'slack-notifier', '~> 1.5', '>= 1.5.1' 
gem 'nokogiri', '~> 1.6.5' 

什麼,我認爲是:有一些是重複我Gemfile.lock與不同版本的舊Gemfile.lock

請仔細閱讀我的問題,不同的寶石,如果你知道如何幫助我的,我會無限謝謝。

感謝和問候,

+0

你得到了什麼錯誤,當您嘗試安裝不老Gemfile.lock的 – slal

回答

1

當您嘗試運行捆綁安裝,有些寶石會給你喜歡Your bundle is locked to xyz gem (version), but that version could not be found in any of the sources listed in your Gemfile錯誤。要解決此類問題,您必須更新Gemfile中的確切版本= xxx而不是~> xxx

此外,由於其他寶石的依賴關係,您也可能需要更新Gemfile.lock中的鎖定寶石。

+0

謝謝,我可以安裝的一切問題規範,我不能成功運行它 –

1

Gemfile不比Gemfile.lock嚴格。因此,所有沒有限制或軟性限制的Gems(例如,~> 4> 4.0)都會更新爲新版本,這可能不是最初開發代碼時使用的版本,這就是爲什麼一些寶石可能會失敗。

我沒有時間做你試圖複製Gemfile.lockGemfile又進行了全面審查,但我已經看到了你所使用的一些寶石,而無需在Gemfile指定一個確切的版本,我覺得可能是你的問題。 Gemfile.lock總是指定確切的版本,所以如果你想複製你的Gemfile.lock你應該這樣做。例如,對於slack-notifier寶石您使用的版本1.5.1但你Gemfilegem 'slack-notifier', '~> 1.5', '>= 1.5.1'當它應該是gem 'slack-notifier', '1.5.1'

+0

謝謝這是有益的 –

+0

鑑於它是有用的,你可以請投票或批准答案? – Fede