How do I freeze gems into a Rails 3 application?

后端 未结 13 2039
遇见更好的自我
遇见更好的自我 2020-12-08 16:30

I want to freeze a specific gem into my Rails application.

In rails 2 there was this command:

rake gems:unpack

I can\'t find that c

13条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 17:23

    I had to do this for typus gem deployment on Heroku as you can't run a heroku rails generate typus on Heroku given it's a read only file system. I didn't want ALL gems put into my app, just the one that was causing me grief. Here are the steps that lead to success:

    1. create directory in app_name/vendor/gems/gem_name (optional) ... in my case /app_name/vendor/gems/typus

    2. add the following to gemfile (this tells bundle where to find and put the gem source):

      gem 'typus', :git => 'https://github.com/fesplugas/typus.git', :path => "vendor/gems/typus"

    3. then from within your app directory (this installs the gem into your app):

      'gem unpack typus --target vendor/gems/typus'

    4. then bundle install

    5. then .. in my case... commit and push to repository and then deploy up to heroku... you may have to run a heroku rake db:migrate

提交回复
热议问题