Ruby on Rails:Heroku:如何安装我的宝石?

时间:2010-11-29 03:46:42

标签: ruby-on-rails heroku

这是我的GemFile

source :rubygems
gem 'rails', '2.3.8'
gem 'authlogic', '2.1.6'
gem 'addresslogic', '1.2.1'
gem 'searchlogic', '2.4.19'
gem 'subdomain-fu', '0.5.4'

但是,当我在heroku上运行应用程序时,我得到“App Crashed”

并且日志说我只安装了rails,我需要上面列出的非rails gems。

我做错了什么?

从heroku推送输出

     % git push heroku master
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 860 bytes, done.
Total 6 (delta 3), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> WARNING: Detected Rails is not declared in either .gems or Gemfile
       Scheduling the install of Rails 2.3.8.
       See http://docs.heroku.com/gems for details on specifying gems.

-----> Installing gem rails 2.3.8 from http://rubygems.org
       Successfully installed activesupport-2.3.8
       Successfully installed activerecord-2.3.8
       Successfully installed rack-1.1.0
       Successfully installed actionpack-2.3.8
       Successfully installed actionmailer-2.3.8
       Successfully installed activeresource-2.3.8
       Successfully installed rails-2.3.8
       7 gems installed

       Compiled slug size is 11.7MB
-----> Launching.... done
       http://%%%%%%%%%%%%%%%%%%%.heroku.com deployed to Heroku

To git@heroku.%%%%%%%%%%%%%%%%%%%.git
   3ac597d..b849480  master -> master

heroku log

==> dyno-3334279.log <==
Missing these required gems:
  authlogic  
  addresslogic  
  searchlogic  

You're running:
  ruby 1.8.7.253 at /usr/ruby1.8.7/bin/ruby
  rubygems 1.3.7 at /home/slugs/362612_b849480_24ac-7763f7d7-8c04-478b-ab13-af81efd3e8c2/mnt/.bundle/gems/ruby/1.8, /home/slugs/362612_b849480_24ac-7763f7d7-8c04-478b-ab13-af81efd3e8c2/mnt/.bundle/gems, /home/slugs/362612_b849480_24ac-7763f7d7-8c04-478b-ab13-af81efd3e8c2/mnt/.gems, /usr/ruby1.8.7/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

==> production.log <==
# Logfile created on Sun Nov 28 19:41:39 -0800 2010

2 个答案:

答案 0 :(得分:3)

如果您的存储库根目录中有一个名为Gemfile的文件(在这个确切的情况下/拼写中),Heroku将使用此文件来确定要安装的所有宝石。

你提到你有一个GemFile - 如果这就是你的存储库中文件名的方式,Heroku可能不会选择它。

答案 1 :(得分:0)

您应该在应用程序根目录中创建一个名为.gems的文件。该文件应包含您需要的gem列表,定义gem依赖项的语法如下:

rails --version 2.3.8
authlogic --version 2.1.6

等...