Class Rails::Generator::Commands::Update
In: vendor/rails/railties/lib/rails_generator/commands.rb
Parent: Create

Update generator‘s action manifest.

Methods

Public Instance methods

[Source]

     # File vendor/rails/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

[Source]

     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 611
611:         def directory(relative_path)
612:           # logger.directory "#{destination_path(relative_path)}/"
613:         end

[Source]

     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 581
581:         def file(relative_source, relative_destination, options = {})
582:           # logger.file relative_destination
583:         end

[Source]

     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 585
585:         def template(relative_source, relative_destination, options = {})
586:           # logger.template relative_destination
587:         end

[Validate]