如何阻止以前版本的宝石被加载?

时间:2010-11-01 18:42:38

标签: ruby-on-rails

我正在开发一个第三方的网络服务器,所以我只能在家里工作。我在webapps下安装了ruby rail。我更改了PATHGEM_HOME的本地环境变量以指向本地安装文件夹。这是由网络托管服务(webfaction)推荐的,并且工作正常。

现在的问题是我安装haml新版本。我可以查看以下内容。

[user@abc n2]$ gem list -d haml

*** LOCAL GEMS ***

haml (3.0.23)
    Authors: Nathan Weizenbaum, Chris Eppstein, Hampton Catlin
    Rubyforge: http://rubyforge.org/projects/haml
    Homepage: http://haml-lang.com/
    Installed at: /home/myhome/webapps/mysite/gems

    An elegant, structured XHTML/XML templating engine. Comes with Sass,
    a similar CSS templating engine.

但是当我出于某种原因执行跟踪时haml-2.2.9在新haml-3.0.23之前被激活。我没有haml-2.2.9的访问权或权限,它可能安装在我无法访问的某个根文件夹下。我该如何解决这个问题。请记住,我只拥有主文件夹的权利以及它下面的内容。 haml-2.29未在本地安装。

[user@abc n2]$ rake gems
(in /home/myhome/webapps/mysite/n2)
 - [F] haml
 - [I] eycap
    - [I] capistrano >= 2.2.0
       - [I] net-ssh >= 2.0.14
       - [I] net-sftp >= 2.0.0
          - [I] net-ssh >= 2.0.9
       - [I] net-scp >= 1.0.0
          - [I] net-ssh >= 1.99.1
       - [I] net-ssh-gateway >= 1.0.0
          - [I] net-ssh >= 1.99.1
       - [I] highline
    - [I] hoe >= 1.5.1
       - [I] rubyforge >= 2.0.4
          - [I] json_pure >= 1.1.7
       - [R] rake >= 0.8.7
 - [F] whenever
    - [I] chronic >= 0.2.3
 - [F] rack
 - [F] formtastic
    - [R] activesupport >= 2.3.0
    - [R] actionpack >= 2.3.0
 - [I] hpricot
 - [F] friendly_id
    - [R] activerecord >= 2.2.3
    - [R] activesupport >= 2.2.3
 - [F] will_paginate ~> 2.3.11
 - [I] compass
rake aborted!
can't activate , already activated haml-2.2.9

1 个答案:

答案 0 :(得分:0)

盖伊我找到了解决方案。我从开始时注释了config.gem,而是加载了compass,这取决于haml-3.0.23所以现在它正确加载。我在/config/envirnoment.rb

中进行了更改
  config.gem "compass"
 # config.gem "haml"
  config.gem "eycap"
  config.gem "whenever"
  config.gem "rack"
  config.gem "formtastic"
  config.gem "hpricot"
  config.gem "friendly_id"
  config.gem 'will_paginate', :version => '~> 2.3.11', :source => 'http://gemcutter.org'
 # config.gem "compass"
  config.gem "compass-960-plugin", :lib => 'ninesixty'