Class: DevopsToolkit::Runner

Inherits:
Thor
  • Object
show all
Defined in:
lib/devops_toolkit/runner.rb

Class Method Summary collapse

Class Method Details

.load_tasksObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/devops_toolkit/runner.rb', line 5

def self.load_tasks
  tasks_dir = File.expand_path(File.join(__dir__, 'tasks'))
  Dir.glob(File.join(tasks_dir, '**', '*.rb')).each do |thor_file|
    next if File.directory?(thor_file)
    require thor_file
    Thor::Util.load_thorfile(thor_file)
  end
  # define subcommands per task, by class
  # TODO change, no evals
  DevopsToolkit::Tasks.constants.select {|c| DevopsToolkit::Tasks.const_get(c).is_a? Class}.each do |klass_sym|
    klass = Object.const_get("DevopsToolkit::Tasks::#{klass_sym}")
    desc klass::COMMAND, klass::DESC
    subcommand klass::COMMAND, klass
  end

end