don't require loading the whole rails stack to generate api docs

This works more seamlessly with our deploy process, and fixes
canvas:compile_assets which was now requiring a full rails environment
to be set up.

(also, it's faster)

Change-Id: I98eae23c9c75051815e70da99b32695c796c5c80
Reviewed-on: https://gerrit.instructure.com/4725
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
Brian Palmer 2011-07-19 14:05:12 -06:00
parent b801cccc81
commit 7054dd9926
3 changed files with 8 additions and 2 deletions

View File

@ -644,7 +644,7 @@ ActionController::Routing::Routes.draw do |map|
map.resources :jobs, :only => %w(index), :collection => %w[batch_update]
Jammit::Routes.draw(map)
Jammit::Routes.draw(map) if defined?(Jammit)
# API routes
ApiRouteSet.new(map, "/api/v1") do |api|

View File

@ -16,6 +16,12 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require 'lib/api_route_set'
require 'bundler'
Bundler.setup
require 'action_controller'
require 'config/routes'
# Extend YARD to generate our API documentation
YARD::Tags::Library.define_tag("Is an API method", :API)
YARD::Tags::Library.define_tag("API method argument", :argument)

View File

@ -7,7 +7,7 @@ namespace :doc do
YARD::Rake::YardocTask.new(:api) do |t|
FileUtils.rm_rf(API_DOC_DIR)
t.files = ["app/controllers/*.rb"]
t.options = ["-e", "config/environment.rb", "-e", "lib/api_routes.rb", "--title", "Canvas REST API", "-p", "doc/templates", "-t", "rest", "--readme", "doc/templates/rest/README.md", "-o", API_DOC_DIR]
t.options = ["-e", "lib/api_routes.rb", "--title", "Canvas REST API", "-p", "doc/templates", "-t", "rest", "--readme", "doc/templates/rest/README.md", "-o", API_DOC_DIR]
end
task 'api' do |t|