sbt / sbt-ghpages

git, site and ghpages support for sbt projects.
Other
91 stars 20 forks source link

Provide `includeFilter in cleanSite` and `excludeFilter in cleanSite` #17

Closed arashi01 closed 8 years ago

arashi01 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

CLA signed and submitted.

arashi01 commented 8 years ago

Oh, and this sorts out #10

EntilZha commented 8 years ago

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

EntilZha commented 8 years ago

@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 commented 8 years ago

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

eed3si9n commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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

arashi01 commented 8 years ago

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

eed3si9n commented 8 years ago

Merged. Thanks for the contribution.