class AcosOpenApiHelper::PageCreator
Public Class Methods
createComponents(basePath, title, sidebar, swaggerfile, docFile, componentsKey)
click to toggle source
# File lib/acos_jekyll_openapi.rb, line 234 def self.createComponents(basePath, title, sidebar, swaggerfile, docFile, componentsKey) swaggerfileName = File.basename(swaggerfile, ".*") contentLines = [ "---", "title: %s Models" % title, "keyword: json, openapi, models, components", "sidebars:", " - name: %s" % sidebar, "folder: swagger", "toc: false", "swaggerfile: %s" % swaggerfileName, "swaggerkey: %s" % componentsKey, "permalink: %s_components.html" % docFile, "link: %s_components.html" % docFile, "---", "{% include swagger_json/get_components.md attribute='page.swaggerkey' %}", "", "{% include links.html %}", ] AcosOpenApiHelper::PageCreator.writeFile("%s/pages/swagger/%s_components.md" % [basePath, docFile], contentLines) end
new(path, basePath, output_path, swaggerfile, sidebar, docFile, component)
click to toggle source
# File lib/acos_jekyll_openapi.rb, line 197 def initialize(path, basePath, output_path, swaggerfile, sidebar, docFile, component) # puts "Initialize intput %s, %s, %s, %s" % [path, output_path, swaggerfile, sidebar] @path = path @output_path = output_path @swaggerfile = swaggerfile @sidebar = sidebar @docFile = AcosOpenApiHelper::FileNameGenerator.create(@path, docFile) @basePath = basePath @swaggerfileBase = File.basename(@swaggerfile, ".*") @permalink = AcosOpenApiHelper::PermalinkGenerator.create(path, @swaggerfile) @lines = [ "---", "# THIS PAGE IS GENERATED. ANY CHANGES TO PAGE WILL POTENTIALLY BE OVERWRITTEN.", "title: %s" % path, "keywords: json, openapi", "# summary: test med json fil", " #sidebars: ", " # - name: %s" % @sidebar, "permalink: %s.html" % @permalink, "folder: swagger", "toc: false", "swaggerfile: %s" % @swaggerfileBase, "swaggerpath: paths", "swaggerkey: %s" % @path, "swagger_components: %s" % component, "components_file: %s" % docFile, "---", "{\% include swagger_json/get_path.md \%}" ] end
writeFile(fullPath, contentLines )
click to toggle source
# File lib/acos_jekyll_openapi.rb, line 256 def self.writeFile(fullPath, contentLines ) File.open("%s" % fullPath, "w+") do | f | f.puts(contentLines) end end
Public Instance Methods
write()
click to toggle source
# File lib/acos_jekyll_openapi.rb, line 228 def write File.open("%s/%s/%s/%s.%s" % [@basePath, "pages", "swagger", @docFile, "md"], "w+") do |f| f.puts(@lines) end end