Class: DaemonKit::Generators::Base

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

Instance Attribute Summary

Attributes included from Thor::Actions

#behavior

Attributes included from Thor::Base

#options

Class Method Summary collapse

Methods included from Thor::Actions

#action, #append_file, #apply, #chmod, #copy_file, #create_file, #destination_root, #destination_root=, #directory, #empty_directory, #find_in_source_paths, #get, #gsub_file, #in_root, included, #initialize, #inject_into_class, #inject_into_file, #inside, #prepend_file, #relative_to_original_destination_root, #remove_file, #run, #run_ruby_script, #source_paths, #template, #thor

Methods inherited from Thor::Group

class_options_help, get_options_from_invocations, handle_argument_error, help, invocation_blocks, invocations, invoke, invoke_from_option, printable_tasks, remove_invocation, start

Methods included from Thor::Base

included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses

Class Method Details

.desc(description = nil) ⇒ Object

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