18F / jekyll_pages_api

a Jekyll Plugin that generates a JSON file with data for all the Pages in your Site
Other
43 stars 14 forks source link

switch to Jekyll 3 hooks #28

Open afeld opened 9 years ago

afeld commented 9 years ago

The current implementation uses monkeypatching to trigger the build of the JSON pages. Jekyll 3 added "hooks", which should allow this gem to integrate in a cleaner way.

http://jekyllrb.com/docs/plugins/#hooks

mbland commented 9 years ago

Sweeet... :smile:

afeld commented 8 years ago

The current code that's doing the hooking in to Jekyll is here:

https://github.com/18F/jekyll_pages_api/blob/master/lib/jekyll/site.rb

In other words, this would mean refactoring/removing what's in that file do avoid monkey-patching for Jekyll 3.

zoeyronain commented 8 years ago

Sorry, I'm confused. what needs to be removed/refactored?

afeld commented 8 years ago

@siadevelopment Well, I don't know, really...that's part of the task here, I guess :wink:

fozcodes commented 8 years ago

Hey guys,

Started some work on this and trying to integrate the Appraisal gem to make testing multiple versions easier.

Turns out though, the first Jekyll 3 no longer has Jekyll::Post as a class, which is causing failing tests from here:

https://github.com/fosberyi/jekyll_pages_api/blob/support_more_jekyll_versions/spec/support/create_page.rb#L37

I'm trying to figure out what the new inner-workings of Jekyll are but I'm having some trouble and could use some help (this is my first time doing anything Jekyll related - apologies). Just need to figure out what class/methods we should be using in the Jekyll lib to create a test post so we can get all of these tests passing again for 3.0 and 3.1. Once that's finished, I can start work on re-factoring to use the hooks instead of the monkey-patch.

fozcodes commented 8 years ago

/cc #31

Got this figured out. Once that PR's in I can take a crack at moving this to hooks correctly.