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
merged 4 commits into from Oct 23, 2016

Conversation

Projects
None yet
1 participant
@ddfreyne
Member

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'
end

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 added some commits Oct 23, 2016

@ddfreyne ddfreyne added this to the 4.3.6 milestone Oct 23, 2016

@ddfreyne ddfreyne changed the title from Gh 954 query path in compilation rule to Allow querying path in compilation rule Oct 23, 2016

@ddfreyne ddfreyne merged commit ff1a649 into master Oct 23, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@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