Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow querying path in compilation rule #964

merged 4 commits into from Oct 23, 2016


Copy link

@ddfreyne ddfreyne commented Oct 23, 2016

This makes rep.path in compilation rules not be nil when the rep gets a route assigned to it later on.

To do

  • Tests
  • Refactoring

Detailed description

The following now behaves as expected:

compile '/**/*' do
  filter :relativize_paths, type: :html unless rep.path.nil?
  write item.identifier.without_ext + '.html'

The :relativize_paths filter will now be executed, even though the path is only assigned later.

This happens because compilation is now done in three steps:

  1. Calculate rule memory, and build snapshot-path pairs for each rep
  2. Recalculate rule memory using snapshot-path pairs calculated before
  3. Perform actual compilation

Previously, there were only two steps:

  1. Calculate rule memory
  2. Perform actual compilation

The rule memory depends on the paths, and so the extra step is necessary.

Related issues

Fixes #954.

@ddfreyne ddfreyne force-pushed the gh-954-query-path-in-compilation-rule branch from 498bc96 to fb26be1 Oct 23, 2016
@ddfreyne ddfreyne changed the title Gh 954 query path in compilation rule Allow querying path in compilation rule Oct 23, 2016
@ddfreyne ddfreyne merged commit ff1a649 into master Oct 23, 2016
1 check passed
@ddfreyne ddfreyne deleted the gh-954-query-path-in-compilation-rule branch Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant