Module: Thor::Actions::ClassMethods

Defined in:
lib/vendor/thor/lib/thor/actions.rb

Instance Method Summary collapse

Instance Method Details

#add_runtime_options!Object

Add runtime options that help actions execution.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vendor/thor/lib/thor/actions.rb', line 41

def add_runtime_options!
  class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime,
                       :desc => "Overwrite files that already exist"

  class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime,
                         :desc => "Run but do not make any changes"

  class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime,
                       :desc => "Supress status output"

  class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime,
                      :desc => "Skip files that already exist"
end

#source_pathsObject

Hold source paths for one Thor instance. source_paths_for_search is the method responsible to gather source_paths from this current class, inherited paths and the source root.



21
22
23
# File 'lib/vendor/thor/lib/thor/actions.rb', line 21

def source_paths
  @source_paths ||= []
end

#source_paths_for_searchObject

Returns the source paths in the following order:

1) This class source paths
2) Source root
3) Parents source paths


31
32
33
34
35
36
37
# File 'lib/vendor/thor/lib/thor/actions.rb', line 31

def source_paths_for_search
  paths = []
  paths += self.source_paths
  paths << self.source_root if self.respond_to?(:source_root)
  paths += from_superclass(:source_paths, [])
  paths
end