mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
fix broken urls in swagger files for engine api
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -49,14 +49,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
Jekyll.logger.info " Fixing up URLs in swagger files"
|
||||
Dir.glob("./engine/api/*.yaml") do |file_name|
|
||||
Jekyll.logger.info " #{file_name}"
|
||||
text = File.read(file_name)
|
||||
replace = text.gsub!("https://docs.docker.com/", "")
|
||||
File.open(file_name, "w") { |file| file.puts replace }
|
||||
end
|
||||
|
||||
end_time = Time.now
|
||||
Jekyll.logger.info "done in #{(end_time - beginning_time)} seconds"
|
||||
end
|
||||
|
||||
24
_plugins/fix_urls.rb
Normal file
24
_plugins/fix_urls.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
require 'jekyll'
|
||||
require 'octopress-hooks'
|
||||
|
||||
module Jekyll
|
||||
|
||||
class FetchRemote < Octopress::Hooks::Site
|
||||
def post_read(site)
|
||||
beginning_time = Time.now
|
||||
Jekyll.logger.info "Starting plugin fix_urls.rb..."
|
||||
|
||||
Jekyll.logger.info " Fixing up URLs in swagger files"
|
||||
Dir.glob(%w[./docker-hub/api/*.yaml ./engine/api/*.yaml]) do |file_name|
|
||||
Jekyll.logger.info " #{file_name}"
|
||||
text = File.read(file_name)
|
||||
replace = text.gsub!("https://docs.docker.com", "")
|
||||
File.open(file_name, "w") { |file| file.puts replace }
|
||||
end
|
||||
|
||||
end_time = Time.now
|
||||
Jekyll.logger.info "done in #{(end_time - beginning_time)} seconds"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user