Class: Kdeploy::CLI

Inherits:
Thor
  • Object
show all
Extended by:
DSL
Defined in:
lib/kdeploy/cli.rb

Overview

Command-line interface for Kdeploy

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DSL

add_explicit_hosts, add_role_hosts, assign_task, create_task_block, extended, get_task_hosts, host, include_tasks, inventory, kdeploy_hosts, kdeploy_roles, kdeploy_tasks, normalize_hosts_option, normalize_roles_option, role, run, sync, task, task_empty?, upload, upload_template

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/kdeploy/cli.rb', line 14

def self.exit_on_failure?
  true
end

Instance Method Details

#execute(task_file, task_name = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/kdeploy/cli.rb', line 49

def execute(task_file, task_name = nil)
  load_config_file
  show_banner_once
  @task_file_dir = File.dirname(File.expand_path(task_file))
  load_task_file(task_file)

  tasks_to_run = determine_tasks(task_name)
  execute_tasks(tasks_to_run)
rescue StandardError => e
  puts Kdeploy::Banner.show_error(e.message)
  exit 1
end

#help(command = nil) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/kdeploy/cli.rb', line 27

def help(command = nil)
  if command
    super
  else
    show_general_help
  end
end

#init(dir = '.') ⇒ Object



36
37
38
39
40
41
42
# File 'lib/kdeploy/cli.rb', line 36

def init(dir = '.')
  initializer = Initializer.new(dir)
  initializer.run
rescue StandardError => e
  puts Kdeploy::Banner.show_error(e.message)
  exit 1
end

#versionObject



22
23
24
# File 'lib/kdeploy/cli.rb', line 22

def version
  puts Kdeploy::Banner.show_version
end