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

Conversation

Projects
None yet
1 participant
@ddfreyne
Copy link
Member

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 ddfreyne force-pushed the write-twice branch 4 times, most recently from 4a526b8 to be6cae3 Feb 17, 2017

@ddfreyne ddfreyne force-pushed the write-twice branch from 0c878e0 to 113c8ed Feb 17, 2017

@ddfreyne ddfreyne force-pushed the write-twice branch 2 times, most recently from 22c9ce8 to 6c0b848 Feb 17, 2017

@ddfreyne ddfreyne force-pushed the write-twice branch from 6c0b848 to b1f1479 Feb 17, 2017

@ddfreyne

This comment has been minimized.

Copy link
Member Author

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.

Copy link
Member Author

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 force-pushed the write-twice branch from 7e6ee04 to 73f6a82 Feb 17, 2017

@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
You can’t perform that action at this time.