I\'m making a custom generator that generates a new rails app, and I do it like this
require \'thor\'
require \'rails/generators/rails/app/app_generator\'
c
Thor will access your source_paths method and add these to the defaults:
# Returns the source paths in the following order:
#
# 1) This class source paths
# 2) Source root
# 3) Parents source paths
#
def source_paths_for_search
paths = []
paths += self.source_paths
paths << self.source_root if self.source_root
paths += from_superclass(:source_paths, [])
paths
end
So all you need to do in your class is:
class NewgemGenerator < Thor::Group
include Thor::Actions
def source_paths
['/whatever', './templates']
end
end
Hope this helps :)