Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

ruby on rails - How do I vendorize gems for Rails3/Bundler

In Rails 2.X, I could simply copy gems into vendor/gems/gem_name, or use the rake command rake gems:unpack. Since Rails3 uses bundler, it doesn't appear to work anymore. I have found the command bundle package, but it doesn't work the same way.

Edit:

So, just to elaborate a bit on this:

The way that rails 2 worked, I could easily grep to find stuff in vendor/gems. If they are bundled up in .gem files, that isn't possible. Also, when developing a gem/plugin, it's very helpful to have it placed within a rails application to test it out in context. How would I do such things with bundler/rails3? Is my workflow inherently broken somehow?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Answering the second part of your question, developing a plugin/gem and shipping it with the rails app without making the gem publicly available, you may do this

Gemfile

gem 'my_private_gem', :path => "vendor/gems/my_private_gem-VERSION"

assuming you performed a gem unpack my_private_gem --target vendor/gems

note: bundle package unpacks all gems (as many as in Gemfile.lock). I wouldn't want those in git.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...