Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add rake task for generating a subset of guides

  rake guides ONLY='migrations i18n'

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 4059f0477dc0504eed4c989560e92f60e9e7d764 1 parent fe01a13
Karel Minarik karmi authored lifo committed
Showing with 13 additions and 3 deletions.
  1. +13 −3 railties/Rakefile
16 railties/Rakefile
View
@@ -272,7 +272,7 @@ Rake::RDocTask.new { |rdoc|
rdoc.rdoc_files.include('lib/commands/**/*.rb')
}
-desc "Generate guides for the framework"
+desc "Generate guides for the framework. Use ONLY='migrations i18n.txt' option to build just specific ones."
task :guides do
require 'mizuho/generator'
@@ -289,8 +289,18 @@ task :guides do
indexless = ['index.txt', 'authors.txt']
- # Traverse all entries in doc/guides/source/
- Dir.entries(source).each do |entry|
+ # Traverse all entries in doc/guides/source/ or only those specified in ONLY env variable
+ entries = Dir.entries(source)
+ if ENV['ONLY']
+ only = ENV['ONLY'].split(' ')
+ unless only.empty?
+ entries = entries.select do |e|
+ only.include?(e) || only.include?(e.sub(/\.txt$/, ''))
+ end
+ end
+ end
+
+ entries.each do |entry|
next if ignore.include?(entry)
if File.directory?(File.join(source, entry))
Please sign in to comment.
Something went wrong with that request. Please try again.