Other Pages

Expand All

getting_started.step

img src: "img/Start_page.png", alt: "Start Page"
goals do
  goal "Create Your New Application"
message "Let's get started! By the end of this step, we'll have a brand-spankin'-new (empty) rails app."
end
steps do
  tip "If you have _any_ problems, contact a TA immediately."
  step do
    insert 'switch_to_home_directory'
  end
  step do
    console "mkdir railsbridge"
    message "This command creates a new directory for us to store our project in."
  end
  step do
    console "cd railsbridge"
  end
  step do
    insert 'check_for_existing_apps'
  end
  step do
    console "rails new suggestotron"
    message "'rails new' creates a new rails project with the name you give."
    message "In this case we told it to create a new project called `suggestotron`. We'll go into detail on what it created shortly."
  end
  step do
    console "cd suggestotron"
    message "'cd' stands for change directory."
    message "'cd suggestotron' makes suggestotron our current directory."
  end
  step do
    message "If you are using a Mac"
    console "ls"
    message "If you are using a PC running Windows"
    console "dir"
    message "'ls' stands for 'list (stuff)'. It shows you the contents of the current folder."
  end
  step do
    message <<-MARKDOWN
Open the suggestotron folder as a project in your text editor.
In **Sublime Text 2**, you can use the `Project > Add Folder to Project...` menu option:
<img src='img/sublime_add_folder_to_project.png' />
Select your `suggestotron` folder from the file picker that opens. If everything works out Sublime should look something like this:
<img src='img/sublime_project_as_folder.png' />
    MARKDOWN
  end
  message <<-MARKDOWN
  You can see that <code>rails new</code> created a lot directories and
  files. The ones we want to focus on today are:
  MARKDOWN
  table border: "1", cellspacing: "0", cellpadding: "3", align: "center" do
    tr {
      th "File/Folder"
      th "Purpose"
    }
    tr {
      td "app/"
      td "Contains the controllers, models, and views for your application.  You will do most of your work here."
    }
    tr {
      td "config/"
      td "Configure your application's runtime rules, routes, database, and more."
    }
    tr {
      td "db/"
      td "Shows your current database schema, as well as the database migrations."
    }
    tr {
      td "public/"
      td "The only folder seen to the world as-is. If you put files in here, they will be served directly without any processing by Rails."
    }
    tr {
      td "app/assets/"
      td "This is where your images, JavaScript, stylesheets (CSS), and other static files should go. Modern rails apps use something called the Assets Pipeline, which combines all the JavaScript and CSS files in this directory into a single file for speediness."
    }
  end
  message "There is a lot more that `rails new` created. Probably enough to fill a book, so we're going to ignore them for now."
end
tip "Great! You've created a brand new (empty) Rails app!" do
  message <<-MARKDOWN
  Why not take a break and stretch your legs?
  MARKDOWN
end
next_step "add_the_project_to_a_git_repo"

If you find something that could be improved, please make a pull request or drop us a note via GitHub Issues (no technical knowledge required).

Source: https://github.com/RailsBridge-CapeTown