Skip to content

Commit

Permalink
Merge pull request #300 from ryanische/multi-folder-cache-fix
Browse files Browse the repository at this point in the history
Proper url_prefix when doc_base_url has multiple folders
  • Loading branch information
iNecas committed Nov 3, 2014
2 parents a4d6ffc + 65c5f7c commit f2948c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/tasks/apipie.rake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace :apipie do
puts "#{Time.now} | Processing docs for #{lang}"
cache_dir = ENV["OUT"] || Apipie.configuration.cache_dir
subdir = Apipie.configuration.doc_base_url.sub(/\A\//,"")
subdir_levels = subdir.split('/').length
subdir_traversal_prefix = '../' * subdir_levels
file_base = File.join(cache_dir, Apipie.configuration.doc_base_url)

if generate_index
Expand All @@ -78,15 +80,15 @@ namespace :apipie do
end
Apipie.available_versions.each do |version|
file_base_version = File.join(file_base, version)
Apipie.url_prefix = "../#{subdir}"
Apipie.url_prefix = "#{subdir_traversal_prefix}#{subdir}"
doc = Apipie.to_json(version, nil, nil, lang)
doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")

generate_index_page(file_base_version, doc, true, true, lang) if generate_index
if generate_resources
Apipie.url_prefix = "../../#{subdir}"
Apipie.url_prefix = "../#{subdir_traversal_prefix}#{subdir}"
generate_resource_pages(version, file_base_version, doc, true, lang)
Apipie.url_prefix = "../../../#{subdir}"
Apipie.url_prefix = "../../#{subdir_traversal_prefix}#{subdir}"
generate_method_pages(version, file_base_version, doc, true, lang)
end
end
Expand Down

0 comments on commit f2948c4

Please sign in to comment.