是否可以使用Ruby 1.9.3在Heroku上运行我的Rails应用程序?如果是这样,怎么样?

Gab*_*ley 12 ruby-on-rails heroku ruby-1.9.3 cedar

我试过这个提示:https://github.com/thoughtbot/laptop/pull/14#issuecomment-3192270.

在部署我看到

-----> Using RUBY_VERSION: ruby-1.9.3-p0
Run Code Online (Sandbox Code Playgroud)

但我的日志显示环境变量不受尊重

INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
Run Code Online (Sandbox Code Playgroud)

接受Hack​​y /实验解决方案!

编辑:我在雪松堆上.

Gle*_*enn 18

以下是每个引用此问题的人的更新... Heroku现在允许您在Gemfile中指定ruby版本,这要归功于它们添加到最新版本的bundler.

第一次运行:

gem install bundler --pre
Run Code Online (Sandbox Code Playgroud)

然后将ruby'1.9.3'添加到你的Gemfile中.

source 'http://rubygems.org'

ruby '1.9.3'
gem  'rails', '3.2.3'
Run Code Online (Sandbox Code Playgroud)

Heroku的完整版本详情请访问http://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/


Joh*_*non 8

是的,所以Ruby 1.9.3肯定是可能的.正如你所说的hacky /实验解决方案被接受 - 这绝对是其中之一.

它实际上非常简单;

  1. 为您的应用程序启用Heroku Labsuser_env_compile功能.

  2. 将heroku配置变量设置为RUBY_VERSION为ruby-1.9.3-p0(heroku config:add RUBY_VERSION=ruby-1.9.3-p0)

  3. 确保heroku PATH配置变量bin位于前面(heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin)

下次部署时,您应该使用1.9.3查看您的应用程序 - 部署输出也会显示此信息;

-> Heroku receiving push
-----> Ruby/Rails app detected
-----> Using RUBY_VERSION: ruby-1.9.3-p0
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Run Code Online (Sandbox Code Playgroud)


Hol*_*off 5

从5月10日开始,可以更轻松地使用Ruby 1.9.3.只需看看Heroku的博客:http: //blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/