Flowdock
method

generate_guide

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: RailsGuides::Generator

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.2.13) is shown here.

generate_guide(guide, output_file) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File railties/guides/rails_guides/generator.rb, line 196
    def generate_guide(guide, output_file)
      output_path = output_path_for(output_file)
      puts "Generating #{guide} as #{output_file}"
      layout = kindle? ? 'kindle/layout' : 'layout'

      File.open(output_path, 'w') do |f|
        view = ActionView::Base.new(source_dir, :edge => @edge, :version => @version, :mobi => "kindle/#{mobi}")
        view.extend(Helpers)

        if guide =~ /\.(\w+)\.erb$/
          # Generate the special pages like the home.
          # Passing a template handler in the template name is deprecated. So pass the file name without the extension.
          result = view.render(:layout => layout, :formats => [$1], :file => $`)
        else
          body = File.read(File.join(source_dir, guide))
          body = set_header_section(body, view)
          body = set_index(body, view)

          result = view.render(:layout => layout, :text => textile(body))

          warn_about_broken_links(result) if @warnings
        end

        f.write(result)
      end
    end
Register or log in to add new notes.