Class: LeeroyJenkins::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/leeroy_jenkins/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

exit non-zero on failure github.com/erikhuda/thor/issues/244

Returns:

  • (Boolean)


5
6
7
# File 'lib/leeroy_jenkins/cli.rb', line 5

def self.exit_on_failure?
  true
end

Instance Method Details

#append(xml_file_path) ⇒ Object



21
22
23
# File 'lib/leeroy_jenkins/cli.rb', line 21

def append(xml_file_path)
  puts update_jobs(read_and_validate_xml_file(xml_file_path), __method__)
end

#backup(backup_dir) ⇒ Object



38
39
40
# File 'lib/leeroy_jenkins/cli.rb', line 38

def backup(backup_dir)
  puts JobBackupper.new(job_names, jenkins_client, backup_dir, options[:threads]).backup(options[:dry_run])
end

#deleteObject



33
34
35
# File 'lib/leeroy_jenkins/cli.rb', line 33

def delete
  puts update_jobs('', __method__)
end

#replace(xml_file_path) ⇒ Object



27
28
29
# File 'lib/leeroy_jenkins/cli.rb', line 27

def replace(xml_file_path)
  puts update_jobs(read_and_validate_xml_file(xml_file_path), __method__)
end

#restore(backup_dir) ⇒ Object



43
44
45
46
47
48
# File 'lib/leeroy_jenkins/cli.rb', line 43

def restore(backup_dir)
  job_restorer = JobRestorer.new(jenkins_client, backup_dir, options[:threads], job_rows, options[:job_regex])
  result = options[:dry_run] ? job_restorer.dry_run : job_restorer.restore!

  puts result
end