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

Provide includeFilter in cleanSite and excludeFilter in cleanSite #17

Merged
merged 1 commit into from
Sep 16, 2016

Conversation

arashi01
Copy link

Was having an issue with using sbt-site with sbt-ghpages to publish current site and API documentation while retaining previous released API documentation folders. (ie cleanSite would wipe out everything already in the gh-pages branch).

This adds a protectedFiles settingKey which allows one to specify a Seq[String] of file or directory paths relative to the repository root which, if existing, should be excluded from clean and should not be overwritten.

@lightbend-cla-validator

Hi @arashi01,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Typesafe Contributors License Agreement:

http://www.lightbend.com/contribute/cla

@arashi01
Copy link
Author

CLA signed and submitted.

@arashi01
Copy link
Author

Oh, and this sorts out #10

@EntilZha
Copy link

EntilZha commented Jul 3, 2016

Any updates on PR? This seems useful to solve a problem I am having with the CNAME file getting wiped out

@EntilZha
Copy link

@jsuereth or @typesafehub-validator is there a reason this hasn't been merged in yet? I again stumbled into this for the purpose the PR was made: not clobbering older documentation for specific versions. It would be great to get an update whatever the status of the repo to know if we should use this plugin or something separate (eg still maintained or no longer maintained).

@arashi01
Copy link
Author

@eed3si9n can you have a look at this?

As @EntilZha mentioned, clobbering older documentation is not ideal. If there is an issue with the implementation let us know so it can be fixed.

@@ -1,5 +1,7 @@
package com.typesafe.sbt

import java.nio.file.Files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What feature in NIO that was needed that's not in sbt's IO?

Copy link

@michaelahlers michaelahlers Sep 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arashi01, consider isDirectory provided by sbt.RichFile.

@eed3si9n
Copy link
Member

This plugin is not maintained by Lightbend's sbt team, so I could help review this but ultimately it's up to the current maintainers.

@eed3si9n
Copy link
Member

As per #10, I don't know if black list approach would is the answer here. I feel like it's safer to let the user declare white list of paths that sbt-ghpages should remove as a sequence of patterns.

@arashi01
Copy link
Author

@eed3si9n agreed about the white-list based approach.

I've removed the protectedFiles key added in the previous commit in favour of using only the built in includeFilter and excludeFilter keys, scoped to the cleanSite task.

Files will only be deleted if they are accepted by the filter defined in includeFilter in cleanSite AND are not accepted by the filter defined in excludeFilter in cleanSite.

The default settings are AllPassFilter and NothingFilter respectively, so behaviour will remain unchanged for users not configuring the new settings explicitly.

@eed3si9n
Copy link
Member

That looks good. Could you also add some documentation in the readme on how to use it, plz?

…` settings to allow user specified FileFilters defining files which may be deleted.

Update documentation with guide to protecting files.
@arashi01
Copy link
Author

Documentation updated to show example, and commits squashed + rebased against current.

@eed3si9n eed3si9n changed the title Add protectedFiles setting key for files/directories which should not be cleaned or overwritten. Provide includeFilter in cleanSite and excludeFilter in cleanSite Sep 16, 2016
@eed3si9n eed3si9n merged commit eb1e605 into sbt:master Sep 16, 2016
@eed3si9n
Copy link
Member

Merged. Thanks for the contribution.

@arashi01 arashi01 deleted the protected_files branch September 16, 2016 04:51
rossabaker added a commit to http4s/http4s that referenced this pull request Sep 22, 2016
We apparently can't set keys not defined in an *.sbt from the command
line, so those needed to move.

Once moved to *.sbt, the *.scala files can't see them to declare tasks,
so the binding of values to the hack in Http4sGhPages also had to move.
That's hopefully all temporary, because sbt/sbt-ghpages#17.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants