我有一个旧的ROR应用,该应用运行的是Ruby 1.9.3,Rails 4.2.4和MongoDB 3.0。我需要将其移至Ruby 2.2.2,Rails 4.5和MongoDB 3.2。
我接管了这个项目,因此代码当前正在托管服务上运行。我已经下载了源代码。但是,我想用需要更新的项目中的Gem文件在我的机器上本地构建一个简单的脚手架应用程序。首先,该项目的gem文件未列出该gem的特定版本,因此,如果我尝试使用bundler,它将尝试获取该gem的所有较新版本。该项目的Gemlock文件确实包含正在使用的版本号。
我的问题是我可以将gemlock文件(复制+粘贴)的内容使用到本地Gem文件中,然后运行捆绑程序。这将正常工作,这意味着它将获得正确的gem(生产服务器上使用的版本)吗?我了解其中某些gem版本可能已被删除。认为我只是将这些注释从gem文件中删除,然后运行bundle install直到工作。
GIT
remote: https://github.com/stripe/stripe-ruby
revision: df2e36287d88726c6a03ec6c1fdc19b5d6e2b274
specs:
stripe (1.27.2)
json (~> 1.8.1)
rest-client (~> 1.4)
PATH
remote: ./vendor/plugins/mongoid-encrypted-fields-1.2.2
specs:
mongoid-encrypted-fields (1.2.2)
mongoid
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.4)
actionview (= 4.2.4)
activesupport (= 4.2.4)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.4)
activesupport (= 4.2.4)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.4)
activesupport (= 4.2.4)
globalid (>= 0.3.0)
activemodel (4.2.4)
activesupport (= 4.2.4)
builder (~> 3.1)
activerecord (4.2.4)
activemodel (= 4.2.4)
activesupport (= 4.2.4)
arel (~> 6.0)
activesupport (4.2.4)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
aescrypt (1.0.0)
arel (6.0.3)
aws-sdk (1.66.0)
aws-sdk-v1 (= 1.66.0)
aws-sdk-v1 (1.66.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
bcrypt (3.1.10)
bson (3.2.4)
bson_ext (1.5.1)
builder (3.2.2)
chronic (0.10.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
columnize (0.9.0)
commander (4.3.5)
highline (~> 1.7.2)
daemons (1.2.3)
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)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
equalizer (0.0.11)
erubis (2.7.0)
ethon (0.8.0)
ffi (>= 1.3.0)
eventmachine (1.0.8)
excon (0.45.4)
execjs (2.6.0)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.10)
gcm (0.1.0)
httparty
json
geocoder (1.2.11)
gibberish (1.4.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
grape (0.13.0)
activesupport
builder
hashie (>= 2.1.0)
multi_json (>= 1.3.2)
multi_xml (>= 0.5.2)
rack (>= 1.3.0)
rack-accept
rack-mount
virtus (>= 1.0.0)
hashids (1.0.2)
hashie (3.4.2)
highline (1.7.7)
houston (2.2.3)
commander (~> 4.1)
json
http-cookie (1.0.2)
domain_name (~> 0.5)
httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.7.0)
ice_nine (0.11.1)
iron_core (1.0.9)
rest (>= 3.0.4)
iron_worker_ng (1.6.6)
bundler
iron_core (>= 1.0.6)
rubyzip (>= 1.0.0)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
jwt (1.5.1)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
libv8 (3.16.14.11)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mandrill-api (1.0.53)
excon (>= 0.16.0, < 1.0)
json (>= 1.7.7, < 2.0)
mime-types (2.6.2)
mimemagic (0.3.1)
mini_portile (0.6.2)
minitest (5.8.1)
mongo (2.1.1)
bson (~> 3.0)
mongoid (5.0.0)
activemodel (~> 4.0)
mongo (~> 2.1)
origin (~> 2.1)
tzinfo (>= 0.3.37)
multi_json (1.11.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
netrc (0.10.3)
newrelic-grape (2.0.0)
grape
newrelic_rpm
newrelic_rpm (3.13.2.302)
nexmo (3.0.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
oauth2 (1.0.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
opentok (2.3.3)
activesupport (>= 2.0)
addressable (~> 2.3)
httparty (~> 0.13.1)
origin (2.1.1)
orm_adapter (0.5.0)
rack (1.6.4)
rack-accept (0.4.5)
rack (>= 0.4)
rack-cors (0.4.0)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.4)
actionmailer (= 4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
activemodel (= 4.2.4)
activerecord (= 4.2.4)
activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.4)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.4)
railties (4.2.4)
actionpack (= 4.2.4)
activesupport (= 4.2.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
ref (2.0.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rest (3.0.6)
net-http-persistent (>= 2.9.1)
netrc
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rmagick (2.15.4)
rubyzip (1.1.7)
sendgrid-ruby (1.1.6)
faraday (~> 0.9)
mimemagic
smtpapi (~> 0.1)
smtpapi (0.1.0)
sprockets (3.3.5)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thin (1.6.4)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
timecop (0.8.0)
twilio-ruby (4.4.0)
builder (>= 2.1.2)
jwt (~> 1.0)
multi_json (>= 1.3.0)
typhoeus (0.8.0)
ethon (>= 0.8.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.3)
rack (>= 1.0)
PLATFORMS
ruby
DEPENDENCIES
aescrypt
aws-sdk (~> 1)
bson_ext
chronic
debugger
devise
execjs
factory_girl_rails
gcm
geocoder
gibberish (~> 1.4.0)
grape
hashids
houston
iron_worker_ng
jquery-rails
kaminari
mail
mandrill-api
mongo
mongoid (~> 5.0.0)
mongoid-encrypted-fields!
newrelic-grape
newrelic_rpm
nexmo
oauth2
opentok (~> 2.2)
rack-cors
rails (~> 4.2.4)
rails_12factor
rmagick
sendgrid-ruby
stripe!
therubyracer
thin
timecop
twilio-ruby
typhoeus
uglifier
答案 0 :(得分:0)
您无需担心Gemfile.lock文件,首先,您需要在Gemfile中更改需要更新的gem的版本,该版本将在软件包更新后更新Gemfile.lock。
例如,更改Gemfile以更新Rails版本
gem 'rails', '4.2.4'
到
gem 'rails', '4.5.0'
只需bundle update rails
,这将更新rails gem及其依赖项。
但是您只想更新没有相关性的rails(至少对于Rails之类的宝石不建议这样做)
e.g. bundle update --source rails
引用bundle update命令
PS:您可以在Gemfile中添加ruby版本(= 2.2.2),如果您使用rvm,它将自动切换ruby版本。