Class: Nodectl::CLI

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

Instance Method Summary collapse

Instance Method Details

#init(host_path = "./") ⇒ Object



11
12
13
# File 'lib/nodectl/cli.rb', line 11

def init(host_path = "./")
  Nodectl::Generators::Init.start [host_path]
end

#install(service_name) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/nodectl/cli.rb', line 56

def install(service_name)
  boot

  service = find_service!(service_name)
  recipe  = find_recipe!(service)

  recipe.run_action :install
end

#recipe(recipe_name) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/nodectl/cli.rb', line 25

def recipe(recipe_name)
  boot

  recipe = Nodectl::Recipe.find!(recipe_name)

  print "Logs:     "
  puts  recipe.logs.map(&:to_s).join(", ")

  print "Actions:  "
  puts  recipe.actions.map(&:to_s).join(", ")

  print "Triggers: "
  puts  recipe.triggers.map(&:to_s).join(", ")

rescue Nodectl::NotFound
  $stderr.puts "recipe '#{recipe_name}' not found"
  abort
end

#recipesObject



16
17
18
19
20
21
22
# File 'lib/nodectl/cli.rb', line 16

def recipes
  boot

  Nodectl::Recipe.all.each do |recipe|
    puts recipe.name
  end
end

#serverObject



84
85
86
87
88
# File 'lib/nodectl/cli.rb', line 84

def server
  boot
  
  Nodectl::server.run
end

#servicesObject



45
46
47
48
49
50
51
52
53
# File 'lib/nodectl/cli.rb', line 45

def services
  boot

  Nodectl::Service.load_register

  Nodectl::Service.all.each do |service|
    puts "#{service.name} #{service.status}"
  end
end

#versionObject



91
92
93
# File 'lib/nodectl/cli.rb', line 91

def version
  puts "Nodectl #{Nodectl::VERSION}"
end