Let apps.json be generated by Liquid template
Instead of plugin as tried first. Turns out github doesn't allow own plugins (unlike gitlab). It is the simpler and more elegant solution any how.master
parent
01d3615663
commit
03d6a50580
|
|
@ -9,4 +9,3 @@ appdates.csv
|
||||||
_config.yml
|
_config.yml
|
||||||
tests/Layout/bin/tmp.*
|
tests/Layout/bin/tmp.*
|
||||||
tests/Layout/testresult.bmp
|
tests/Layout/testresult.bmp
|
||||||
/apps.json
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
class AppsJsonPage < Jekyll::Page
|
|
||||||
def initialize(site)
|
|
||||||
@site = site
|
|
||||||
@base = site.source
|
|
||||||
@basename = 'apps'
|
|
||||||
@ext = '.json'
|
|
||||||
@name = 'apps.json'
|
|
||||||
@data = {}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Generates the apps.json
|
|
||||||
# out of all the /apps/*/metadata.json files
|
|
||||||
class Generator < Jekyll::Generator
|
|
||||||
safe true
|
|
||||||
|
|
||||||
def generate(site)
|
|
||||||
metadatas = site.static_files.select { |file| file.name == 'metadata.json' }
|
|
||||||
json = metadatas.map { |file| JSON.load(open(file.path)) }
|
|
||||||
appsjson = AppsJsonPage.new(site)
|
|
||||||
open(appsjson.path, 'wb') do |file|
|
|
||||||
file << JSON.generate(json)
|
|
||||||
end
|
|
||||||
site.pages << appsjson
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
Reference in New Issue