Other Pages

Expand All

windows.step

message <<-MARKDOWN
These instructions should work for all versions of Windows from XP to Windows 8.

You may need to login as Administrator, or give the Administrator password when installing some programs, depending on your Windows version and user settings.
MARKDOWN

step "Run RailsInstaller" do
  message "RailsInstaller includes Rails, Ruby, Git and SQLite."
  message "Go to <http://railsinstaller.org/>, scroll to the 'Downloads' section, and download the RailsInstaller for Windows/Ruby #{version_string(:ruby_short)}."
  message "Click on the downloaded file to run the install wizard.  Click Next at each step to accept the defaults."
  message "Be sure to check the boxes for *Install git (recommended)* and  *Add executables for Ruby, DevKit Git (if checked above) to the PATH*"

  img src: "img/WinRailsInstaller.jpg", alt: "Screenshot showing location of checkboxes for ensuring that Git is installed"

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

step "Configure your git and ssh environment" do

  important "At the end of the installer there will be a checkbox asking 'Configure git and ssh when installation has completed'. **Leave this box checked.** It will open a terminal window that you need to **type into**."

  message "When it asks *Please enter your name, for example mine is: Wayne E. Seguin*"
  message "Type *your actual full name* into the console and press **[enter]**"

  message "When it asks *Please enter your email address, for example mine is: wayneeseguin@gmail.com*"
  message "Type *your actual email address* into the console and press **[enter]**"

  important "Use the **same email address** for heroku, git, github, and ssh."

  tip do
    message "After this step you will have some **git config settings** and you will also have an **ssh key**."
  end

  message "Here is a summary of your settings after this process:"

  img src: 'img/railsbridge_windowsScreenshot-commandprompt_ror.png', alt: "Screenshot showing correct git, ruby, rails and ssh settings"

  message "Close the command prompt window."
end

step "Update Git" do

  message "The version of Git that comes with RailsInstaller is old, so we will be updating that next."

  message "Go to <http://git-scm.com> and download the installer. You want version 1.9.5 or newer."

  message "Run the installer, and it will ask you where you want to install it. Change it FROM C:\\Program Files\\Git  TO, C:\\RailsInstaller\\Git like the picture below."

  img src: 'img/directory.png', alt: "Screenshot showing the step of installation where the location to install git is set"

  message "It will warn you that the directory already exists. Click yes to install to that folder anyway."

  message "Keep going using the default selections and you'll have the latest version of Git installed!"

end

step "Open a Terminal" do
  message "Much of using Rails is typing commands and hitting **[enter]**.  Your experience using Rails on Windows greatly depends on your making friends with the terminal window.  Normally you will work in a terminal window and keep it open along with your browser."

  tip "The Terminal is also called the Command Prompt, Command Line, DOS Prompt, or DOS Window."

  message "RailsInstaller made a special Terminal for you to use when you're working on Ruby, Rails, or Git."

  message "To open the special Terminal, search for **Command Prompt with Ruby and Rails**."

  div do
    option_half "Windows 7" do
      img src: 'img/railsbridge_windows_findingCommandPrompt_win7.png', alt: "Screenshot showing search for command prompt"
    end

    option_half "Windows 8" do
      img src: 'img/railsbridge_windows_findingCommandPrompt_win8.png', alt: "Screenshot showing search for command prompt"
    end
  end

  message "You should do all your Rails work in this RailsInstaller DOS window."

  tip "Pin It to Win It" do
    message 'Pinning the Command Prompt to the taskbar is a handy shortcut.'

    img src: 'img/railsbridge_windowsScreenshot-commandprompt-pinnedtotaskbar.png', alt: 'Pin the Command Prompt to the Task Bar'
  end
end

step "Update RubyGems" do
  message "The version of RubyGems that comes with RailsInstaller may be outdated. Follow these steps to upgrade it!"

  step "Check to see if you need to update" do
    console "gem -v"

    message "If the output is **#{version_string(:windows_rubygems_min)}** or later, <a href='#install-node'>skip to the next step!</a>"
  end

  step "Install the latest version of RubyGems" do
    message "Otherwise, run the following command:"

    console_without_message "gem update --system --no-document"

    message "**Close and reopen your command prompt**, then verify you have the upgraded RubyGems by typing this in the terminal:"

    console_without_message "gem -v"
    fuzzy_result "#{version_string(:windows_rubygems_min_short)}{FUZZY}.9{/FUZZY}"

    message "As long as the version is at least **#{version_string(:windows_rubygems_min)}**, you should be fine!"
  end
end

a name: 'install-node'
step "Install Node.js" do

  message "Go to <http://nodejs.org> and download the installer. Pick the one that is \"recommended for most users.\""

  message "Click on the downloaded file to run the install wizard. Click Next at each step to accept the defaults."

  message "**Reboot your computer.**"

  message "Once your computer is back up, load **Command Prompt with Ruby and Rails** and..."

  console "node -v"
  fuzzy_result "v6{FUZZY}.x.x{/FUZZY}"
end

step "Update Rails" do
  message "Currently, RailsInstaller installs Rails 4.1.x, but we want the latest. Upgrading Rails is pretty easy:"

  console "gem install rails --no-document"

  message "...and you're done. New Rails! Woo."
end

step "Sanity Check" do

  console "ruby -v"
  fuzzy_result "ruby #{version_string(:ruby_short)}{FUZZY}.4{/FUZZY}"

  console "rails -v"
  fuzzy_result "Rails 5.0{FUZZY}.x{/FUZZY}"

  console "git --version"
  fuzzy_result "git version 2{FUZZY}.9.2.windows.1{/FUZZY}"
end

step "Configure the Windows Terminal" do
  message "Take a moment to configure the *Command Prompt with Ruby and Rails* so that it is a good height and width and has a nice font."

  message "Right-click on the menu bar and select **Properties**"

  message "Under the *Font* tab, select Lucida Console from the font chooser box. This lets you view non-ascii characters."

  message "In the *Layout* tab, adjust *Window Size* so the window is about half as wide as your screen, and is as tall as possible without covering the task bar (this may require some trial and error)."

  message "Click OK."

  tip "Clearing the Terminal" do
    message "If you ever want to clear the terminal of all its cluttered output"
    console "cls"
  end

  tip "Command History" do
    message "The terminal window stores a \"command history.\" To view and re-run previous commands, use the &lt;up arrow&gt; and &lt;down arrow&gt; keys.  You can also edit a previous command and run it -- this is handy for long commands, or fixing mistakes, or for cycles (series of commands) that you repeat."
  end

  tip "Copy and Paste" do

    message "It's usually better to type commands in yourself. It takes a little longer but you learn more."

    message "But if you must... in these instructions, where it says: \"Type this in the terminal:\", you can usually copy the command from this page, and right click in the menu bar or terminal window, then click on \"Paste\", then hit the **[enter]** key."
  end
end

step "Install a Text Editor" do
  message "You need a text editor to do Ruby. If you already have a preferred text editor, such as vi, emacs, jedit, etc., you can skip this step. It must be a plain text editor and not something with styling like Microsoft Word or WordPad."

  message "Notepad is not a good programming editor, but it will work in a pinch."

  important "**When in doubt, use Atom.**"

  message "[Atom](https://atom.io) is a good option, if you don't have one yet."

  message "Download Atom here: <https://atom.io/download/windows>"
end

next_step "create_a_heroku_account"