Locked lesson.
About this lesson
Finding our way around the rails directory, text editor, and terminal.
Exercise files
Download this lesson’s exercise file.
The Rails Development Environment Walk-Thru .docx60.1 KB
Quick reference
The Rails Development Environment Walk-Thru
In this video we'll explore the C9.io cloud development environment in detail.
When to use
Get to know your development environment. We'll be spending all of our time there from now on!
Instructions
The first time you look at Ruby on Rails in your cloud development environment, you may be overwhelmed! That's ok! There seems like a ton of stuff there, and it can seem confusing at first; but it's not bad.
In this video I'll walk you through all the important things that you need to be aware of in order to start building our app.
You don't need to understand all of it right now. As we move forward, you'll learn by doing.
Hints & tips
- Files and Directories are listed on the left-hand side of the screen
- The text editor is in the middle of the screen and that's where we'll edit all our files and write our computer code
- The command line terminal is on the bottom of the screen. That's where we'll issue various commands from now on.
- Don't get overwhelmed! There's a lot to take in, but it's not as bad as it seems!
- 00:04 In this video, I want to go through all of these directories and files and
- 00:08 explain what all of these things do.
- 00:11 Because right off the bat, man, it looks complicated.
- 00:14 There is just a lot of stuff here and it's very easy to get overwhelmed.
- 00:19 And the good news is we are not going to be using most of this stuff.
- 00:23 In fact you're never going to use most of this stuff,
- 00:25 you can go most of your career without ever touching some of these directories.
- 00:29 And that's a very good thing because, man, there is a lot of stuff here.
- 00:32 So let us just sort of dive right in here.
- 00:34 Let's just start to the top as click the App directory.
- 00:37 And it expands and you see all of these different things.
- 00:40 Now assets, this is where things like images, JavaScript, and stylesheets go.
- 00:45 We'll use that a little bit.
- 00:46 Controller, remember we talked about controllers in the MVC architecture?
- 00:51 This is where your controllers go.
- 00:53 Helpers we probably won't use.
- 00:54 Mailers we probably won't use.
- 00:57 Models we probably won't use.
- 00:59 Views we will definitely use.
- 01:01 This is where your web pages go.
- 01:03 And we'll see that very soon when we start building out web pages.
- 01:07 So that's the app directory, you'll use the app directory quite a bit.
- 01:10 So sort of get used to it.
- 01:11 Be familiar with what's in here.
- 01:13 The bin directory we probably won't ever use.
- 01:16 The config directory we will definitely use.
- 01:19 Let's see we'll use this Routes file and maybe some others.
- 01:24 So you can look at that.
- 01:24 The database, this is where some of your database stuff goes.
- 01:28 We saw that model directory earlier,
- 01:30 there is also some database stuff that goes there.
- 01:32 And the Lib directory we probably won't use.
- 01:35 The Log directory we probably won't use.
- 01:38 Public we won't use, Test we won't use.
- 01:40 Temp we won't use and Vendor we will not use.
- 01:43 So right off the bat we knocked out a whole lot of these that we're
- 01:46 never ever going to use.
- 01:47 And that's a pretty good thing, starting out especially,
- 01:50 because it's really easy to get overwhelmed by this stuff.
- 01:53 And you shouldn't be, because like I said, it's not as bad as it seems.
- 01:58 The app directory we are going to use and the config directory sometimes,
- 02:01 we'll look at the db directory a little bit.
- 02:04 So, there is one more thing I want to look at and that's this Gem file and
- 02:08 we will use this file a lot.
- 02:10 And take a look at this.
- 02:12 You see all these comments.
- 02:13 The first thing I always do is I go through here and
- 02:15 I delete all the comments just to sort of cleanup this file.
- 02:20 And you'll see why in just a second here.
- 02:24 I'm just highlighting and deleting.
- 02:29 Okay.
- 02:32 All right and to save this file, I'm going to hit Ctlr+S on my computer.
- 02:37 If you're on a Mac, it's Cmd+S I believe.
- 02:39 Or we can go up to this File and click Save, it does the same thing.
- 02:43 Now you can see, here's the file right?
- 02:45 If we click on another one of these, like the readme file it pops up right
- 02:48 next to it, and we can tab around between the two.
- 02:51 Now I get in the habit of opening lots of files and so
- 02:54 I'll have like 20 or 30 of these tabs open, it becomes just a nightmare mess.
- 02:59 It's kind of a good idea from time to time to just close out some of these files.
- 03:03 But, the gem file is something we're going to use,
- 03:05 I'll get into that in a little bit later video when we actually start using it.
- 03:09 But, any time you want to add a third party thing to your rails app,
- 03:13 this is why you do that.
- 03:14 You type it right there, and we'll get in all that later, so let's what else.
- 03:18 We got the directory, we got the text editor, this is the terminal,
- 03:22 I'll talk about this in just a minute.
- 03:24 Like I said this is a Linux terminal, we can issue Linux type commands.
- 03:37 And you see we're in the Workspace directory.
- 03:41 In the Workspace directory is this Pinteresting
- 03:44 top level directory right here.
- 03:46 And you can see, here's this Gemfile, that's this Gemfile right there.
- 03:50 This readme file, that's this readme file right here.
- 03:54 This app directory, that's this app directory.
- 03:57 This config directory that's this.
- 03:59 So you can see the two are related.
- 04:01 This is just a visual representation and this is a terminal representation.
- 04:07 So we generally will just use this directory tree.
- 04:10 If we want to open the gem file we just double click it,
- 04:13 we don't come don't come down here and open, type a command to open it.
- 04:16 But you could, so like I said throughout this course we're going to be using this
- 04:19 terminal for basic things you don't need to know Linux in order to use this.
- 04:23 I'll show you all the commands that you need,
- 04:25 it's very simple, very straightforward.
- 04:27 If you're interested in this sort of thing and you want to go out and
- 04:30 learn more about Linux and the terminal and
- 04:32 command prompts, definitely you can go crazy and do that.
- 04:35 But it's not necessary for this course and that's pretty much it.
- 04:38 It's a very simple setup.
- 04:39 We got all of our files and directories on the left.
- 04:42 We got a text editor in the middle and our terminal down here.
- 04:44 And like I said earlier I'll be using this Cloud9 development environment.
- 04:47 You should continue to use the tools that we've downloaded and
- 04:50 installed at the beginning of the course.
- 04:52 Namely the Sublime editor and the Git Bash terminal.
- 04:54 And as you can see they're very similar.
- 04:57 If I want to open a file and C9 and I click it here and it opens.
- 05:00 On the other hand if you're in your Sublime Text,
- 05:02 same deal you just come to the same file and open it in the exact same way.
- 05:06 And down here like if we have a command, pwd for instance.
- 05:11 You do the exact same command in your git bash terminal, just make sure you're in
- 05:16 the c/pinteresting directory always and you should be good to go.
- 05:20 In that way, there is absolutely no difference between these two
- 05:23 different setups.
- 05:24 Like I said, it's just kind of easier to have all the stuff on
- 05:26 the screen while I'm teaching you.
- 05:27 And so that's why we do it.
- 05:28 The only real difference is this, whenever we want to run a project in C9,
- 05:32 you'll see me click this run project button.
- 05:34 But we learned earlier at the beginning of the course, if you want to run your
- 05:38 project you just type in this rails server command or just rails s.
- 05:43 And when you do, the server will boot up, you just copy the address.
- 05:48 Head over to your web browser and paste it in.
- 05:53 And boom, it'll appear just like that.
- 05:54 So pretty simple.
- 05:55 And that's pretty much all there is to it.
- 05:57 So in the next video, I think we're going to start to look at version control.
Lesson notes are only available for subscribers.