As I have mentioned in a
previous post, I will review the basic life-cycle of another Ruby
tool - gem (full name RubyGems). It is hard to imagine how the plethora of
"add-on" functionality (aka the gems) available for Ruby
developers could be controlled without gem (more than 56k gems, downloaded more
than 1.5 BILLION times to the latest count...).
If with Rails things are somehow
eased by "the bundler" (more about this in a next post), for plain
old Ruby gem is THE tool (well, even Rails is typically installed as a gem...).
So, let's start:
1. Installing a new gem
gem install gemname
2. Uninstalling a gem
gem uninstall gemname
3. Updating a gem to the latest version
gem update [gemname]
Bear in mind the fact that the name of the gem is optional - if no gem is mentioned ALL the installed gems will be updated to the latest version.
Another interesting fact is that more than one version of a gem can be kept installed at one given time - it is up to the developer to choose what version of the gem he/she will use.
A more special version of the "update" is the one used to update the RubyGems itself:
gem update --system
4. Checking the current status
One can use (typically) the "old-fashioned" version of
gem list
or, in a more modern fashion, could start a mini-website providing info about the installed gems, their respective versions, and a brief explanation/description of the installed gems:
gem server
5. And, as usual, the most important gem command
If you lose it, you can always try:
Niciun comentariu:
Trimiteți un comentariu