You are on page 1of 6

Calgary Rails Workshop Windows Rails Installation About This Page

This is a slightly modified versions of the installation guide at DevChix wiki: http://www.wiki.devchix.com/index.php?title=WindowsInstaller_-_Rails_3

About Rails on Windows
● ● These instructions should work for all versions of Windows from XP on to Windows 7. You may need to login as Administrator, or give the Administrator password when installing some programs, depending on your Windows version and user settings.

Install Rails
● ● Go to http://railsinstaller.org/ and download the kit. This kit includes Rails, Ruby, DevKit, Git, and SQLite. Click on the downloaded file to run the install wizard. Click Next at each step to accept the defaults. ○ Be sure to check the box for "Add executables for Ruby, Git and DevKit to the PATH"

Rails will be installed in C:\RailsInstaller and the directory for your Rails projects will be C:\Sites

● Test your Rails install in the command prompt using the -v version flag rails -v You should see something like Rails 3. MS-DOS or DOS window. Follow these instructions if you need to open a normal DOS window: Opening a command prompt window ● Rails Installer made a special DOS command prompt window for you to use when you're working on Ruby. command-line window.9. Normally you will work in a command prompt window and keep it open along with your browser. RailsInstaller. then choose "RailsInstaller" and then "Command Prompt with Ruby and Rails". choose "Programs" on the Start menu." To view and re-run previous commands.3 Open a Command Prompt Much of using Rails is typing commands and hitting <enter>. it will ask you to enter your name and email address. test your Ruby install in the command prompt using the -v version flag ruby -v You should see something like ruby 1. Tip: copy and paste ● ● . You can also edit a previous command and run it--this is handy for long commands. go to Programs. type: cls ● Tip: command history ○ The command prompt window stores a "command history.. After doing this.2p.● ● From the Windows Start menu. ● This is also called the command prompt. use the <up arrow> and <down arrow> keys. or Git. Command Prompt with Ruby and Rails The first time you run this program. Rails. Your experience using Rails on Windows greatly depends on your making friends with the command prompt window. You should do all your Rails work in this RailsInstaller DOS window. ● Try these recommendations: Recommended setup for command-line windows ● Tip: clear screen ○ If you ever want to clear the "output history" to get a clear screen. command window. or fixing mistakes.1.. To open the special Rails window.

as in a work laptop." Enter "SQLite" (without the quotes) in the box and hit enter. ● ● ● Install Editor You can use any editor of your choice.5. open Firefox and go to Tools -> Add-ons. install Firefox." In the Add-ons windows. and right click in the menu bar or command prompt window. or it's an older version.SQLite only has one L..) Wait for the countdown. Hit enter again to accept blank passphrase (or enter passphrase again). Install SQLite Manager ● ● ● ● ● If you already have Firefox installed. click "Get Add-ons. ● Be sure to use the same e-mail address that you used when you set up Git." Go to the Tools menu and verify that there is an option for SQLite Manager. Once it's installed. then click on "Paste"." Once Firefox restarts. Create an ssh public key You'll need one of these to create your Heroku account in the next section. Also. SQLite Manager should be the top result. then hit the <enter> key. check the spelling . Output of ssh-keygen command Your brand-new public key is now stored at YOUR_HOME_DIRECTORY/. At the top of the add-ons window. Sublime Text is an elegant Windows editor. RailsInstaller.ssh/ id_rsa. verify that it is version 3. much more easily. ● open up Program Files. copy the command from this page. then click "Install Now. you can." (If SQLite Manager isn't in the results. (Help -> About Mozilla Firefox. $ ssh-keygen -C "Your Actual Email" -t rsa (email should match git config setting) ● Hit enter to accept blank passphrase (if computer is shared with other people.13 or greater. Click "Add to Firefox. ● ● . The version number is right under the "Firefox" title.) If you don't have Firefox installed.. where it says: "In the command prompt type:".○ In the instructions below." There will be search box directly underneath "Get Add-ons" that says "Search All Addons.6.pub. click "Restart Firefox. Command Prompt with Ruby and Rails. check that you have at least Firefox 3. the Add-ons window should say "1 new add-on has been installed. you should enter a passphrase). Your could also use Notepad++.

