Sha256: 90320dd335bc87d307786b2c44467db6c49af2761e9210636cfe529e671c1fb7
Contents?: true
Size: 1.2 KB
Versions: 7
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require "jekyll" require "fileutils" module CloudCannonJekyll class Generator < Jekyll::Generator priority :lowest def generate(site) @site = site FileUtils.mkdir_p(File.dirname(destination_path)) File.open(destination_path, "w") { |f| f.write(file_content) } @site.keep_files ||= [] @site.keep_files << "_cloudcannon/details.json" end def source_path path = "_cloudcannon/details.json" path = "_cloudcannon/details-2.x.json" if Jekyll::VERSION.start_with? "2." path = "_cloudcannon/details-3.0.x.json" if Jekyll::VERSION.match? %r!3\.[0-4]\.! File.expand_path(path, File.dirname(__FILE__)) end def destination_path Jekyll.sanitized_path(@site.dest, "_cloudcannon/details.json") end def file_content json = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", "_cloudcannon/details.json") json.content = File.read(source_path) json.data["layout"] = nil json.data["sitemap"] = false json.data["permalink"] = "/_cloudcannon/details.json" json.render({}, @site.site_payload.merge("gem_version" => CloudCannonJekyll::VERSION)) json.output end end end
Version data entries
7 entries across 7 versions & 1 rubygems