user1971506
user1971506

Reputation: 2335

Where did "Command Prompt with Ruby on Rails" come from and why does it keep creating a "sites" folder?

So we understand, I use Windows 7.

I've been fighting my way through ruby.railstutorial.org/ruby-on-rails-tutorial-book, but I seemed to have split my command prompts. Originally, I installed Rails based on the instructions from here: http://railsinstaller.org/windows (this was where guides.rubyonrails sent here). I didn't notice it until much later, but it seems I created a Command Prompt called "Command Prompt with Ruby on Rails" after following the instructions there.

Now, throughout the rest of RonR tutorial at guides.rubyonrails, I have been using my REGULAR Command Prompt. Meanwhile, I have been running into a lot of strange problems, such as:

As a final note, "Command Prompt with Ruby on Rails" always seems to launch from C:\Sites> ( this was the location of my original "demo app" when I installed Rails from railsinstaller.org/windows). However, even if I try deleting \Sites, if I reopen the "Command Prompt with Ruby on Rails", it magically recreates \Sites.

Upvotes: 2

Views: 5167

Answers (2)

byang223
byang223

Reputation: 105

The RoR command prompt is just a short cut to cmd.exe with some modifications. You can see this if you right-click and select properties on the RoR command prompt.

If you want to change the starting location, go to the following location (may be different depending on where you directed the RailsInstaller to set up Ruby and Rails):

C:\RailsInstaller\Ruby1.9.3\setup_environment.bat

And add the following line to the end (insert your own path).

CD *PATHTOYOURFOLDER*

However, this is a quick fix and will still create the Sites folder. You can further modify the batch file to avoid creating the unnecessary directory.

Upvotes: 1

Jim Deville
Jim Deville

Reputation: 10662

The RoR command prompt is just a shortcut to CMD.exe with the initial working directory set to c:\sites, and the %PATH% setup to include your gems and ruby (I guess it could be a custom shortcut, or a batch file to set things up, or an EXE that does the equivalent). It might also be an administrator prompt that has write access to the Ruby install path. It is probably re-creating your directory as it writes some file, perhaps a log, cache, or settings related to 'last time this was run'.

If it is a shortcut or batch file, you should be able to edit it to change the starting location. The errors you are getting are probably due to not having the right %PATH% and permissions.

Upvotes: 2

Related Questions