Class: Bindle::Commands::Base

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bindle/commands/base.rb

Direct Known Subclasses

Init

Class Method Summary collapse

Class Method Details



31
32
33
34
35
# File 'lib/bindle/commands/base.rb', line 31

def banner
  banner = "bindle #{display_name}"
  banner << " #{self.arguments.map(&:usage).join(' ')}" if self.arguments.length > 0
  banner << " [options]"
end

.default_command_rootObject



23
24
25
# File 'lib/bindle/commands/base.rb', line 23

def default_command_root
  File.dirname(__FILE__)
end

.default_source_rootObject



27
28
29
# File 'lib/bindle/commands/base.rb', line 27

def default_source_root
  File.join(default_command_root, "..", "templates")
end

.display_nameObject



37
38
39
40
41
42
# File 'lib/bindle/commands/base.rb', line 37

def display_name
  self.to_s.split("::")
    .reject { |item| ["Bindle", "Commands"].include?(item) }
    .map(&:underscore)
    .join(" ")
end

.source_rootObject



19
20
21
# File 'lib/bindle/commands/base.rb', line 19

def source_root
  default_source_root
end