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

Merged
merged 10 commits into from Feb 17, 2017
Merged

Allow calling #write twice #1085

merged 10 commits into from Feb 17, 2017

Conversation

denisdefreyne
Copy link
Member

@denisdefreyne denisdefreyne 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

@denisdefreyne denisdefreyne force-pushed the write-twice branch 2 times, most recently from 22c9ce8 to 6c0b848 Compare February 17, 2017 11:16
@denisdefreyne
Copy link
Member Author

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!

@denisdefreyne
Copy link
Member Author

denisdefreyne 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).

@denisdefreyne denisdefreyne modified the milestones: 4.6.1, 4.6.2 Feb 17, 2017
@denisdefreyne denisdefreyne merged commit 1378038 into master Feb 17, 2017
@denisdefreyne denisdefreyne deleted the write-twice branch February 17, 2017 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant