Update generator‘s action manifest.
Methods
Public Instance methods
[ show source ]
# File railties/lib/rails_generator/commands.rb, line 594
594: def complex_template(relative_source, relative_destination, template_options = {})
595:
596: begin
597: dest_file = destination_path(relative_destination)
598: source_to_update = File.readlines(dest_file).join
599: rescue Errno::ENOENT
600: logger.missing relative_destination
601: return
602: end
603:
604: logger.refreshing "#{template_options[:insert].gsub(/\.erb/,'')} inside #{relative_destination}"
605:
606: begin_mark = Regexp.quote(template_part_mark(template_options[:begin_mark], template_options[:mark_id]))
607: end_mark = Regexp.quote(template_part_mark(template_options[:end_mark], template_options[:mark_id]))
608:
609: # Refreshing inner part of the template with freshly rendered part.
610: rendered_part = render_template_part(template_options)
611: source_to_update.gsub!(/#{begin_mark}.*?#{end_mark}/m, rendered_part)
612:
613: File.open(dest_file, 'w') { |file| file.write(source_to_update) }
614: end
[ show source ]
# File railties/lib/rails_generator/commands.rb, line 616
616: def directory(relative_path)
617: # logger.directory "#{destination_path(relative_path)}/"
618: end
[ show source ]
# File railties/lib/rails_generator/commands.rb, line 586
586: def file(relative_source, relative_destination, options = {})
587: # logger.file relative_destination
588: end
[ show source ]
# File railties/lib/rails_generator/commands.rb, line 590
590: def template(relative_source, relative_destination, options = {})
591: # logger.template relative_destination
592: end