diff options
Diffstat (limited to 'railties/lib/rails/api')
-rw-r--r-- | railties/lib/rails/api/task.rb | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/railties/lib/rails/api/task.rb b/railties/lib/rails/api/task.rb index 3e7223f075..c829873da4 100644 --- a/railties/lib/rails/api/task.rb +++ b/railties/lib/rails/api/task.rb @@ -57,24 +57,20 @@ module Rails CHANGELOG.md MIT-LICENSE lib/**/*.rb - ) + ), + :exclude => 'lib/rails/generators/rails/**/templates/**/*.rb' } } def initialize(name) super - self.title = 'Ruby on Rails API' - self.rdoc_dir = api_dir - - options << '-m' << api_main - options << '-e' << 'UTF-8' - options << '-f' << 'sdoc' - options << '-T' << 'rails' - - configure_rdoc_files - + # Every time rake runs this task is instantiated as all the rest. + # Be lazy computing stuff to have as light impact as possible to + # the rest of tasks. before_running_rdoc do + load_and_configure_sdoc + configure_rdoc_files setup_horo_variables end end @@ -84,6 +80,22 @@ module Rails # no-op end + def load_and_configure_sdoc + require 'sdoc' + + self.title = 'Ruby on Rails API' + self.rdoc_dir = api_dir + + options << '-m' << api_main + options << '-e' << 'UTF-8' + + options << '-f' << 'sdoc' + options << '-T' << 'rails' + rescue LoadError + $stderr.puts %(Unable to load SDoc, please add\n\n gem 'sdoc', require: false\n\nto the Gemfile.) + exit 1 + end + def configure_rdoc_files rdoc_files.include(api_main) @@ -111,9 +123,8 @@ module Rails end class RepoTask < Task - def initialize(name) + def load_and_configure_sdoc super - options << '-g' # link to GitHub, SDoc flag end |