10/14/2015 - 6:08 PM

Ruby Setup Notes (in relation to Jenkins)

Ruby Setup Notes (in relation to Jenkins)

Ruby Setup Notes (in relation to Jenkins)

Rake Setup

In order for a Rake Invocation within Jenkins to work, there must be a Rakefile within the "root" SVN/GIT directory [Note: the name is Rakefile with no extension].

The Rakefile can contain numerous configuration setups for Rake, including requirements of certain Gem files, console output settings, variables (such as environment variables), it can pull in json files (such as a config file), and it can load all of the rake tasks (.rake files). The following is an example of a Rakefile setup:

require 'centroid'

# realtime console output
$stdout.sync = true
$stderr.sync = true

environment = ENV["JRS_ENV"] ||= "dev"

Config = Centroid::Config.from_file("jenkins_config.json").for_environment(environment)

Dir["Jenkins/Scripts/tasks/*.rake"].each do |path|
  load path

Bundler Install

First, one must install the bundler gem. Open a command console and type gem install bundler

Possible Bundler Installation Issues In order for your gem command to work, you'll either need to go to the folder where it exists or add it to your PATH environment variables so it works anywhere on the system (found under System > Advanced System Settings > Environment Variables...)

Also, you may receive the following error:

ERROR:  Could not find a valid gem 'bundler' (>= 0), here is why:
          Unable to download data from - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

Multiple possible solutions can be found here:

The solution that worked for me was: gem install bundler -r --source

Next, create a Gemfile in the "root" SVN/GIT directory [Note: the name is Gemfile with no extension]. The Gemfile should contain the name of the gem to bundle and its path. For example:

gem "centroid", :path => "Jenkins/Scripts/vendor/gems/centroid-1.1.0"

After you've created the Gemfile, in the console, navigate to where the Gemfile is and type bundle install This should create a Gemfile.lock file, which you will need to commit along with the Gemfile.