RubyGems

Make your Own Gem

What is Gem? RubyGems is the official packaging system for ruby-lang.org programming language. It provides a packet format, a tool for managing packages, a repository for their distribution.

Since Ruby 1.9 RubyGems is part of the standard library of Ruby. If you want to use a RubyGem in a Ruby program, you must first load the required library:

Use

RubyGems be accessed via the command line acc.

Example :</strong>

require 'json'        # aktuelle Version
gem 'rake', '= 10.1.0' # mit Versionsangabe


Gem Installation : Rake Download and install rake with the following. gem install rake Example : First, you must write a “Rakefile” file which contains the build rules. Here's a simple example:

task default: %w[test]

task :test do
  ruby "test/unittest.rb"
end

This Rakefile has two tasks: A task named “test”, which – upon invocation – will run a unit test file in Ruby. A task named “default”. This task does nothing by itself, but it has exactly one dependency, namely the “test” task. Invoking the “default” task will cause Rake to invoke the “test” task as well. Running the “rake” command without any options will cause it to run the “default” task in the Rakefile:

% ls
Rakefile     test/
% rake
(in /home/some_user/Projects/rake)
ruby test/unittest.rb
....unit test output here...

Type “rake –help” for all available options.

Link: rubygems.org Link: ruby-lang.org
“Grind and Polish your Gems!”

“If you are going to walk on thin ice, you might as well dance”