Reputation:
There is a github repo I want to fetch code from which isn't a gem. It is a bunch of javascript files, and it has no gem version. Can I add this to the Gemfile and define where it should be stored (under the lib/assets) directory, or will I have to manage this with a git submodule?
Upvotes: 0
Views: 60
Reputation: 55908
Bundler manages gems, not arbitrary repositories. That said, if you just want to use some assets, you can easily package them as a gem to allow them to hock into the assets pipeline. This brings you the upside of allowing you to use all the tools for managing gems as well as proper separation of concerns.
You need to add a rails engine for that. For that simply put your assets into the vendor/assets
directory of the new gem in a directory structure similar to the main assets
directory of your main app. Additionally you need to add a new ruby class into lib/your_gem.rb
with this content:
module MyGem
class Engine < Rails::Engine
end
end
This registers the gem as a rails engine and provides the assets to the assets pipeline.
Finally add a gemspec and you are finished. A basic gem structure can be Also be created by the bundle gem
command.
Upvotes: 1