繁体   English   中英

在安装了当前红宝石和导轨的情况下安装RVM

[英]Install RVM with current ruby and rails installed

我正在使用Rails 3.2.14和Ruby ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] ,而没有RVM。

除了在同一台计算机上当前的Rails版本外,我还需要使用Rails 2.3。 我搜索了允许我在同一台计算机上使用它们的东西,并找到了它的RVM。

我正在使用Oh-My-ZSH并且已键入此命令来安装RVM

\curl -L https://get.rvm.io | bash -s stable

安装后,我收到此警告

  * WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/home/dexter/.bash_profile':

      source ~/.profile

而且我不知道该如何处理当前的红宝石和铁轨。 同时使用Rails 3和Rails所需的步骤是什么?先前的警告又如何?

➜  ~  ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
➜  ~  which ruby
ruby: aliased to bundled_ruby

当我输入rvm list时:

rvm list

rvm rubies


# No rvm rubies installed yet. Try 'rvm help install'.

当我尝试去我的名为Triton的项目时

➜  ~  cd ~/Desktop\ item/Triton
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/dexter/Desktop item/Triton/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

ruby-1.9.3-p448 is not installed.
To install do: 'rvm install ruby-1.9.3-p448'

使用rvm安装ruby所需的任何版本。 例如

$ rvm install 1.8.7
$ rvm use 1.8.7
$ gem install rails -v 2.3

使用宝石集返回到系统版本的ruby

$ rvm use system
$ ruby -v
(Should be) ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

要切换到1.8.7(例如),请使用

$ rvm use 1.8.7

您也可以将rvm用于两个版本的rails和一个ruby版本-尝试使用gemsets

$ rvm install 1.9.3-p194
$ rvm use 1.9.3-p194
$ rvm gemset create rails2
$ rvm gemset use rails2
$ gem install rails 2.3
$ rvm gemset create rails3
$ rvm gemset use rails3
$ rvm install rails -v 3.2.14

有关gemset的完整信息,请参见http://rvm.io/gemsets

我已经收到此警告,并继续进行安装,没有问题...您可以键入“ rvm list”,并且它可以将rvm识别为命令吗? 您的滑轨安装线下是否遇到问题?

no rvm rubies installed yet因为rvm范围内没有红宝石。 您的“主”系统红宝石与rvm安装的ruby没有什么共同点,这是有意的。 您应该使用以下命令在rvm中安装ruby:

rvm install ruby-1.9.3-p194

如果需要特定的路径级别。

您可以将其与

rvm use ruby-1.9.3-p194

如果需要特定的路径级别。 您应该使用创建新的gemset

rvm gemset create PutNameHere

然后使用它(如果我正确记住,应该自动完成)

rvm gemset use PutNameHere

从那时起,您应该以常规方式安装宝石,它们应该进入具有特定红宝石版本的特定宝石集中。

编辑:如果要使用rails 2安装ruby 1.8.6 ,则应该:

rvm install ruby-1.8.6 # this may take a while
rvm use ruby-1.8.6
rvm create gemset Triton # or any other name you like
rvm gemset use Triton
gem install rails -v '~> 2.3' # or an other version you want, but much better will be to do:
bundle install #of course in your app root directory - it will install all necessary gems     altogeter with rails 2 or whatever you have specified

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM