Class: Diesel::Generators::Base
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Diesel::Generators::Base
show all
- Defined in:
- lib/diesel/generators/base.rb
Class Method Summary
collapse
Class Method Details
.engine ⇒ Object
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_name ⇒ Object
37
38
39
|
# File 'lib/diesel/generators/base.rb', line 37
def self.engine_name
self.name.split('::').first.underscore
end
|
.engine_root ⇒ Object
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_root ⇒ Object
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_root ⇒ Object
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
|