aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/api
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-03-30 11:22:40 +0100
committerXavier Noria <fxn@hashref.com>2013-03-30 11:34:35 +0100
commitf01b7570c5b2ec16083aaaa8b7e53441c74bfbb8 (patch)
tree966aa27807a1a543279f85402bb21727be717e52 /railties/lib/rails/api
parent51908718227f2cef80113d85a0fb9eb65ded3f4e (diff)
downloadrails-f01b7570c5b2ec16083aaaa8b7e53441c74bfbb8.tar.gz
rails-f01b7570c5b2ec16083aaaa8b7e53441c74bfbb8.tar.bz2
rails-f01b7570c5b2ec16083aaaa8b7e53441c74bfbb8.zip
be lazy loading SDoc
Diffstat (limited to 'railties/lib/rails/api')
-rw-r--r--railties/lib/rails/api/task.rb15
1 files changed, 11 insertions, 4 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