如何更改rails应用程序的Ruby版本

时间:2016-02-18 17:06:18

标签: ruby-on-rails ruby rubygems

目前有一些关于Ruby的严重问题,我觉得它是版本控制的。

我有一个看起来像这样的Gemfile

source "https://rubygems.org"

ruby "2.5.2"

gem "rails", "4.2.1"
gem "unicorn", "4.8.3"
gem "mysql2"
gem "sass-rails", "~> 4.0.3"
gem "uglifier", ">= 1.3.0"
gem "coffee-rails", "~> 4.0.0"
gem "turbolinks"
gem "ancestry"
gem "kaminari"
gem "saxerator"
gem "factory_girl_rails"
gem "delayed_job_active_record"
gem "tree_delta", "~> 2.0.0"
gem "daemons"
gem "which-user",      git: "https://ad131a5ab23a69365434b0e7e36d6275b6a1e9fb:x-oauth-basic@github.com/whichdigital/which-user.git", ref: '18eb7'
gem "eva_rails",       git: "https://ad131a5ab23a69365434b0e7e36d6275b6a1e9fb:x-oauth-basic@github.com/whichdigital/eva_rails.git", tag: "v1.0.6"
gem "dam_client",      git: "https://ad131a5ab23a69365434b0e7e36d6275b6a1e9fb:x-oauth-basic@github.com/whichdigital/digital_asset_manager_client.git", tag: "1.0.0"
gem "fragment_client", git: "https://ad131a5ab23a69365434b0e7e36d6275b6a1e9fb:x-oauth-basic@github.com/whichdigital/fragment_client.git", ref: '3c197'
gem 'frontend_containers', git: "https://ad131a5ab23a69365434b0e7e36d6275b6a1e9fb:x-oauth-basic@github.com/whichdigital/frontend_containers.git"
gem "cucumber-rails", require: false
gem "parallel_tests"
gem "elasticsearch"
gem 'patron'
gem 'typhoeus'
gem 'net-http-persistent'
gem "dalli"
gem "jbuilder"
gem "newrelic_rpm"
gem 'airbrake'
gem 'rest-client'
gem 'redis-rails'
gem 'dotenv-rails', :require => 'dotenv/rails-now'
gem 'mail'
gem 'rack-rewrite', '~> 1.5.0'
gem 'net-sftp'
gem 'httparty'

group :production do
  gem 'rails_12factor'
end

group :test do
  gem "timecop"
  gem "webmock"
  gem "site_prism"
  gem "simplecov", require: false
end

group :development, :test do
  gem "rspec-rails"
  gem "rspec-its"
  gem "shoulda-matchers", require: false
  gem "database_cleaner"
  gem "spring"
  gem "spring-commands-rspec"
  gem "spring-commands-cucumber"
  gem "pry-rails"
  gem "pry-byebug"
  gem "rubocop", require: false
  gem "selenium-webdriver"
  gem "poltergeist"
  gem "capybara-firebug"
  gem "capybara-screenshot"
  gem "yarjuf"
  gem "launchy"
  gem "web-console", "~> 2.0"
  gem "bullet"
  gem "rspec-collection_matchers"
  gem "eyes_selenium"
  gem 'ftpd'
end

我安装了Bundler version 1.11.2

宝石版2.4.6

Rails 4.2.5.1

当我执行ruby -v时,我会返回ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]

此项目附带的自述文件说运行"bin/setup",然后提示我安装bundler。如上所示安装。

当该命令正在运行时,我收到以下错误Your Ruby version is 2.0.0, but your Gemfile specified 2.5.2

由于某种原因,我无法更新到此版本。

如果有人需要更多信息,请告诉我。

1 个答案:

答案 0 :(得分:6)

尝试更改Gemfile中的ruby版本。

source "https://rubygems.org"

ruby "2.5.2"
# ... 

为:

source "https://rubygems.org"

ruby "2.0.0"
# ... 

另外,根据我收集到的内容以及上面部分所述,最新稳定版本的ruby是2.3.0 atm以防可能感兴趣