diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-10-21 15:58:29 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-21 16:04:38 +0100 |
commit | 5265a8cd40a59ae792da3ed3f2a9648f15ecbd4e (patch) | |
tree | 44f66c3d1552e1821454658c653f062baada8668 /railties/Rakefile | |
parent | fa09de351c8045c7e7a0f268188ccf80c827b079 (diff) | |
download | rails-5265a8cd40a59ae792da3ed3f2a9648f15ecbd4e.tar.gz rails-5265a8cd40a59ae792da3ed3f2a9648f15ecbd4e.tar.bz2 rails-5265a8cd40a59ae792da3ed3f2a9648f15ecbd4e.zip |
Rearrange guides
Diffstat (limited to 'railties/Rakefile')
-rw-r--r-- | railties/Rakefile | 81 |
1 files changed, 32 insertions, 49 deletions
diff --git a/railties/Rakefile b/railties/Rakefile index 0837e71ceb..32146ced77 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -272,58 +272,41 @@ Rake::RDocTask.new { |rdoc| rdoc.rdoc_files.include('lib/commands/**/*.rb') } -# 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', - # 'testing_rails_applications', - 'creating_plugins', - 'actioncontroller', - 'migrations', - { 'securing_rails_applications' => 'security' }, - { 'routing' => 'routing_outside_in' }, - { 'forms' =>'form_helpers' }, - { 'activerecord' => 'association_basics' }, - { 'activerecord' => 'finders' }, - { 'debugging' => 'debugging_rails_applications' }, - { 'caching' => 'caching_with_rails' }, - { 'benchmarking_and_profiling' => 'index' }, - { 'actionview' => 'layouts_and_rendering' } -] - -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 - 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 - -['index', 'authors'].each do |guide| - task "doc/guides/#{guide}.html" => "doc/guides/#{guide}.txt" do - ENV.delete('MANUALSONRAILS_INDEX_URL') - ENV['MANUALSONRAILS_TOC'] = 'no' - sh "mizuho", "doc/guides/#{guide}.txt", "--template", "manualsonrails", "--icons-dir", "icons" +desc "Generate guides for the framework" +task :guides do + require 'mizuho/generator' + + source = "doc/guides/source/" + html = "doc/guides/html/" + ignore = ['icons', 'images'] + ignore << 'active_record_basics.txt' + + indexless = ['index.txt', 'authors.txt'] + + Dir.entries(source)[2..-1].each do |entry| + next if ignore.include?(entry) + + if File.directory?(File.join(source, entry)) + input = File.join(source, entry, 'index.txt') + output = File.join(html, "#{entry}.html") + else + input = File.join(source, entry) + output = File.join(html, entry).sub(/\.txt$/, '') + end + + begin + puts "GENERATING => #{output}" + ENV['MANUALSONRAILS_TOC'] = 'no' if indexless.include?(entry) + Mizuho::Generator.new(input, output, 'manualsonrails', nil, File.expand_path(File.join(source, 'icons'))).start + rescue Mizuho::GenerationError + STDERR.puts "*** ERROR" + exit 2 + ensure + ENV.delete('MANUALSONRAILS_TOC') + end end end -desc "Generate HTML output for the guides" -task :generate_guides => guides_html_files -task :generate_guides => 'doc/guides/index.html' -task :generate_guides => 'doc/guides/authors.html' - # Generate GEM ---------------------------------------------------------------------------- task :copy_gem_environment do |