Class: Diesel::Generators::Base

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/diesel/generators/base.rb

Direct Known Subclasses

FeaturesBase, InstallBase, ViewsBase

Class Method Summary collapse

Class Method Details

.engineObject



31
32
33
34
35
# File 'lib/diesel/generators/base.rb', line 31

def self.engine
  @_diesel_engine ||= "#{engine_name.camelize}::Engine".constantize
rescue NameError
  nil
end

.engine_nameObject



37
38
39
# File 'lib/diesel/generators/base.rb', line 37

def self.engine_name
  self.name.split('::').first.underscore
end

.engine_rootObject



27
28
29
# File 'lib/diesel/generators/base.rb', line 27

def self.engine_root
  File.expand_path(engine.root)
end

.inherited(generator) ⇒ Object



13
14
15
16
# File 'lib/diesel/generators/base.rb', line 13

def self.inherited(generator)
  super
  generator.source_paths << generator.template_root if generator.engine
end

.source_rootObject



7
8
9
10
11
# File 'lib/diesel/generators/base.rb', line 7

def self.source_root
  if engine
    @_diesel_source_root ||= engine_root
  end
end

.template_rootObject



18
19
20
21
22
23
24
25
# File 'lib/diesel/generators/base.rb', line 18

def self.template_root
  File.join(engine_root,
            "lib",
            "generators",
            engine_name,
            generator_name,
            'templates')
end