Class: Jenkins::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/jenkins-remote-api/cli.rb

Instance Method Summary collapse

Instance Method Details

#ci_address_to(url) ⇒ Object



9
10
11
12
# File 'lib/jenkins-remote-api/cli.rb', line 9

def ci_address_to url
  jenkins = Ci::Jenkins.new url
  puts jenkins.ci_address
end

#current_statusObject



37
38
39
40
41
# File 'lib/jenkins-remote-api/cli.rb', line 37

def current_status
  jenkins = Ci::Jenkins.new options[:ci_address]
  status = jenkins.current_status_on_job options[:job_name]
  puts table(['Job Name', 'Status'], *([[options[:job_name], status]]))
end

#jobs_descriptionObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/jenkins-remote-api/cli.rb', line 23

def jobs_description
  jenkins = Ci::Jenkins.new options[:ci_address]
  job_description_table = table do |t|
    t.headings = 'Job Name', 'Job Status', 'Job URL'
    jenkins.jobs_description.each do |job_desc|
      t << job_desc.values
    end
  end
  puts job_description_table  
end

#list_all_job_namesObject



16
17
18
19
# File 'lib/jenkins-remote-api/cli.rb', line 16

def list_all_job_names
  jenkins = Ci::Jenkins.new options[:ci_address]
  puts table(['Job Name'], *(jenkins.list_all_job_names.collect{|name| [name]}))
end