Update generator’s action manifest.
Methods
- C
- D
- F
- T
Instance Public methods
# File railties/lib/rails_generator/commands.rb, line 589 589: def complex_template(relative_source, relative_destination, template_options = {}) 590: 591: begin 592: dest_file = destination_path(relative_destination) 593: source_to_update = File.readlines(dest_file).join 594: rescue Errno::ENOENT 595: logger.missing relative_destination 596: return 597: end 598: 599: logger.refreshing "#{template_options[:insert].gsub(/\.erb/,'')} inside #{relative_destination}" 600: 601: begin_mark = Regexp.quote(template_part_mark(template_options[:begin_mark], template_options[:mark_id])) 602: end_mark = Regexp.quote(template_part_mark(template_options[:end_mark], template_options[:mark_id])) 603: 604: # Refreshing inner part of the template with freshly rendered part. 605: rendered_part = render_template_part(template_options) 606: source_to_update.gsub!(/#{begin_mark}.*?#{end_mark}/m, rendered_part) 607: 608: File.open(dest_file, 'w') { |file| file.write(source_to_update) } 609: end