آموزش اصول Ruby
آموزش تصویری برنامه نویسی Ruby از شرکت Treehouse را برای شما آماده کرده ایم.
در این دوره آموزشی از نصب و راه اندازی Ruby تا کار با دستورات و امکانات آن آشنا می شوید.
سرفصل هاي دوره آموزشي :
- نصب و دانلود Ruby
- آخرین نسخه از Ruby
- اضافه کردن فایل های اجرایی Ruby
- جستجو در github برای پروژه ای به نام OSX
- نصب Git
- نسخه مدیر Ruby
- استفاده از TextMate برای edit that file
- استفاده از RVM
- و ...
ليست سرفصل هاي دوره آموزشي:
0:09 we need to download and install Ruby.
0:11 So we're going to go ahead and do that right now
0:13 and I'm going to show you how on both a Windows and Macintosh computer.
0:19 In order to be able to run your Ruby programs,
0:22 you're going to need something called an interpreter.
0:25 On Windows, the easiest way to install a Ruby interpreter
0:28 is from the rubyinstaller.org website.
0:32 True to form, it says it is the easiest way to install Ruby on Windows.
0:38 So click on \"Download.\"
0:40 As of the time that we're recording the screen cast,
0:43 the latest version of Ruby is 1.9.3 patch level 0.
0:48 That's what the little \"p0\" stands for.
0:51 So click on that to download.
0:54 I guarantee that you do want to run or save the Ruby Installer executable.
1:00 Accept the terms of the license agreement.
1:06 One thing to note is to add the Ruby executables to your path.
1:11 This will allow you to type the \"ruby\" command anywhere in a command console.
1:16 We'll get to that in just a minute.
1:20 Go ahead and click on \"Finish\" to exit the setup.
1:24 Now that we have Ruby installed, let's go ahead and run it
1:27 and make sure everything installed correctly.
1:30 So click on the Start Menu
1:32 and type \"cmd\" to run the command prompt.
1:39 Now here we are at a command prompt
1:41 we'll type \"ruby -v\".
1:44 This will make sure that we can access the Ruby executable
1:47 and show us what version we have installed.
1:50 [ruby -v]
1:52 And there we have it, the version we just downloaded from the website.
1:56 Now that the Windows version is done,
1:58 let's go ahead and install it on our Mac.
2:01 So now we're going to install Ruby on our Mac.
2:06 We're going to do this using a program called RVM
2:09 or the Ruby Version Manager.
2:13 This is one of several ways that you can install Ruby on your Mac.
2:18 Before we can install RVM though,
2:20 we need something called GCC installed.
2:23 You can get this with the developer tools that come with Xcode,
2:26 or you can download it from github.
2:30 Search github for a project called osx-gcc-installer.
2:38 Click on the Downloads tab
2:42 and download the version that's appropriate
2:44 for your version of Mac OS 10.
2:47 The computer I'm using right now is running OS 10 Lion
2:50 or 10.7.
2:53 I've already downloaded that, so we don't have to wait.
2:56 Double-click to install and wait for the installer window to pop up.
3:00 Click \"Continue\".
3:04 Click \"Continue\" again.
3:08 Click \"Install\".
3:11 At this point, the software will ask you for your password.
3:19 Now we wait.
3:26 Wow, that was quick!
3:28 Now that we have GCC installed, we can install something called Homebrew.
3:31 This is a package manager for OS 10,
3:35 which is just a way of saying that it lets you easily install a bunch of software.
3:38 So click on the \"Install Homebrew Today\" button.
3:45 And we have this helpful little line to paste at a shell prompt.
3:49 Copy that to the clipboard and paste it in a terminal.
3:54 This is going to download and install Homebrew.
4:03 Okay, now that we've installed Homebrew,
4:06 we can install Git.
4:08 We do that by typing \"brew install git\".
4:11 [brew install git]
4:16 This will now download, compile, and install Git for us.
4:20 Git isn't strictly necessary for running Ruby,
4:24 but it'll sure help us down the line.
4:26 In this video, while we're installing Homebrew and RVM,
4:30 we're running shell scripts straight from the internet.
4:34 It's okay in the context of this video,
4:37 but in the future, it's something to be aware of as a possible security risk.
4:41 It's always a good idea to read these scripts
4:44 before you run them on your own computer.
4:52 Okay, now we have Git installed.
4:55 Now that Git's installed, let's install RVM--
4:58 the Ruby Version Manager.
5:00 So if we head on over to the RVM home page at
5:07 we'll see a quick install line.
5:12 What you can do here is simply copy this
5:17 and paste it in your terminal.
5:22 This will download and install RVM for you.
5:30 RVM lets us know that we have to install something
5:33 into our bash profile in order to get it to work.
5:37 If we scroll up. the instructions are right here.
5:42 You probably haven't created a bash profile just yet.
5:45 To do that, we can use the \"touch\" command
5:48 and then edit it.
5:50 [touch ~/.bash_profile]
5:54 Now we're going to use TextMate to edit that file.
5:57 [mate ~/.bash_profile]
6:01 Now I've already put in that line that RVM gave us.
6:05 But something else that we're going to need to add
6:08 is this line right up here
6:11 that says \"export CC=/usr/bin/gcc-4.2\"
6:20 That's what we just installed.
6:23 Save it, then go back to your shell.
6:26 Now we have to load that in
6:29 so we can type \"source\"
6:31 [source ~/.bash_profile]
6:35 and give it the name of the file we just saved.
6:37 Now we should be ready to install a Ruby.
6:41 The latest version of Ruby, as of the time of this recording,
6:44 is 1.9.3.
6:46 So we'll tell RVM to install that using the \"install\" command.
6:50 [rvm install 1.9.3]
6:56 Now it's going to download and compile Ruby.
7:04 Okay, RVM has compiled and installed Ruby 1.9.3
7:11 Now before we can actually use it,
7:14 we have to tell RVM that we want to use it.
7:17 We do that using the \"use\" command.
7:20 [rvm use 1.9.3]
7:25 Now, if we type \"ruby -v\", just like we did on Windows,
7:30 it should show us what version of Ruby we're using.
7:33 [ruby -v]
7:37 And that's correct.
7:40 Congratulations, you've installed Ruby on your Mac.
7:43 [? Music ?]
7:45 In the next video in the batch, we're going to use IRB
7:48 and write our first Ruby program.
عنوان دوره: Treehouse - Ruby Foundations حجم فايل: 505MBTreehouse Ruby Foundations