Skip to main content

Ruby update agent

The most reliable and effective way to automatically update the Contrast Ruby agent is to use the Ruby Bundler package manager to install and download the latest version available. Because Bundler typically manages all dependencies for your Ruby application, it should already be available and part of your build environment. How frequently you update the Contrast Ruby agent and where you get updates depends on your organization's preferences and your Contrast implementation: Hosted or on-premises.

The main steps are:

  1. Choose a source for the Contrast Ruby agent.

  2. Install the agent,

  3. Use scripts for automatic updates.

Before you begin

  • Some familiarity with Ruby’s Bundler package manager.

  • Access to the RubyGems repository for the Contrast Ruby agent.

  • Confirmed that your Ruby application runs properly without the Contrast Ruby agent.

  • Previously successfully installed the Contrast Ruby agent.

  • Defined a policy for how and when to update the agent, based on your change management policy and the environment where you deploy agents.

Install and use scripts automatic updates

  1. Choose a source for the Contrast ruby agent:

    • RubyGems public (or private) repository

  2. Include the Contrast Ruby agent in the Gemfile to easily keep every new build of your application aligned with the latest version of the agent. Do not specify a version for contrast-agent, and it will retrieve the latest version.

    The Gemfile is where you specify which dependencies you want to automatically resolve every time your Ruby application builds with artifacts from RubyGems (public or private).

  3. After you update the Gemfile, use the following command when you build your application. This will automatically download and add the Contrast Ruby agent from RubyGems to the Ruby application.

    $ bundle install
  4. After you add contrast-agent to your Gemfile, you can use Bundler to update your agent, like this:

    bundle update contrast-agent

Install the gem manually

You can manually update agents as part of a Ruby build process in two ways. Choose the one that works best for your organization and workflow:

  • Rubygems: Use the following command to retrieve and install the Contrast Ruby agent from RubyGems (public or private) to the application:

    $ gem install contrast-agent

    Add the following line to your Gemfile to manage updates with Bundler, because the previous command only installs the agent locally:

    gem "contrast-agent"

    Then to either install or update the agent using bundler run the following:

    $ bundle install
  • Add the following line to your Gemfile to manage the updates with Bundler, because the previous command only installs the agent locally:

    gem "contrast-agent"

See also