fix broken urls in swagger files for engine api

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-05-21 08:44:10 +02:00
parent 8d6bd6bdb5
commit 93315b50cc
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