简体   繁体   English

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

[英]Install RVM with current ruby and rails installed

I am using Rails 3.2.14 and Ruby ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] with out having RVM. 我正在使用Rails 3.2.14和Ruby ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] ,而没有RVM。

I need to use Rails 2.3 besides my current Rails version on the same machine. 除了在同一台计算机上当前的Rails版本外,我还需要使用Rails 2.3。 I have searched for what allows me to use both of them on the same machine and I found its RVM. 我搜索了允许我在同一台计算机上使用它们的东西,并找到了它的RVM。

I am using Oh-My-ZSH and I have typed this command to install RVM 我正在使用Oh-My-ZSH并且已键入此命令来安装RVM

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

After installation I got this warning 安装后,我收到此警告

  * 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

And i don't know what should i do with my current ruby and rails. 而且我不知道该如何处理当前的红宝石和铁轨。 What is the needed steps to use both of Rails 3 and Rails to and what about the previous warning also what about by the following 同时使用Rails 3和Rails所需的步骤是什么?先前的警告又如何?

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

when I type rvm list: 当我输入rvm list时:

rvm list

rvm rubies


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

also when i try to go to my project which is called Triton 当我尝试去我的名为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'

Install ruby any version you need with rvm. 使用rvm安装ruby所需的任何版本。 For example 例如

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

To return to your system version of ruby with its gemset use 使用宝石集返回到系统版本的ruby

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

To switch to 1.8.7 (for exxample) use 要切换到1.8.7(例如),请使用

$ rvm use 1.8.7

Also you can use rvm for both version of rails with one ruby version - try gemsets 您也可以将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

for full info about gemsets look at http://rvm.io/gemsets 有关gemset的完整信息,请参见http://rvm.io/gemsets

I've had this warning and continued on with my installation without issue...can you type in 'rvm list', and does it recognize rvm as a command? 我已经收到此警告,并继续进行安装,没有问题...您可以键入“ rvm list”,并且它可以将rvm识别为命令吗? Are you encountering a problem with your rails install further down the line? 您的滑轨安装线下是否遇到问题?

You get no rvm rubies installed yet because there are no rubies in rvm scope. no rvm rubies installed yet因为rvm范围内没有红宝石。 Your 'main', system ruby has nothing common with ruby's installed with rvm, that's intentional. 您的“主”系统红宝石与rvm安装的ruby没有什么共同点,这是有意的。 You should install ruby in rvm with: 您应该使用以下命令在rvm中安装ruby:

rvm install ruby-1.9.3-p194

if you want specific pathlevel. 如果需要特定的路径级别。

You can use it with 您可以将其与

rvm use ruby-1.9.3-p194

if you want specific pathlevel. 如果需要特定的路径级别。 you should create then new gemset with 您应该使用创建新的gemset

rvm gemset create PutNameHere

and then use it by (it should be done automatically if i remeber correctly) 然后使用它(如果我正确记住,应该自动完成)

rvm gemset use PutNameHere

since then you should install gems in regular way, they should go into specific gemset with specific ruby version. 从那时起,您应该以常规方式安装宝石,它们应该进入具有特定红宝石版本的特定宝石集中。

Edit: If you want to install ruby 1.8.6 with rails 2 you should: 编辑:如果要使用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