In this lesson, our instructor talks about ruby gems. He discusses what is a gem, what are the uses, gem installation, and updating to the latest Ruby gems. Then he talks about testing gem, installing rake, verifying, structure, specification, create gem, and get some gems.
Build it, install it, run it, and then publish it!
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.
Extend or modify functionality within your Ruby application.0258
Avoid duplication: you don't want to be creating code that someone else has already created; why don't you go with a Ruby Gem...find that piece of code, see if someone has already developed it and just pull that in.0267
You can make their Gem better--be a contributor and help out.0280
For our uses, we're not going to do any unit tests right now.0739
Readme--very self-explanatory: if I get your Gem, I look at the sourcecode, I want to look at your readme to see how I set it up, a description, installation...any tips or common things I should know.0747
Your rakefile--if there are any tasks that are common that you created to run your Gem--anything I need to load--you can specify in your rakefile.0764
There you go: it's installed--I have my Gem installed, I have some documentation--I didn't actually set up any, but we've gone through the RDoc lesson, so I'll let you guys do that.1310
So, now I can just go to require 'educator'--it says "true"--then I specify the actual code, and there you go: it prints "hello world."1322
We've built it, installed it, and now we can publish it to the world if we wanted to.1332
We went through this step; gem install rubygem-0.0.1--this version will change, depending on what you put in the .gemspec, and this will also change.1352
Again, to run it, since it's already in your Gem directory, you can require it--as simple as that: just putting the name of it in.1371
The next step would be, "Hey, I have this great code piece; I want to publish it to the world! I'm going to help other people use it; I already developed it--why don't I help others and maybe, if I have some feature I would like to have with it, but I don't have time, maybe someone else could work on it, too!"1385
To do this, you would sign up on RubyGems.org, and then they have a command to help you publish it.1407
It's back on their site...it's exactly like the slide--you run this curl command, it goes to this URL--you will specify a username when you sign up for your account, and now it's going to ask you for that password that you created with the user.1417
Once you do that, you just run gem push, and it will actually push it to the website, and your Gem will be up.1448
Notice here, you are doing this curl command; change this to your name; and then this URL will stay the same, and you just put in this and the curl with the Gem; you put in your credentials, and you put your password here.1456
Then, all you have to do is just run this gem push, and it will push the Gem to RubyGems.org, and you will see it by the message: it will say, "Successfully registered"--your Ruby Gem is online now.1481
Other than that, I would say just start looking at those Gems and downloading some.1505
We've looked at Rake; another popular one is the Rails Gem; FasterCSV is a Gem you can use to parse CSV files, and it's quite popular, and it does the job really well.1512
Then this one called Koala will allow you to interact with the Facebook API and start using Open Graph.1531