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 calling #write twice #1085

Merged
merged 10 commits into from Feb 17, 2017

Conversation

Projects
None yet
1 participant
@ddfreyne
Member

ddfreyne commented Feb 17, 2017

Fixes #1037. Allows calling #write multiple times.

Steps:

  • Allow snapshot actions to have multiple names
  • Allow snapshot actions to have multiple paths
  • Allow item reps to have multiple paths per snapshot
  • Merge consecutive snapshot actions into one
  • Assign unique names to snapshot actions with no names
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 17, 2017

Member

Forward path references continue to be a pain… e.g.

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

(:raw and :last snapshots added for clarity.)

The issue is here is that rep.path is hard to predict. If it were to return a string, then the :last snapshot will have a path, while the :raw snapshot does not. This is in line with expectations.

Now consider this example, where write and filter are inverted:

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

If rep.path were to return a string, then the :last snapshot will not have a path. Inversely, if rep.path returns nil, then the :last snapshot will have a path. This contradicts itself!

Member

ddfreyne commented Feb 17, 2017

Forward path references continue to be a pain… e.g.

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

(:raw and :last snapshots added for clarity.)

The issue is here is that rep.path is hard to predict. If it were to return a string, then the :last snapshot will have a path, while the :raw snapshot does not. This is in line with expectations.

Now consider this example, where write and filter are inverted:

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

If rep.path were to return a string, then the :last snapshot will not have a path. Inversely, if rep.path returns nil, then the :last snapshot will have a path. This contradicts itself!

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Feb 17, 2017

Member

I’ve decided to not deal with the non-convergence issue yet. I believe this could be detected (i.e. if the paths have not yet converged after two attempts at calculating them, raise an error).

Member

ddfreyne commented Feb 17, 2017

I’ve decided to not deal with the non-convergence issue yet. I believe this could be detected (i.e. if the paths have not yet converged after two attempts at calculating them, raise an error).

@ddfreyne ddfreyne modified the milestones: 4.6.1, 4.6.2 Feb 17, 2017

@ddfreyne ddfreyne merged commit 1378038 into master Feb 17, 2017

1 check passed

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

@ddfreyne ddfreyne deleted the write-twice branch Feb 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment