Merge pull request #14795 from crazy-max/fix-swagger-urls

fix broken urls in swagger files for engine api
This commit is contained in:
Sebastiaan van Stijn 2022-05-21 09:26:09 +02:00 committed by GitHub
commit a64edf03dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 8 deletions

View File

@ -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
View 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