Skip to content

Commit

Permalink
move API generator to post-write hook
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Dec 12, 2024
1 parent a120ba8 commit 9c803bf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
5 changes: 3 additions & 2 deletions _plugins/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module Generators
##
# This class generates the GTN's "api" by writing out a folder full of JSON files.
# TODO: could be a post-write hook.
class APIGenerator < Generator
class APIGenerator

##
# Generates /api/configuration.json
Expand Down Expand Up @@ -342,7 +342,6 @@ def generate(site)
end
end


Jekyll::Hooks.register :site, :post_read do |site|
Gtn::Hooks.by_tool(site)
end
Expand All @@ -351,6 +350,8 @@ def generate(site)
Jekyll::Hooks.register :site, :post_write do |site|
# No need to run this except in prod.
if Jekyll.env == 'production'
# Our API
Jekyll::Generators::APIGenerator.generate(site)

# Public tool listing: reorganised
if site.data['public-server-tools'] && site.data['public-server-tools']['tools']
Expand Down
1 change: 0 additions & 1 deletion _plugins/generator-workflows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module Jekyll
#
# Real Generators, the way Jekyll intended:
#
# - Jekyll::Generators::APIGenerator - outputs our API
# - Jekyll::Generators::PlaintextSlidesGenerator - turns slides.html into plain text non-JS versions.
# - Jekyll::Generators::RecordingPageGenerator - emits a webpage for every tutorial that has recordings, in the GTN
# - Jekyll::Generators::WorkflowPageGenerator - emits a webpage for every workflow in the GTN
Expand Down
10 changes: 0 additions & 10 deletions _plugins_dev/api-fake.rb

This file was deleted.

0 comments on commit 9c803bf

Please sign in to comment.