0

我需要将 rails_12factor gem 安装到我的应用程序的 gem 文件中,以便成功部署到 Heroku。我能够安装 gem (gem install rails_12factor),如果我运行 gem list 它显示它是在本地安装的。如何将特定的 gem 安装到我的包中?不确定我问的是否正确,但正如您在下面看到的,它是在本地安装的,正如我所说。

4.0.0)
actionpack (4.0.1, 4.0.0)
activemodel (4.0.1, 4.0.0)
activerecord (4.0.1, 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.1, 4.0.0)
addressable (2.3.5)
arel (4.0.1)
atomic (1.1.14)
bigdecimal (1.2.3, 1.2.0)
builder (3.2.2, 3.1.4)
bundler (1.3.5)
coffee-rails (4.0.1)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
erubis (2.7.0)
excon (0.30.0, 0.25.3)
execjs (2.0.2)
heroku-api (0.3.15)
hike (1.2.3)
i18n (0.6.5)
io-console (0.4.2)
jbuilder (1.5.2)
jquery-rails (3.0.4)
json (1.8.1, 1.7.7)
launchy (2.4.2, 2.4.1)
mail (2.5.4)
mime-types (2.0, 1.25.1, 1.25)
minitest (5.0.8, 4.7.5, 4.3.2)
multi_json (1.8.2)
mysql2 (0.3.14)
netrc (0.7.7)
pg (0.17.0 x86-mingw32)
polyglot (0.3.3)
psych (2.0.2, 2.0.0)
rack (1.5.2)
rack-test (0.6.2)
rails (4.0.1, 4.0.0)
**rails_12factor (0.0.2)
rails_serve_static_assets (0.0.1)
rails_stdout_logging (0.0.3)**
railties (4.0.1, 4.0.0)
rake (10.1.0, 0.9.6)
rdoc (4.0.1, 4.0.0, 3.12.2)
rest-client (1.6.7)
rubygems-update (2.1.11)
rubyzip (1.1.0)
sass (3.2.12)
sass-rails (4.0.1)
sdoc (0.3.20)
sprockets (2.10.1)
sprockets-rails (2.0.1)
sqlite3 (1.3.8 x86-mingw32)
test-unit (2.5.5, 2.0.0.0)
thor (0.18.1)
thread_safe (0.1.3)
tilt (1.4.1)
treetop (1.4.15)
turbolinks (1.3.1)
tzinfo (1.1.0, 0.3.38)
uglifier (2.3.1)

However it is not in my bundle below:

