diff options
Diffstat (limited to 'railties/Rakefile')
-rw-r--r-- | railties/Rakefile | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/railties/Rakefile b/railties/Rakefile index 174c85b59a..ec2fe850e6 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -272,20 +272,49 @@ Rake::RDocTask.new { |rdoc| rdoc.rdoc_files.include('lib/commands/**/*.rb') } -guides = ['securing_rails_applications', 'testing_rails_applications', 'creating_plugins'] -guides_html_files = [] -guides.each do |guide_name| - input = "doc/guides/#{guide_name}/#{guide_name}.txt" - output = "doc/guides/#{guide_name}/#{guide_name}.html" +# In this array, one defines the guides for which HTML output should be +# generated. Specify the folder names of the guides. If the .txt filename +# doesn't equal its folder name, then specify a hash: { 'folder_name' => 'basename' } +guides = [ + 'getting_started_with_rails', + 'securing_rails_applications', + 'testing_rails_applications', + 'creating_plugins', + 'migrations', + { 'routing' => 'routing_outside_in' }, + { 'forms' =>'form_helpers' }, + { 'activerecord' => 'association_basics' }, + { 'debugging' => 'debugging_rails_applications' } +] + +guides_html_files = [] # autogenerated from the 'guides' variable. +guides.each do |entry| + if entry.is_a?(Hash) + guide_folder = entry.keys.first + guide_name = entry.values.first + else + guide_folder = entry + guide_name = entry + end + input = "doc/guides/#{guide_folder}/#{guide_name}.txt" + output = "doc/guides/#{guide_folder}/#{guide_name}.html" guides_html_files << output - file output => Dir["doc/guides/#{guide_name}/*.txt"] do - sh "mizuho", input, "--template", "manualsonrails", "--multi-page", - "--icons-dir", "../icons" + task output => Dir["doc/guides/#{guide_folder}/*.txt"] do + ENV['MANUALSONRAILS_INDEX_URL'] = '../index.html' + ENV.delete('MANUALSONRAILS_TOC') + sh "mizuho", input, "--template", "manualsonrails", "--icons-dir", "../icons" end end +task 'doc/guides/index.html' => 'doc/guides/index.txt' do + ENV.delete('MANUALSONRAILS_INDEX_URL') + ENV['MANUALSONRAILS_TOC'] = 'no' + sh "mizuho", 'doc/guides/index.txt', "--template", "manualsonrails", "--icons-dir", "icons" +end + desc "Generate HTML output for the guides" task :generate_guides => guides_html_files +task :generate_guides => 'doc/guides/index.html' # Generate GEM ---------------------------------------------------------------------------- |