Class: JenkinsApi::CLI::Helper
- Inherits:
-
Object
- Object
- JenkinsApi::CLI::Helper
- Defined in:
- lib/jenkins_api_client/cli/helper.rb
Overview
This is the helper class that sets up the credentials from the command line parameters given and initializes the Jenkins API Client.
Class Method Summary (collapse)
-
+ (JenkinsApi::Client) setup(options)
Sets up the credentials and initializes the Jenkins API Client.
Class Method Details
+ (JenkinsApi::Client) setup(options)
Sets up the credentials and initializes the Jenkins API Client
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/jenkins_api_client/cli/helper.rb', line 36 def self.setup() if [:username] && [:server_ip] && \ ([:password] || [:password_base64]) creds = elsif [:creds_file] creds = YAML.load_file( File.([:creds_file], __FILE__) ) elsif File.exist?("#{ENV['HOME']}/.jenkins_api_client/login.yml") creds = YAML.load_file( File.( "#{ENV['HOME']}/.jenkins_api_client/login.yml", __FILE__ ) ) else msg = "Credentials are not set. Please pass them as parameters or" msg << " set them in the default credentials file" puts msg exit 1 end JenkinsApi::Client.new(creds) end |