c:\dev\project2>bundle

Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.1)
Using hike (1.2.3)
Using jbuilder (1.5.2)
Using jquery-rails (3.0.4)
Using json (1.8.1)
Using mysql2 (0.3.14)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.1)
Using sprockets-rails (2.0.1)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.1)
Using sdoc (0.3.20)
Using turbolinks (1.3.1)
Using uglifier (2.3.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

我能够在此路径 C:\Users\vern.gem\specs\rubygems.org%443\quick\Marshal.4.8 中找到 rails_12factor-0.02.gemspec

我注意到它是一个 gem 规范文件,但是我不知道如何将它安装为我的项目的 gem 包的一部分

以下是我推送到heroku时得到的结果:

c:\dev\project2>git push heroku master
Enter passphrase for key '/c/Users/vern/.ssh/id_rsa':
Counting objects: 87, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (76/76), done.
Writing objects: 100% (87/87), 16.24 KiB | 0 bytes/s, done.
Total 87 (delta 20), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       New app detected loading default bundler cache
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bund
       Fetching gem metadata from https://rubygems.org/...........
       Fetching gem metadata from https://rubygems.org/..
       Resolving dependencies...
       Using rake (10.1.0)
       Using i18n (0.6.5)
       Using minitest (4.7.5)
       Using multi_json (1.8.2)
       Using atomic (1.1.14)
       Using thread_safe (0.1.3)
       Using tzinfo (0.3.38)
       Installing activesupport (4.0.0)
       Using builder (3.1.4)
       Using erubis (2.7.0)
       Using rack (1.5.2)
       Using rack-test (0.6.2)
       Installing actionpack (4.0.0)
       Installing mime-types (1.25.1)
       Using polyglot (0.3.3)
       Using treetop (1.4.15)
       Using mail (2.5.4)
       Installing actionmailer (4.0.0)
       Installing activemodel (4.0.0)
       Using activerecord-deprecated_finders (1.0.3)
       Using arel (4.0.1)
       Installing activerecord (4.0.0)
       Using bundler (1.3.2)
       Using coffee-script-source (1.6.3)
       Using execjs (2.0.2)
       Using coffee-script (2.2.0)
       Using thor (0.18.1)
       Installing railties (4.0.0)
       Using coffee-rails (4.0.1)
       Using hike (1.2.3)
       Using jbuilder (1.5.2)
       Using jquery-rails (3.0.4)
       Using json (1.8.1)
       Installing mysql2 (0.3.14)
       Using tilt (1.4.1)
       Installing sprockets (2.10.1)
       Using sprockets-rails (2.0.1)
       Installing rails (4.0.0)
       Using rdoc (3.12.2)
       Using sass (3.2.12)
       Using sass-rails (4.0.1)
       Using sdoc (0.3.20)
       Using turbolinks (1.3.1)
       Using uglifier (2.3.1)
       Your bundle is complete! It was installed into ./vendor/bundle
       Bundle completed (17.19s)
       Cleaning up the bundler cache.
       Removing sass-rails (3.2.6)
       Removing kgio (2.8.1)
       Removing tzinfo (0.3.37)
       Removing jbuilder (1.5.1)
       Removing raindrops (0.12.0)
       Removing activerecord (3.2.14)
       Removing builder (3.0.4)
       Removing rails (3.2.14)
       Removing activesupport (3.2.14)
       Removing actionmailer (3.2.14)
       Removing bcrypt-ruby (3.0.1)
       Removing unicorn (4.6.3)
       Removing mime-types (1.25)
       Removing rails_stdout_logging (0.0.2)
       Removing rails_stdout_logging (0.0.3)
       Removing sprockets (2.2.2)
       Removing execjs (2.0.1)
       Removing json (1.8.0)
       Removing rack-ssl (1.3.3)
       Removing rack-cache (1.2)
       Removing puma (2.6.0)
       Removing journey (1.0.4)
       Removing activesupport (4.0.1)
       Removing activemodel (4.0.1)
       Removing activemodel (3.2.14)
       Removing sass (3.2.10)
       Removing nokogiri (1.6.0)
       Removing multi_json (1.8.0)
       Removing actionpack (4.0.1)
       Removing uglifier (2.2.1)
       Removing railties (3.2.14)
       Removing rails (4.0.1)
       Removing arel (3.0.2)
       Removing rails_serve_static_assets (0.0.1)
       Removing rails_12factor (0.0.2)
       Removing activeresource (3.2.14)
       Removing bcrypt-ruby (3.1.2)
       Removing actionmailer (4.0.1)
       Removing sprockets (2.10.0)
       Removing coffee-rails (3.2.2)
       Removing mini_portile (0.5.1)
       Removing activerecord (4.0.1)
       Removing pg (0.17.0)
       Removing rack (1.4.5)
       Removing actionpack (3.2.14)
       Removing railties (4.0.1)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       I, [2013-11-29T23:11:27.829492 #1297]  INFO -- : Writing /tmp/build_55e1f130-6b0f-4106-871a-45
lic/assets/application-fee71c53d09a01d2ff7501990d2c3307.js
       I, [2013-11-29T23:11:27.856160 #1297]  INFO -- : Writing /tmp/build_55e1f130-6b0f-4106-871a-45
lic/assets/application-96a552b03ca0e7ebcbfc44b89ca097a6.css
       Asset precompilation completed (7.77s)
       Cleaning assets
-----> WARNINGS:
       Include 'rails_12factor' gem to enable all platform features
       See https://devcenter.heroku.com/articles/rails-integration-gems for more information.

       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
-----> Discovering process types
       Procfile declares types -> (none)
       Default types for Ruby  -> console, rake, web, worker

-----> Compiled slug size: 21.0MB
-----> Launching... done, v5
       http://fast-lake-6950.herokuapp.com deployed to Heroku

To git@heroku.com:fast-lake-6950.git
 * [new branch]      master -> master

c:\dev\project2>

如您所见,它删除了 rails_12 因素 gem,所以我不太确定该怎么做。我也收到警告

警告:包含“rails_12factor”gem 以启用所有平台功能有关更多信息,请参阅https://devcenter.heroku.com/articles/rails-integration-gems。也许有一个我没有意识到任何帮助的解决方案将不胜感激。谢谢

Ruby 版本 2.0.0 Rails 4.0.0 Windows 7 64 位

4

1 回答 1

0

尝试rails_12factor仅将 gem 投入生产

gem 'rails_12factor', group: :production

因此,这不会在您的开发环境中安装 gem,但会在您的生产环境中安装(当您推送到 heroku 时)。

希望这可以帮助

于 2013-11-30T00:00:59.450 回答