| Start |
|---|
| What is a gem? A gem is the equivalent to a plugin or an extension for the programming language ruby. To be exact even rails is nothing more than a gem. A lot of gems are built on rails or other gems (they are dependent of said gem) or are standalone. In your Rails projectGemfileFor your Rails project you have a file called Gemfile.lockOnce you have done this, your This example is for the gem DevelopmentEither a single person, a group or a whole community works on and maintains a gem. Work done is usually released after certain Usually the releases follow the Semantic Versioning 2.0.0 (opens new window) principle. |
| Bundler The easiest way to handle and manage gems is by using To use bundler you first need to install it. After you have bundler up and running all you need to do is add gems to your in your terminal. This installs your newly added gems to your project. Should an issue arise, you would get a prompt in your terminal. If you are interested in more details, I suggest you have a look at the docs (opens new window). |
| Gemfiles To start, gemfiles require at least one source, in the form of the URL for a RubyGems server. Generate a Gemfile with the default rubygems.org source by running Next, declare the gems that you need, including version numbers. Most of the version specifiers, like >= 1.0, are self-explanatory. The specifier ~> has a special meaning. ~> 2.0.3 is identical to >= 2.0.3 and < 2.1. ~> 2.1 is identical to >= 2.1 and < 3.0. ~> 2.2.beta will match prerelease versions like 2.2.beta.12. Git repositories are also valid gem sources, as long as the repo contains one or more valid gems. Specify what to check out with If you would like to use an unpacked gem directly from the filesystem, simply set the :path option to the path containing the gem's files. Dependencies can be placed into groups. Groups can be ignored at install-time (using You can specify the required version of Ruby in the Gemfile with |
| Gemsets If you are using
Creating gemsets Suppose you already have Now to create gemset for this ruby version: where the to list the gems of all ruby versions: to use a gemset from the list (suppose you can also specify the ruby version with the gemset if you want to shift to some other ruby version: to specify a default gemset for a particular ruby version: to remove all the installed gems from a gemset you can empty it by: to copy a gemset from one ruby to another you can do it by: to delete a gemset: to see the current gemset name: to install a gem in the global gemset: Initializing Gemsets during Ruby Installs When you install a new ruby, RVM not only creates two gemsets (the default, empty gemset and the global gemset), it also uses a set of user-editable files to determine which gems to install. Working in For example, if you edited every time you install a new ruby, these two gems are installed into your global gemset. RemarksGemfile documentationFor projects that are expected to grow, it is a good idea add comments your This can also help you to remember why you chose a certain version and consequently re-evaluate the version requirement later on. Examples: |
Read Article
https://develop.horje.com/learn/1434/reference