aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhenium <rhenium@rhe.jp>2014-01-08 21:46:00 +0900
committerRhenium <rhenium@rhe.jp>2014-01-08 21:46:00 +0900
commitc766f011e4cda8612911ef031a26a448f8957add (patch)
tree50d8df01bc435203d2062a197a51cd8ffbc55cf8
parent5100da2f4de81aed6eb571b8f78c2d6f89eb87ab (diff)
downloadaclog-c766f011e4cda8612911ef031a26a448f8957add.tar.gz
implement Apidoc.reload!
-rw-r--r--app/controllers/apidocs_controller.rb2
-rw-r--r--lib/apidoc.rb7
2 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/apidocs_controller.rb b/app/controllers/apidocs_controller.rb
index 11c0f34..7a86fe1 100644
--- a/app/controllers/apidocs_controller.rb
+++ b/app/controllers/apidocs_controller.rb
@@ -21,7 +21,7 @@ class ApidocsController < ApplicationController
private
def reload_docs
- Apidoc.reload_docs if Rails.env.development?
+ Apidoc.reload! if Rails.env.development?
end
end
diff --git a/lib/apidoc.rb b/lib/apidoc.rb
index fe64f6b..c85eceb 100644
--- a/lib/apidoc.rb
+++ b/lib/apidoc.rb
@@ -7,6 +7,11 @@ module Apidoc
@@resources ||= {}
end
- def reload_docs
+ def reload!
+ @@resources = nil
+ dir = "#{Rails.root}/app/controllers/"
+ Dir.glob("#{dir}**/*.rb") do |path|
+ ActiveSupport::Dependencies.load_file path
+ end
end
end