Sha256: 4ba6667cd9de0826e21540ea55fd5cd30466fd108e8ef7a7f285194d1b588a6e
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 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" unless (%r!3\.[0-4]\.! =~ Jekyll::VERSION).nil? 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cloudcannon-jekyll-0.0.8 | lib/cloudcannon-jekyll/generator.rb |
cloudcannon-jekyll-0.0.7 | lib/cloudcannon-jekyll/generator.rb |
cloudcannon-jekyll-0.0.6 | lib/cloudcannon-jekyll/generator.rb |