Class: Rugular::GeneratorBase
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Rugular::GeneratorBase
show all
- Includes:
- Thor::Actions
- Defined in:
- lib/rugular/tasks/generate/generator_base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.source_root ⇒ Object
10
11
12
|
# File 'lib/rugular/tasks/generate/generator_base.rb', line 10
def self.source_root
__dir__.chomp('/tasks/generate')
end
|
Instance Method Details
#app_or_component ⇒ Object
45
|
# File 'lib/rugular/tasks/generate/generator_base.rb', line 45
def app_or_component; 'components' end
|
#create_route_folders ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rugular/tasks/generate/generator_base.rb', line 14
def create_route_folders
route_pathnames.each do |pathname|
next(
"#{destination_file(pathname)} already exists"
) if File.exists? destination_file(pathname)
create_file destination_file(pathname) do
ERB.new(pathname.read).result(
open_struct.instance_eval { binding }
)
end
end
end
|
#inject_module_into_module ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/rugular/tasks/generate/generator_base.rb', line 28
def inject_module_into_module
if nested?
insert_into_file(
nested_module_file,
module_declaration,
after: "angular.module '#{nested_module_name}', [\n"
) unless module_declaration_present?(nested_module_file)
else
insert_into_file(
app_module_file,
module_declaration,
after: "angular.module 'app', [\n"
) unless module_declaration_present?(app_module_file)
end
end
|
#template_files ⇒ Object
44
|
# File 'lib/rugular/tasks/generate/generator_base.rb', line 44
def template_files; []; end
|