Flowdock
method

generate_guide

Importance_0
generate_guide(guide) public

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 38
    def generate_guide(guide)
      guide =~ /(.*?)(\.erb)?\.textile/
      name = $1

      puts "Generating #{name}"

      file = File.join(output, "#{name}.html")
      File.open(file, 'w') do |f|
        @view = ActionView::Base.new(view_path)
        @view.extend(Helpers)

        if guide =~ /\.erb\.textile/
          # Generate the erb pages with textile formatting - e.g. index/authors
          result = view.render(:layout => 'layout', :file => name)
          f.write textile(result)
        else
          body = File.read(File.join(view_path, guide))
          body = set_header_section(body, @view)
          body = set_index(body, @view)

          result = view.render(:layout => 'layout', :text => textile(body))
          f.write result
          warn_about_broken_links(result)
        end
      end
    end
Register or log in to add new notes.