简体   繁体   English

拆包宝石[Rails 2.3.5]

[英]Unpacking gems [Rails 2.3.5]

I have the following gems defined in my environment.rb file: 我在environment.rb文件中定义了以下gem:

  config.gem "authlogic"
  config.gem "paperclip"
  config.gem "pauldix-feedzirra", :lib => "feedzirra", :source => "http://gems.github.com"
  config.gem 'whenever', :lib => false, :source => 'http://gemcutter.org/'

I have them installed on my local computer and everything is working well. 我把它们安装在我的本地计算机上,一切运行良好。 Since I am working on a shared-server (DreamHost), I need to unpack those gems to get them to work (can't install them as I did on my own computer to get them to work). 由于我正在使用共享服务器(DreamHost),我需要解压缩这些宝石以使它们工作(不能像我在自己的计算机上那样安装它们以使它们工作)。

Before uploading, I ran the following on my local machine: 在上传之前,我在本地计算机上运行了以下命令:

rake gems:unpack

This created the following folders in /vender/gems : 这在/vender/gems创建了以下文件夹:

authlogic-2.1.3, paperclip-2.3.1.1, pauldix-feedzirra-0.0.18, whenever-0.4.1

So it looks like they're all there. 所以看起来他们都在那里。

When I run rake db:migrate on the server, though, I get these following error: 但是,当我在服务器上运行rake db:migrate时,我收到以下错误:

Missing these required gems:
  pauldix-feedzirra

For some reason, the feedzirra unpacked gem is not detected. 出于某种原因,未检测到feedzirra未包装的宝石。 Could anybody offer a clue as to why this is happening and a potential solution? 任何人都能提供一个关于为什么会发生这种情况以及潜在解决方案的线索吗?

Thanks! 谢谢!


EDIT: Thanks, but the code to put in environment.rb doesn't work, and bundler won't install properly on my server. 编辑:谢谢,但是放在environment.rb中的代码不起作用,并且bundler将无法在我的服务器上正确安装。 Any other suggestions? 还有其他建议吗?

This isn't exactly an answer, but since I could never get config.gem to work properly, I recommend using Bundler whenever I can. 这不是一个答案,但由于我无法让config.gem正常工作,我建议我尽可能使用Bundler It just works and it handles interdependencies between gems well. 它只是工作,它很好地处理宝石之间的相互依赖性。 It also replaces config.gem in Rails 3 from what I understand. 它也取代了我理解的Rails 3中的config.gem。

I notice two things about feedzirra: first, it depends on 3 other gems, and at least one of those build native extensions. 我注意到关于feedzirra的两件事:首先,它取决于其他3个宝石,并且至少有一个构建原生扩展。 And I'm going to call it "feedzirra" - I'm not a fan of github's ill-considered autopackaging fiasco. 我将其称为“feedzirra” - 我不是github考虑不当的自动包装惨败的粉丝。

If it were only the former, then rake gems:unpack:dependencies would do the trick. 如果它只是前者,那么rake gems:unpack:dependencies就可以了。

However, at least curb (which feedzirra depends on) is building extensions, and those can't simply be unpacked. 但是,至少curb(feedzirra所依赖的)是构建扩展,而那些不能简单地解压缩。 You could either get Dreamhost to install them (good luck) or install them into your user's local gem directory. 您可以让Dreamhost安装它们(祝你好运)或将它们安装到用户的本地gem目录中。

To do that, you'll need to update your .gemrc and be sure that it includes a line like: :user_install: true 要做到这一点,你需要更新你的.gemrc,并确保它包含一行代码:: user_install:true

Then rake gems:install 然后耙宝石:安装

Unless your deployment environment won't let you build executables, in which case you'll need to shell out for a less restricted package - I know for a fact that Dreamhost does provide packages that will allow for extension-gems. 除非你的部署环境不允许你构建可执行文件,在这种情况下你需要为一个不太受限制的包外壳 - 我知道Dreamhost确实提供了允许扩展gems的包。

(And there's the separate issue of libcurl being deployed...) (还有一个单独的libcurl问题被部署......)

Try Following.put this code in envoirment.rb 尝试在envoirment.rb中输入此代码

  config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| 
    File.directory?(lib = "#{dir}/lib") ? lib : dir
  end

Don't know if my hints are useful, because feedzirra is compiled extension (against CURL i think). 不知道我的提示是否有用,因为feedzirra是编译扩展(我认为对CURL)。 Better solution is to normally install feedzirra gem (it will compile itself) on your server. 更好的解决方案是在您的服务器上正常安装feedzirra gem(它将自行编译)。


You have not installed (unpacked) feedzirra gem, but pauldix-feedzirra. 你还没有安装(解包)feedzirra gem,而是pauldix-feedzirra。 Probably you need feedzirra unpacked too. 也许你需要feedzirra解压缩。

Try to add 尝试添加

config.gem feedzirra

into environment.rb and run locally 进入environment.rb并在本地运行

rake gems:install
rake gems:unpack

It looks like feedzirra unpacked gem is missing in /vendor/plugins . 看起来/vendor/plugins缺少feedzirra unpacked gem。 Look if feedzirra will be copied there after those commands... 看看那些命令之后是否会复制feedzirra ...

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

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