diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/api/task.rb | 34 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 2 |
3 files changed, 24 insertions, 14 deletions
diff --git a/railties/lib/rails/api/task.rb b/railties/lib/rails/api/task.rb index 3e7223f075..1e6458cf93 100644 --- a/railties/lib/rails/api/task.rb +++ b/railties/lib/rails/api/task.rb @@ -64,17 +64,12 @@ module Rails 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 +79,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 +122,8 @@ module Rails end class RepoTask < Task - def initialize(name) + def load_and_configure_sdoc super - options << '-g' # link to GitHub, SDoc flag end diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 579af8c6a5..93504b3b35 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -107,7 +107,7 @@ module Rails # # The <tt>Application</tt> class adds a couple more paths to this set. And as in your # <tt>Application</tt>, all folders under +app+ are automatically added to the load path. - # If you have an <tt>app/services/tt> folder for example, it will be added by default. + # If you have an <tt>app/services</tt> folder for example, it will be added by default. # # == Endpoint # diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index b3883a94fc..07cf31dd83 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -11,7 +11,7 @@ source 'https://rubygems.org' group :doc do # bundle exec rake doc:rails generates the API under doc/api. - gem 'sdoc' + gem 'sdoc', require: false end # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder |