# Version Control (and gems)

**URL:** <https://www.ruby-forum.com/t/version-control-and-gems/134864>\
**Category:** Rails\
**Created:** [April 15, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/version-control-and-gems/134864 "2008-04-15T19:15:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![namealreadytaken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/97f17d/32.png) [@namealreadytaken](https://www.ruby-forum.com/u/namealreadytaken)\
**Post date:** [April 15, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/version-control-and-gems/134864/1 "2008-04-15T19:15:57Z")

</div>

1. Full version control of a web app would include the constellation  
of gems actually used. I can do ‘gem list’ and put that into a file  
in version control but that could include unused gems. That is, it  
could include gems use by other projects.

And putting the whole gem in version control seem like overkill since  
the authors do that. But it might be safer.

Do we have a utility that will generate a script to re-fetch the gems  
at the exact version numbers I’m using now?

I can easily put plugins in the VC system, but gems are in a different  
place. I suppose I could create some sort of link from my working  
directory to GEM\_HOME or even to the places on GEM\_PATH but that seems  
like a pain.

QUESTION: So what are the best practices for version control and  
gems?

And does the answer change if I use git instead of svn?  
(And is one really better than the other for rails projects?)

F

---

<div class="post-metadata">

**Author:** ![namealreadytaken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/97f17d/32.png) [@namealreadytaken](https://www.ruby-forum.com/u/namealreadytaken)\
**Post date:** [April 15, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/version-control-and-gems/134864/2 "2008-04-15T19:25:00Z")

</div>

On 15 Apr 2008, at 18:14, fredistic wrote:

> at the exact version numbers I’m using now?

Edge rails has this. You define in your config which gems (possibly  
locking it to a particular version) and then there’s a rake task to go  
get them all.

Fred

---

<div class="post-metadata">

**Author:** ![namealreadytaken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/97f17d/32.png) [@namealreadytaken](https://www.ruby-forum.com/u/namealreadytaken)\
**Post date:** [April 15, 2008, 8:18pm UTC](https://www.ruby-forum.com/t/version-control-and-gems/134864/3 "2008-04-15T20:18:41Z")

</div>

Oh wow. Way cool.

And the rake task puts them in $GEM\_HOME or do you specify on the  
command line? Or does it just go to the ‘regular place’ ruby gem  
directory only? The version numbers should protect us, I know, but  
sometimes it pays to be paranoid.

There’s a $GEM\_PATH variable we can use to tell ruby where to look for  
gems. If I was re-creating an older version of some app from version  
control I might not want that old gem in the regular place. I’d put  
it someplace special and use $GEM\_PATH or $GEM\_HOME.

On the other hand I might have reverted to an older version of Ruby so  
the ‘regular place’ might be just right.

F

P.S. While mineral gems might be more valuable when old, software  
gems often are not…

---

<div class="post-metadata">

**Author:** ![namealreadytaken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/97f17d/32.png) [@namealreadytaken](https://www.ruby-forum.com/u/namealreadytaken)\
**Post date:** [April 15, 2008, 9:12pm UTC](https://www.ruby-forum.com/t/version-control-and-gems/134864/4 "2008-04-15T21:12:57Z")

</div>

On 15 Apr 2008, at 19:17, fredistic wrote:

> Oh wow. Way cool.
> 
> And the rake task puts them in $GEM\_HOME or do you specify on the  
> command line? Or does it just go to the ‘regular place’ ruby gem  
> directory only? The version numbers should protect us, I know, but  
> sometimes it pays to be paranoid.

don’t know off the top of my head I’m afraid.

Fred

---

<div class="post-metadata">

**Author:** ![namealreadytaken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/97f17d/32.png) [@namealreadytaken](https://www.ruby-forum.com/u/namealreadytaken)\
**Post date:** [April 16, 2008, 6:43am UTC](https://www.ruby-forum.com/t/version-control-and-gems/134864/5 "2008-04-16T06:43:59Z")

</div>

You could create a rake tasks which downloads the right gems with right  
versions. And there is a gem command to ‘load a certain version’ of  
them, too.

Fred T. wrote:

> 1. Full version control of a web app would include the constellation  
> of gems actually used. I can do ‘gem list’ and put that into a file  
> in version control but that could include unused gems. That is, it  
> could include gems use by other projects.
> 
> And putting the whole gem in version control seem like overkill since  
> the authors do that. But it might be safer.
