A quick update (although this site deserves much more than a quick update)...
What should you do when you cannot run the following command from the shell?
rails -v
Good question - but don't fret. Its a simple answer to what appears to be a disconcerting problem. All of my development and deployment servers up until a few days ago - have all recognized the ruby and rails command from the shell. But just recently on a new setup - I had the pleasure of experiencing this strange situation.
ruby and rails were both installed, but rails -v was not a recognized shell command!
Lucky enough - I have had the pleasure of being a novice system admin for the past 2 years, and as such I realized the command was not in my /usr/bin directory. So where was it, and why wasn't it setup like all the other installs I have done?
I thought perhaps it was a problem with the gem install method - so I then opted to install rails via "sudo apt-get install rails", but to my dismay that also failed to fix the problem.
After a quick locate of the rails gem:
locate rails | less
I discovered that it was sitting inside the following directory: /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/
And inside that directory was the file bin/rails ... so do the following:
sudo cp /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/bin/rails /usr/bin/rails
sudo chmod 755 /usr/bin/rails
Your almost there - next modify the rails script file in /usr/bin to make certain it uses the proper ruby interpreter...
sudo nano /usr/bin/rails
Add the following line to the top of the file (if it doesnt already exist):
#!/usr/bin/ruby1.8
That should fix it... oh yeah, I also ran into the exact same problem when I did a mongrel setup. Same ordeal - copy the mongrel_rails script from the /bin directory of the right gem into your /usr/bin directory. Chmod it, then modify it to add the #!/usr/bin/ruby1.8
If you forget to add the #!/usr/bin/ruby1.8 into your mongrel_rails file, then you will most likely see an error that looks exactly like this:
/usr/bin/mongrel_rails: line 7: require: command not found
/usr/bin/mongrel_rails: line 8: require: command not found
/usr/bin/mongrel_rails: line 9: require: command not found
/usr/bin/mongrel_rails: line 10: require: command not found
/usr/bin/mongrel_rails: line 11: require: command not found
/usr/bin/mongrel_rails: line 12: require: command not found
/usr/bin/mongrel_rails: line 14: module: command not found
/usr/bin/mongrel_rails: line 15: GemPlugin::Plugin: No such file or directory
/usr/bin/mongrel_rails: line 16: include: command not found
/usr/bin/mongrel_rails: line 18: def: command not found
/usr/bin/mongrel_rails: line 19: options: command not found
/usr/bin/mongrel_rails: line 20: [-e,: command not found
/usr/bin/mongrel_rails: line 20: development],: command not found
/usr/bin/mongrel_rails: line 21: [-d,: command not found
etc....
Well, thats it for the quick update - I've been extremely busy as of late, but I haven't given up on RoR. Besides, I like being busy - especially when I'm learning something new \(^-^)/
