diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/api/task.rb | 15 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/railties/lib/rails/api/task.rb b/railties/lib/rails/api/task.rb index 3e7223f075..81d6dea792 100644 --- a/railties/lib/rails/api/task.rb +++ b/railties/lib/rails/api/task.rb @@ -69,12 +69,11 @@ module Rails options << '-m' << api_main options << '-e' << 'UTF-8' - options << '-f' << 'sdoc' - options << '-T' << 'rails' configure_rdoc_files before_running_rdoc do + load_and_configure_sdoc setup_horo_variables end end @@ -84,6 +83,15 @@ module Rails # no-op end + def load_and_configure_sdoc + require 'sdoc' + 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 +119,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/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 |