我如何保存整个Rails应用包,包括正在使用的宝石? [英] How can I save whole package of Rails App including gems being used?

查看:98
本文介绍了我如何保存整个Rails应用包,包括正在使用的宝石?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了很多宝石。他们对于彼此的依赖关系非常敏感。

现在,当前的宝石组合非常完美。我想保存这整个应用程序,并在下一个项目时重新使用它。

如您所知,未来将不会保留宝石 ruby​​gem.org

所以我想要保存App和正在使用的宝石的整个包。
然后我不需要关心设置宝石,除非我需要新的宝石。
我需要关心的仅仅是下一个项目的编码。

有人告诉我使用此命令并保存整个应用程序文件夹

  bundle install --path = vendor / bundle 

在此之后,我的应用程序被拧紧:(
jQuery在重新编译之后不再工作了



所以我确实需要用旧的替换整个App文件夹,这是重申 / usr / local / bin / ruby​​ /usr/local/lib/ruby/gems/1.9.1


中的宝石

现在, jQuery 重新编译之后正常工作:)



对于这种情况,我怎样才能保存App和gem的整个包?



我想要做的是,我只有想要设置Ruby的正确版本和MySQL。

然后我想把这个包放入它并开始编码,而不是部署有关gem的环境!!



任何人都可以分享关于这个的想法吗?

解决方案

回答你的问题



Bundler的 捆绑软件包 - 全部 命令会将所有gem文件锁定并缓存到 ./ vendor / cache 中,并且可以运行 bundle install --local <
$ b

对你的问题的评论



这个问题让我感到畏缩,因为虽然我明白有兴趣知道你所熟知的基本形象,但这听起来像是一些问题会蔓延到其他项目。


  1. 负担过重的应用程序


    • 每个项目是否真的需要所有相同的依赖项?

    • 如果不是,那么您每次安装都会产生不需要的依赖项。


  2. 脆弱依赖性


    • 您提到您的依赖关系对彼此非常敏感,这会引发警报。

    • 我不完全了解您的情况n,但听起来你应该考虑使用更稳定的接口来寻找依赖关系。 阅读ruby-toolbox.com并关注Released日期。
    • >

  3. 过时依赖关系


    • 锁定版本意味着您的新应用程序不会受益(例如)如果您将导轨依赖关系锁定到3.2.8并继续使用它,则可以将自己(和客户)打开到几个主要的安全漏洞。
    • / li>
    • (可能的解决方法)查看悲观版本约束以允许您的应用程序接收未修复的修复程序。


祝您好运。

I'm using a lot of gems. They are really sensitive about dependencies each other.
Now, current combination of the gems is just perfect. I want to save this whole App, and re-use this when I'm going on next project.

As you know, the gems are not promised to exist in the future in rubygem.org
So I'd like to save whole package of both App and gems being used. Then I don't need to care about setting up gems unless I need new gem. All I need to care about is just coding in next project.

Someone told me to use this command and save whole App folder

bundle install --path=vendor/bundle

After this, my app got screwed :( jQuery came not to work anymore after recompile

So I did need to replace whole App folder with old one, which was reffering the gem in /usr/local/bin/ruby /usr/local/lib/ruby/gems/1.9.1

Now, jQuery works fine after recompile :)

For this situation, how can I save whole package of both App and gems being used for it?

What I wanna do is, I only want to set up Ruby's correct version and MySQL.
Then I'd like to put this package into it and start coding, not deploying environment about gems!!

Can anyone share idea about this, please?

解决方案

Answer to your question

Bundler's bundle package --all command will lock and cache all of your gem files into ./vendor/cache, and you can run bundle install --local so it won't check rubygems.org in the future.

Comments on your question

This question made me cringe because, while I understand the interest in having a "base image" that you know works, it sounds like a few problems will spill over to other projects.

  1. Overburdened applications
    • Does each project really need all the same dependencies?
    • If not, then you are bloating each install with unneeded dependencies.
  2. Brittle dependencies
    • You mention that your dependencies are very sensitive to each other, which sets off alarms.
    • I don't fully understand what you mean by that, but it sounds like you should consider finding dependencies with more stable interfaces.
    • Check out ruby-toolbox.com and keep an eye on the "Released" date.
  3. Outdated dependencies
    • Locking down versions means your new applications will not benefit from updates by the maintainers.
    • (example) if you locked your rails dependency to 3.2.8 and continue to use it, you open yourself (and customers) to several major security holes.
    • (possible fix) Look at pessimistic version constraints to allow your applications to receive non-breaking fixes.

Best of luck.

这篇关于我如何保存整个Rails应用包,包括正在使用的宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