Class: Smith::Commands::Agents

Inherits:
Smith::CommandBase show all
Includes:
Common
Defined in:
lib/smith/commands/agency/agents.rb

Instance Attribute Summary

Attributes inherited from Smith::CommandBase

#options, #target

Instance Method Summary collapse

Methods included from Common

#agent_group

Methods inherited from Smith::CommandBase

#banner, #format_help, #initialize, #parse_options

Methods included from Logger

included

Constructor Details

This class inherits a constructor from Smith::CommandBase

Instance Method Details

#_agentsObject

Return the fully qualified class of all avaiable agents



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/smith/commands/agency/agents.rb', line 14

def _agents
  separator = (options[:one_column]) ? "\n" : " "

  if options[:group]
    agent_group(options[:group]).sort.join(separator)
  else
    Smith.agent_directories.each_with_object([]) do |agent_root_path, acc|
      Pathname.glob(agent_root_path.join("**/*")).each do |agent_path|
        if !agent_path.symlink? && !agent_path.directory?
          acc << Utils.class_name_from_path(agent_path, agent_root_path)
        end
      end
    end.sort.join(separator)
  end
end

#executeObject



9
10
11
# File 'lib/smith/commands/agency/agents.rb', line 9

def execute
  responder.succeed(_agents)
end