Class: Zync::Generators::Base

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions, Actions
Defined in:
lib/zync-gen/generators/base.rb

Direct Known Subclasses

NamedBase

Class Method Summary collapse

Class Method Details

.base_rootObject

Returns the base root for a common set of generators.



19
20
21
# File 'lib/zync-gen/generators/base.rb', line 19

def self.base_root
  File.dirname(__FILE__)
end

.default_source_rootObject

Returns the default source root for a given generator.



30
31
32
33
34
# File 'lib/zync-gen/generators/base.rb', line 30

def self.default_source_root
  return unless generator_name
  path = File.expand_path(File.join(generator_name, 'templates'), base_root)
  path if File.exists?(path)
end

.source_root(path = nil) ⇒ Object

Returns the source root for this generator



24
25
26
27
# File 'lib/zync-gen/generators/base.rb', line 24

def self.source_root(path=nil)
  @_source_root = path if path
  @_source_root ||= default_source_root
end