A small wrapper program named ec-jruby
is installed as part of the CloudBees CD/RO tools. You can use it to run JRuby scripts.
Default Location of ec-jruby
-
The default location for
ec-jruby
on Linux is/opt/cloudbees/sda/bin/ec-jruby
-
The default location for
ec-jruby
on Windows isC:\Program Files\CloudBees\Software Delivery Automation\bin\ec-jruby
CloudBees CD/RO automatically adds ec-jruby
to your path.
Running ec-jruby
To run ec-jruby
:
-
Set
COMMANDER_HOME
andCOMMANDER_DATA
as environment variables. -
Enter
ec-jruby <yourJRubyOptions> <JRubyScriptName>.rb
on the command line.
There is no language-specific binding for JRuby. Use the REST API to communicate with the CloudBees CD/RO server.
Example of a JRuby Script
require 'net/https'
require 'cgi'
uri = URI.parse("https://" + ENV["COMMANDER_SERVER"] + ":" +
ENV["COMMANDER_HTTPS_PORT"] + "/rest/v1.0/projects")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Only set VERIFY_NONE for development / testing
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
cookie = CGI::Cookie.new('sessionId',ENV["COMMANDER_SESSIONID"])
request['Cookie'] = cookie.to_s
response = http.request(request)
puts response.body