Class: Rugular::GeneratorBase
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Rugular::GeneratorBase
- 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
16 17 18 |
# File 'lib/rugular/tasks/generate/generator_base.rb', line 16 def self.source_root __dir__.chomp('/tasks/generate') end |
Instance Method Details
#create_route_folders ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rugular/tasks/generate/generator_base.rb', line 20 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_app_module ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rugular/tasks/generate/generator_base.rb', line 34 def inject_module_into_app_module insert_into_file( app_module_file, module_declaration, after: "angular.module 'app', [\n" ) unless module_declaration_present? end |
#template_files ⇒ Object
42 |
# File 'lib/rugular/tasks/generate/generator_base.rb', line 42 def template_files; []; end |