If "rails server" starts up with no errors.4.com -> Sign Up -> enter email address (use the same email as you did with git and the ssh public key). Hit Save.1 [2010-09-30 21:04:12] INFO ruby 1.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-09-30 21:04:12] INFO WEBrick 1. It will take you to the Heroku site. type control-c to kill(stop) the server.) In your browser. cd test_app . Open it and click on the activation link. type the following in the Command Prompt with Ruby and Rails window with a return at the end of each line: cd test_app rails server ● The first command should produce no output.2 (2010-08-18) [x86_64-darwin10. If you have further heroku issues. you're golden! It'll look something like this: => Booting WEBrick => Rails 3.0] [2010-09-30 21:04:12] INFO WEBrick::HTTPServer#start: pid=24805 port=3000 ● ● ● If it does.3.9. ● ● Verify your database is set up ● Open a Command Prompt with Ruby and Rails window. go to http://localhost:3000 (screenshot of successful install) Back in the Command Prompt with Ruby and Rails window where you ran rails server. Enter and confirm your password. Verify you can create a new Rails app ● Open a Command Prompt with Ruby and Rails window and type the following with a return at the end of the line: rails new test_app The command's output is voluminous. (Here are some more diagnostics to try if it's not so smooth.0. Heroku will send you an activation email.0.0. :) Once that's finished. try following these directions to install (or reinstall) the client.Create a Heroku Account ● ● ● http://heroku.0 application starting in development on http://0. congratulations! You've successfully installed Ruby AND Rails and started your server.

) ○ git commit -m "initial commit" (Output of initial check-in) ○ git log (We're just checking to make sure it worked. (Note the dot) (May get line ending warnings. Verify git is working ● ● Open a command Prompt with Ruby and Rails window. type: git remote show and see if the list includes heroku. (The window where you ran rails server will display debugging information as you do so.) In your Command Prompt with Ruby and Rails window where you ran rails server. ● .) Verify Heroku is set up Install the heroku client: gem install heroku ● Create your Heroku app like this: heroku create --stack cedar ● Enter your Heroku email address and password. safe to ignore.git/ ● Type the following commands: ○ git add . Type the following commands: cd test_app git init This should generate output similar to: Initialized empty Git repository in c:/Sites/test_app/. visit http://localhost:3000/users Click New user to create a user to make sure we can save to the database. type control-c to kill(stop) the server.rails generate scaffold user name:string email:string address:text active:boolean rake db:migrate rails server ● ● ● In the browser. Call a volunteer over to help you figure it out. Verify that it has the right user and commit message. (Output of heroku create command) ● To verify that the heroku create completed successfully. Luckily this only needs to be done the first time you create a Heroku app. ● If you get messages here complaining about public keys it's probably due to some confusion with SSH key usage by another app on your computer.

101. it would be floating-winter-18.com . ● Output of successful first deploy. $ git commit -m "Updates for heroku deployment" $ git push heroku master ● It may ask: "The authenticity of host 'heroku. go to your application's URL. RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.com (75. ● Create a new user to verify you can write to the db on Heroku. :test do gem 'sqlite3' end group :production do gem 'pg' end Prepare your rails app for deploying to Heroku $ bundle install --without production Add the changes to git repository and push to heroku $ git add . Verify you see the user list page.heroku. ● In the browser.so with the example output in the previous step.com. Verify you see the welcome page.heroku.87)' can't be established. Leave this browser window open. Are you sure you want to continue connecting (yes/no)?" Type yes and hit <enter>. Be sure to find your Heroku application name in the output.Edit your Gemfile and change the line: gem 'sqlite3' To this: group :development. The URL for your app is application name. add /users to the end of the URL. (What to do if git seems stuck) ● In the Command Prompt with Ruby and Rails window type: heroku rake db:migrate (Output of heroku rake db:migrate) ● In the browser. You'll need your Heroku application name.145. ● ● .