Created
July 2, 2012 18:17
-
-
Save jch/3034703 to your computer and use it in GitHub Desktop.
Revisions
-
jch revised this gist
Jul 2, 2012 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,4 +50,8 @@ # General rack application. If there's a .yardoc directory in the same # directory as .config.ru, then default the lib name to the directory name, # and default options to `{single_library: true, caching: false}` use YARD::Server::RackMiddleware run YourApp # or... also gives defaults if .yardoc is detected run YARD::Server::RackAdapter -
jch revised this gist
Jul 2, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,4 +50,4 @@ # General rack application. If there's a .yardoc directory in the same # directory as .config.ru, then default the lib name to the directory name, # and default options to `{single_library: true, caching: false}` use YARD::Server::RackMiddleware -
jch revised this gist
Jul 2, 2012 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,6 @@ :caching => false }) Surfiki::Application.routes.draw do mount docs => '/doc', anchor: false -
jch revised this gist
Jul 2, 2012 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,6 +28,15 @@ # /js/live.js and /css/custom.css. Is there a way to prefix # all the generated docs with '/doc'? # config/routes.rb doc_server = YARD::Server::RackAdapter.new( {'surfiki' => [YARD::Server::LibraryVersion.new('surfiki', nil, File.expand_path('../../.yardoc', __FILE__))]}, { :single_library => true, :caching => false }) Surfiki::Application.routes.draw do mount docs => '/doc', anchor: false -
jch created this gist
Jul 2, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ # 1) Running a raw RackAdapter in config.ru mounted at '/' works fine require 'bundler/setup' require 'yard' run YARD::Server::RackAdapter.new( {'surfiki' => [YARD::Server::LibraryVersion.new('surfiki', nil, File.expand_path('../.yardoc', __FILE__))]}, { :single_library => true, :caching => false }) # 2) Mapping the adapter to a path fails because # the request path will be anchored at '/yard' map '/yard' do # This will return 404, X-CASCADE: pass and go downstream run YARD::Server::RackAdapter.new( {'surfiki' => [YARD::Server::LibraryVersion.new('surfiki', nil, File.expand_path('../.yardoc', __FILE__))]}, { :single_library => true, :caching => false }) end run Surfiki::Application # downstream rails app # 3) Using Rail's `mount` helper in routes.rb will serve up the proper html, # but the generated docs will reference top level assets like # /js/live.js and /css/custom.css. Is there a way to prefix # all the generated docs with '/doc'? # config/routes.rb Surfiki::Application.routes.draw do mount docs => '/doc', anchor: false # snip... end # 4) Proposed changes for mounting docs alongside another rack app. This # change would be more for convenience and would be backwards compatible # with the old interface. Additionally, change the default routing behavior # to not anchor paths, but allow an option `:anchor` for configuration # General rack application. If there's a .yardoc directory in the same # directory as .config.ru, then default the lib name to the directory name, # and default options to `{single_library: true, caching: false}` use YARD::Server::RackAdapter