Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Gem Installation3:14 with Jason Seifer
Once you know what gem you want to use, you need to install it. We'll do that using the gem command.
Install a gem:
gem install [gem name]
Install a gem from a downloaded package:
gem install [package name.gem]
Once you know what gem you want to use, you need to install it. 0:00 We'll do that using the gem command. 0:04 Let's take a look at how that works now using Workspaces. 0:07 So let's go ahead and install a gem. 0:12 First, I'm going to search for it on RubyGems.org. 0:14 And, for this example, I'm going to install the money gem. 0:18 Now, in order to install it, we only need to know the name of the gem, in this case, 0:22 it's money. 0:28 So, I've loaded up a workspace here and I'm right in the console. 0:31 In order to install a gem, all we need to do is type the word gem. 0:35 And then the word install and the name of the gem, which in this case is money. 0:41 Once we do that, Ruby and RubyGems will go out, 0:49 find the gem, download it, and then install it. 0:53 And we can see that two gems were successfully installed, money and i18n. 1:00 If we go back to the page on RubyGems.org, 1:09 we can see that the runtime dependencies specify i18n. 1:13 And since that's specified, Ruby will download and install that gem as well. 1:19 Now, if for some reason, you find a gem that isn't on RubyGems and 1:26 want to install it that way, you can also download the gem. 1:31 On the right side, there'll be a button to download it. 1:36 So I've clicked the download button, and 1:40 you can see that it appears at the bottom of our web browser. 1:42 So now I'm gonna clear my screen and, if we press the File menu, and 1:48 Upload File, then select the file that we downloaded and 1:53 press open, you'll see on the bottom left it says it's uploading. 1:57 And then it will appear on the left side of the screen here in the file list. 2:02 From there, we can type the same command, gem, install, 2:07 and the name of the gem, which will point to this particular gem on the file system. 2:14 Now, I started typing the name of the gem and then pressed Tab so 2:20 that the workspace would complete the name for me. 2:24 Then, press Enter. 2:28 Now, you'll notice that this time it said it successfully installed 2:31 the version of the gem that we had in the console. 2:35 But, it did not install the I18N gem. 2:38 The reason for 2:41 that is that is was already installed the last time we installed the gem. 2:43 Now if I clear my screen here and press gem, and 2:49 list, it will show me all of the gems that I have installed. 2:52 Money, which we just installed, and i18n, which came with money. 2:57 The rest of the gems that you see are all part of the default RubyGems installation. 3:03 Try installing Gems on your own now using Workspaces. 3:10
You need to sign up for Treehouse in order to download course files.Sign up