RubyGems (ruby)
  • 27 Sep 2021
  • 1 Minute to read
  • Dark
    Light
  • PDF

RubyGems (ruby)

  • Dark
    Light
  • PDF

A Ruby Gems feed in ProGet acts as a private Ruby Gems repository. Gems can be used directly by the gem client, and also browsed directly on the ProGet site.

Prerequisite Configuration

Although ProGet was tested with older versions, we recommend using rubygems 3.0.0 or higher. You can use gem --version to see which version of rubygems you have installed.

Gem Client Configuration

Before installing packages from ProGet, you should add ProGet to your gem installation by using the gem sources command.

gem sources --add http://«proget-server»/rubygems/«feed-name»

If you want to install packages only from ProGet, then you'll want to remove other sources.

$ gem sources
*** CURRENT SOURCES ***

https://rubygems.org
http://«proget-server»/rubygems/«feed-name»

$ gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources

Note that these sources are stored in your ~/.gemrc file.

Alternative Configuration Methods

Instead of adding ProGet to your sources file, you can set the RUBYGEMS_HOST environment variable.

$ export RUBYGEMS_HOST=http://«proget-server»/rubygems/«feed-name»

You can also always specify the -source argument on gem commands.

Testing Client Configuration

You can use the gem search command to make sure that your client is properly connected to ProGet.

$ gem search «search-string»

This will search all sources configured in your ~/.gemrc file to be searched. Use the --source argument to specify your ProGet server if you have multiple sources configured.

Authentication

The first time gem needs to authenticate to ProGet (whether for installing or publish packages), it will prompt for credentials and then store the results in your ~/.gem/credentials file. You can enter the same username/password you used to authenticate to ProGet, or a username of api and a valid API Key.

Installing Packages

You can use gems from ProGet just like you would use gems from rubygems.org. Gems are generally installed using the gem install command:

$ gem install «package-name» --version «package-version»

Creating Packages

There are no special considerations when creating gems for use in ProGet. You can simply use the gem build command.

$ gem build «package-name».gemspec

See "Make your own gem" in the RubyGems documentation to learn more

Publishing Packages

To push packages to ProGet, you can use gem push command:

$ gem push --host http://«proget-server»/rubygems/«feed-name» «package-name-version».gem

Was this article helpful?