Forum: Ruby on Rails git-rails init can't find HOME environment

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
(Guest)
on 2009-04-25 03:40
(Received via mailing list)
I'm trying to teach myself version control using GIT on a Windows
machine for my ROR development. I downloaded and ran the cygwin and it
created the following files:
'./.bashrc' -> '/home/Wayne//.bashrc'
'./.bach_profile' -> '/home/Wayne//.bash_profile'
'./.inputrc' -> '/home/Wayne//.inputrc'

Wayne@Gateway ~
$

I also installed the gem git-rails

I've created a project and did a cd to that project.

Now when I run get-rails init I receive what looks like an error
finding my HOME path as follows:

                C:/ruby/lib/ruby/gems/1.8/gems/git-rails-0.2.1/bin/git-
rails:12:in `expand_path': couldn't find HOME        environment --
expanding `~' (ArgumentError)
  from C:/ruby/lib/ruby/gems/1.8/gems/git-rails-0.2.1/bin/git-rails:12
  from C:/ruby/bin/git-rails:19:in `load'
  from C:/ruby/bin/git-rails:19

Any ideas?
7stud -. (Guest)
on 2009-04-25 04:38
removed_email_address@domain.invalid wrote:
> I'm trying to teach myself version control using GIT on a Windows
> machine for my ROR development. I downloaded and ran the cygwin and it
> created the following files:
> './.bashrc' -> '/home/Wayne//.bashrc'
> './.bach_profile' -> '/home/Wayne//.bash_profile'
> './.inputrc' -> '/home/Wayne//.inputrc'
>
> Wayne@Gateway ~
> $
>
> I also installed the gem git-rails
>
> I've created a project and did a cd to that project.
>
> Now when I run get-rails init I receive what looks like an error
> finding my HOME path as follows:
>
>                 C:/ruby/lib/ruby/gems/1.8/gems/git-rails-0.2.1/bin/git-
> rails:12:in `expand_path': couldn't find HOME        environment --
> expanding `~' (ArgumentError)
>   from C:/ruby/lib/ruby/gems/1.8/gems/git-rails-0.2.1/bin/git-rails:12
>   from C:/ruby/bin/git-rails:19:in `load'
>   from C:/ruby/bin/git-rails:19
>
> Any ideas?


There doesn't seem to be much information about the git-rails gem on
google.  That fact alone would have persuaded me to go a different
route.

Why not actually download and install git?  I am in the same position as
you: I am learing git(as of 3 days ago) but on a mac.  But you installed
cygwin, so that means you should have a unix like environment to work
with, and we should be in the same boat.

I downloaded git itself and installed it.  I used this tutorial to
start:

Starting with git using just 10 commands (I'm only using 5 so far)
http://blog.xkoder.com/2008/08/13/git-tutorial-sta...

But it was hard to find a tutorial that actually tells you how to
rollback to a previous version of your code.  This one does:

http://www-cs-students.stanford.edu/~blynn/gitmagi...

(see section Advanced Undo/Redo--I'm not sure why it's titled "Advanced"
since it's so basic.)
7stud -. (Guest)
on 2009-04-25 04:49
removed_email_address@domain.invalid wrote:
> Now when I run get-rails init I receive what looks like an error
> finding my HOME path as follows:
>
>                 C:/ruby/lib/ruby/gems/1.8/gems/git-rails-0.2.1/bin/git-
> rails:12:in `expand_path': couldn't find HOME        environment --
> expanding `~' (ArgumentError)
>   from C:/ruby/lib/ruby/gems/1.8/gems/git-rails-0.2.1/bin/git-rails:12
>   from C:/ruby/bin/git-rails:19:in `load'
>   from C:/ruby/bin/git-rails:19
>
> Any ideas?

Oh, yeah.  In unix, the '~' is shorthand for your the directory your
account has been assigned to, e.g.

/Users/joe blow

So whenever you want to use that path, you can use '~' instead of typing
that out by hand.  That path is also the value of the $HOME environment
variable on my computer.  Maybe when you write "~", unix substitutes in
the value of $HOME.   The error message indicates that the gem is using
"~" in its code somewhere, and that it couldn't find $HOME to substitute
in a path for '~'.  To check if an environment variable is set in
cygwin, do this:

<some prompt here> $HOME

...that is type $HOME after your prompt in cygwin.  I get this result:

~/2testing/dir1$ $HOME
-bash: /Users/myname: is a directory

To see all the environment variables that are set, do this:

<some prompt here> set
7stud -. (Guest)
on 2009-04-25 04:52
7stud -- wrote:
> To check if an environment variable is set in
> cygwin, do this:
>
> <some prompt here> $HOME
>

That should read:

> To check if the $HOME environment variable is set, do this:

> <some prompt here> $HOME
7stud -. (Guest)
on 2009-04-25 05:00
And another thing...

To permanently set an environment variable for bash, set the environment
variable in the .bash_profile file:


HOME="/home/Wayne"


You might also want to add a comment to any change you make to
.bash_profile, so that in the future you will know why you made the
change that you did.  Comments are preceded by: #

Spaces are not superfluous, so write the assignment exactly as written
above.
This topic is locked and can not be replied to.