如何设置webrick服务器使用ruby 1.9.3?

发布于 2024-12-19 21:22:23 字数 968 浏览 4 评论 0原文

可以为特定的 ruby​​ 版本指定 Rails 服务器吗?

我在 Windows 上使用 gitbash 和 pik。我通过 ruby​​installer 安装了 ruby​​ 192 和 193。 Pik 在添加大量 .bashrc .pikrc 并编辑 config.yml 文件后设置。我可以在 rubies 之间切换,并且 gitbash 可以看到变化。一切似乎都很好。

但是,当运行简单的测试 Rails 应用程序时,运行 Rails 服务器会失败。不是错误,但欢迎页面只是纯文本。 ruby 设置为 193,但 webrick 报告为 192,如倒数第二行所示。

    laptop@LAPTOP-PC ~/Documents/Sites/rails_projects/demo_app (master)
    $ ruby -v
    ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

    laptop@LAPTOP-PC ~/Documents/Sites/rails_projects/demo_app (master)
    $ rails server
    => Booting WEBrick
    => Rails 3.1.3 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    [2011-12-07 19:08:18] INFO  WEBrick 1.3.1
    [2011-12-07 19:08:18] INFO  ruby 1.9.2 (2011-02-18) [i386-mingw32]
    [2011-12-07 19:08:19] INFO  WEBrick::HTTPServer#start: pid=1840 port=3000

如何设置webrick使用193?任何提示表示赞赏。

Can rails server be specified for the particular ruby version?

I'm on windows using gitbash and pik. I have ruby 192 and 193 installed via rubyinstaller. Pik is setup after much adding of .bashrc .pikrc and editing config.yml files. I can switch between rubies and gitbash sees the change. All appears to be well.

However, when running a simple test rails app, running rails server fails. Not an error but the welcome page is only plain text. The ruby is set to 193 but webrick reports 192 as noted on the second last line.

    laptop@LAPTOP-PC ~/Documents/Sites/rails_projects/demo_app (master)
    $ ruby -v
    ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

    laptop@LAPTOP-PC ~/Documents/Sites/rails_projects/demo_app (master)
    $ rails server
    => Booting WEBrick
    => Rails 3.1.3 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    [2011-12-07 19:08:18] INFO  WEBrick 1.3.1
    [2011-12-07 19:08:18] INFO  ruby 1.9.2 (2011-02-18) [i386-mingw32]
    [2011-12-07 19:08:19] INFO  WEBrick::HTTPServer#start: pid=1840 port=3000

How to set webrick to use 193? Any tips appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

2024-12-26 21:22:23

如上所述,我所要做的就是再次运行捆绑安装,现在 webbrick 服务器使用 ruby​​ 193

as noted above, all I had to do was run bundle install again, and now webbrick server uses ruby 193

感情洁癖 2024-12-26 21:22:23

如果使用 Bundler 1.6,请在 Gemfile 中指定 Ruby 版本:

ruby '1.9.3'

您可以使用 ruby​​ 在 Gemfile 中指定所需的 Ruby 版本。
如果 Gemfile 加载到不同的 Ruby 版本上,Bundler 将
提出异常并给出解释。

通过 http://bundler.io/v1.6/gemfile.html

If using Bundler 1.6, specify the Ruby version in Gemfile:

ruby '1.9.3'

You can specify the required version of Ruby in the Gemfile with ruby.
If the Gemfile is loaded on a different Ruby version, Bundler will
raise an exception with an explanation.

via http://bundler.io/v1.6/gemfile.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文