开发者

In Ruby on Rails, is copying vendor/gems/somegem from one project to another project the same as freezing the gem?

开发者 https://www.devze.com 2023-02-18 15:06 出处:网络
I was told that copying from vendor/gems/somegem from proj1 to proj2\'s folder will essentially freeze the gem into the project.The gem somegem is an internal gem, so there is no repository to ins

I was told that copying from

vendor/gems/somegem

from proj1 to proj2's folder will essentially freeze the gem into the project. The gem somegem is an internal gem, so there is no repository to install it from. But I wonder how will it work w开发者_JAVA技巧ith Rails 3, since we need to use

gem 'somegem'

in the Gemfile, and supposedly when we do a gem list, the name of the gem should show up. What is a good / proper way to do this? thanks.


I believe the Gemfile.lock file stores the versions of the gems in use, along with any and all dependencies, so you can essentially copy over your Gemfile and Gemfile.lock and run bundle install


In your Gemfile you can tell bundler to get the gem from a local path:

gem 'somegem', :path => "some_path/to/somegem"

If your 'gem' is in fact a plugin then just copy the files to vendor/plugins.

If install.rb in the plugin directory does anything special you may want to run this manually.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号