1 00:00:00,570 --> 00:00:04,620 Once you know what gem you want to use, you need to install it. 2 00:00:04,620 --> 00:00:07,470 We'll do that using the gem command. 3 00:00:07,470 --> 00:00:10,630 Let's take a look at how that works now using Workspaces. 4 00:00:12,050 --> 00:00:14,595 So let's go ahead and install a gem. 5 00:00:14,595 --> 00:00:18,890 First, I'm going to search for it on RubyGems.org. 6 00:00:18,890 --> 00:00:22,960 And, for this example, I'm going to install the money gem. 7 00:00:22,960 --> 00:00:28,005 Now, in order to install it, we only need to know the name of the gem, in this case, 8 00:00:28,005 --> 00:00:29,180 it's money. 9 00:00:31,080 --> 00:00:35,970 So, I've loaded up a workspace here and I'm right in the console. 10 00:00:35,970 --> 00:00:39,940 In order to install a gem, all we need to do is type the word gem. 11 00:00:41,320 --> 00:00:47,140 And then the word install and the name of the gem, which in this case is money. 12 00:00:49,295 --> 00:00:53,362 Once we do that, Ruby and RubyGems will go out, 13 00:00:53,362 --> 00:00:57,640 find the gem, download it, and then install it. 14 00:01:00,625 --> 00:01:09,230 And we can see that two gems were successfully installed, money and i18n. 15 00:01:09,230 --> 00:01:13,400 If we go back to the page on RubyGems.org, 16 00:01:13,400 --> 00:01:17,010 we can see that the runtime dependencies specify i18n. 17 00:01:19,510 --> 00:01:24,580 And since that's specified, Ruby will download and install that gem as well. 18 00:01:26,605 --> 00:01:31,167 Now, if for some reason, you find a gem that isn't on RubyGems and 19 00:01:31,167 --> 00:01:35,260 want to install it that way, you can also download the gem. 20 00:01:36,690 --> 00:01:39,600 On the right side, there'll be a button to download it. 21 00:01:40,980 --> 00:01:42,590 So I've clicked the download button, and 22 00:01:42,590 --> 00:01:46,300 you can see that it appears at the bottom of our web browser. 23 00:01:48,460 --> 00:01:53,620 So now I'm gonna clear my screen and, if we press the File menu, and 24 00:01:53,620 --> 00:01:57,830 Upload File, then select the file that we downloaded and 25 00:01:57,830 --> 00:02:01,550 press open, you'll see on the bottom left it says it's uploading. 26 00:02:02,570 --> 00:02:07,820 And then it will appear on the left side of the screen here in the file list. 27 00:02:07,820 --> 00:02:12,940 From there, we can type the same command, gem, install, 28 00:02:14,100 --> 00:02:19,580 and the name of the gem, which will point to this particular gem on the file system. 29 00:02:20,710 --> 00:02:24,870 Now, I started typing the name of the gem and then pressed Tab so 30 00:02:24,870 --> 00:02:27,400 that the workspace would complete the name for me. 31 00:02:28,640 --> 00:02:29,810 Then, press Enter. 32 00:02:31,730 --> 00:02:35,080 Now, you'll notice that this time it said it successfully installed 33 00:02:35,080 --> 00:02:38,250 the version of the gem that we had in the console. 34 00:02:38,250 --> 00:02:41,600 But, it did not install the I18N gem. 35 00:02:41,600 --> 00:02:43,710 The reason for 36 00:02:43,710 --> 00:02:47,960 that is that is was already installed the last time we installed the gem. 37 00:02:49,250 --> 00:02:52,540 Now if I clear my screen here and press gem, and 38 00:02:52,540 --> 00:02:56,279 list, it will show me all of the gems that I have installed. 39 00:02:57,490 --> 00:03:02,750 Money, which we just installed, and i18n, which came with money. 40 00:03:03,790 --> 00:03:08,680 The rest of the gems that you see are all part of the default RubyGems installation. 41 00:03:10,680 --> 00:03:14,300 Try installing Gems on your own now using Workspaces.