Ruby on Rails Thursday, September 29, 2011

On Sep 29, 2011, at 6:43 PM, Peter Vandenabeele wrote:
On Thu, Sep 29, 2011 at 11:09 PM, Rob Biedenharn <Rob@agileconsultingllc.com> wrote:

On Sep 29, 2011, at 5:00 PM, Barney wrote:

On Sep 29, 2:30 pm, Rob Biedenharn <R...@AgileConsultingLLC.com>
wrote:
On Sep 29, 2011, at 1:16 PM, Barney wrote:

Hi All,
   In trying to port a working version from one computer to another
I had installed the requisites and copied over the files in the rails
project.  However one method wouldn't work and it was because the gem
involved wouldn't work with the newest rails.  After uninstalling
rails, reinstalling an earlier version and playing with DevKit, et.
al., I've managed to fubar the project so that now it even claims it
can't find rubygems.  So I'm inclined to uninstall gems, the devkit
and rails and then copy over the code again, essentially starting
over.
Question 1) what is the proper method of uninstalling those 3?
Question 2) What is the function of the file "Gemfile.lock".  Should
it be copied over or will it be generated?
   Thanks,
        Barney

Let me answer your 2nd question first.  The Gemfile.lock specifies the
versions of each gem that were selected to satisfy the dependency
graph. You should copy it over (actually, you should check it into the
repository; you are using a code repository, right?) and then a bundle
install will use those versions.  Without Gemfile.lock, it builds a
new dependency graph, either with gems it finds or gems that it
installs, and constructs a new Gemfile.lock with the results.

You can also run `bundle package` to put all the .gem files into
vendor/cache/ (by default) which can also be kept in the repository.

Copy the Gemfile.lock over and see if `bundle install` doesn't just
solve your problem.

-Rob

Rob Biedenharn
R...@AgileConsultingLLC.com      http://AgileConsultingLLC.com/
r...@GaslightSoftware.com        http://GaslightSoftware.com/

Thanks, Rob.  I'll copy over my original tomorrow morning.
Is there anything special I have to know if I still need to start over
(in terms of being careful to delete certain things that uninstall
didn't uninstall, etc.)?
   Barney

The bundle install will very likely be all you need.  It will install additional versions of gems if the one that you got originally on the new machine is different. Then you will almost certainly want to use `bundle install _cmd_` whenever you run a _cmd_ that needs gems to be sure that you're getting the right version(s).

I presume this last sentence has a typo. I presume you intended to say ... " use `bundle exec _cmd_` whenever " ...

Like this:

$ bundle install rake environment  # probably incorrect
"install" was called incorrectly. Call as "bundle install".
$ bundle exec rake environment # this is you first test that should pass

HTH,

Peter

Ah, yes. Thank you for catching that, Peter.
-Rob


-Rob

--
Peter Vandenabeele
gsm: +32-478-27.40.69
e-mail: peter@vandenabeele.com
http://twitter.com/peter_v

No comments:

Post a Comment