Class: DaemonKit::Generators::Base

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

Class Method Summary (collapse)

Class Method Details

+ (Object) desc(description = nil)

Tries to get the description from a USAGE file one folder above the source root otherwise uses a default description.



15
16
17
18
19
20
21
22
23
24
# File 'lib/daemon_kit/generators/base.rb', line 15

def self.desc(description=nil)
  return super if description
  usage = File.expand_path(File.join(source_root, "..", "USAGE"))

  @desc ||= if File.exist?(usage)
    File.read(usage)
  else
    "Description:\n    Create #{base_name.humanize.downcase} files for #{generator_name} generator."
  end
end