Class: JenkinsApi::CLI::Helper
- Inherits:
-
Object
- Object
- JenkinsApi::CLI::Helper
- Defined in:
- lib/improved_jenkins_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
-
.setup(options) ⇒ JenkinsApi::Client
Sets up the credentials and initializes the Jenkins API Client.
Class Method Details
.setup(options) ⇒ JenkinsApi::Client
Sets up the credentials and initializes the Jenkins API Client
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/improved_jenkins_client/cli/helper.rb', line 37 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']}/.improved_jenkins_client/login.yml") creds = YAML.load_file( File.( "#{ENV['HOME']}/.improved_jenkins_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 |