Method: PUNK.commands

Defined in:
lib/punk/core/commands.rb

.commands(target, scope = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/punk/core/commands.rb', line 6

def self.commands(target, scope = nil)
  path = File.expand_path(File.join(__dir__, "..", "commands"))
  PUNK.profile_debug("commands", path: path) do
    Dir.glob(File.join(path, "**/*.rb")).sort.each { |file| require(file) }
  end
  path = File.expand_path(File.join(PUNK.get.app.path, "commands"))
  PUNK.profile_debug("commands", path: path) do
    Dir.glob(File.join(path, "**/*.rb")).sort.each { |file| require(file) }
  end
  case target
  when :commander
    require_relative "commander"
    Command.commander
  when :pry
    require_relative "pry"
    Command.pry
  when :spec
    Command.spec(scope)
  end
end