Share code between rails projects [duplicate]
Possible D开发者_运维问答uplicate:
Can you share a file and it's history between two git repositories?
I have multiple rails projects (in one git), which have some common CSSs, layouts and helpers. My first solution to share those files between the projects was to set up some symlinks, but I'm not totally convinced this is the way to go. Is there some nicer solution, or are symlinks maybe fine after all?
You can use git submodules to split out the common parts.
Check this out: http://railscasts.com/episodes/96-git-on-rails Or: http://git-scm.com/docs/git-submodule
Yes, symlinks is a good way to go, i would probably do that as well.
-1 for symlinking. It'll do the job but not very elegantly. I would rather have a single library (gem) that has all the shared code, which you can use to include only what you need.
You can host them in a separate git repo, and symlink to that. This way, the common files are also managed via git. You could find a neat way to get this to work for deployment as well (capastrino etc, if you use it).
精彩评论