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

use slash syntax instead of deprecated in #88

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait GhpagesKeys {
lazy val ghpagesNoJekyll = settingKey[Boolean]("If this flag is set, ghpages will automatically generate a .nojekyll file to prevent github from running jekyll on pushed sites.")
lazy val ghpagesUpdatedRepository = taskKey[File]("Updates the local ghpages branch on the sandbox repository.")
// Note: These are *only* here in the event someone wants to completely bypass the sbt-site plugin.
lazy val ghpagesPrivateMappings = mappings in ghpagesSynchLocal
lazy val ghpagesPrivateMappings = ghpagesSynchLocal / mappings
lazy val ghpagesSynchLocal = taskKey[File]("Copies the locally generated site into the local ghpages repository.")
lazy val ghpagesCleanSite = taskKey[Unit]("Cleans the staged repository for ghpages branch.")
lazy val ghpagesPushSite = taskKey[Unit]("Pushes a generated site into the ghpages branch. Will not clean the branch unless you run clean-site first.")
Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/com/typesafe/sbt/sbtghpages/GhpagesPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ object GhpagesPlugin extends AutoPlugin {
Hash.toHex(Hash.apply(sbt.Keys.thisProjectRef.value.build.toASCIIString))
file(System.getProperty("user.home")) / ".sbt" / "ghpages" / buildHash / organization.value / name.value
},
gitBranch in ghpagesUpdatedRepository := gitBranch.?.value getOrElse Some(ghpagesBranch.value),
ghpagesUpdatedRepository := updatedRepo(ghpagesRepository, gitRemoteRepo, gitBranch in ghpagesUpdatedRepository).value,
ghpagesUpdatedRepository / gitBranch := gitBranch.?.value getOrElse Some(ghpagesBranch.value),
ghpagesUpdatedRepository := updatedRepo(ghpagesRepository, gitRemoteRepo, ghpagesUpdatedRepository / gitBranch).value,
ghpagesPushSite := pushSiteTask.value,
ghpagesPrivateMappings := (mappings in SitePlugin.autoImport.makeSite).value,
ghpagesPrivateMappings := (SitePlugin.autoImport.makeSite / mappings).value,
ghpagesSynchLocal := synchLocalTask.value,
ghpagesCleanSite := cleanSiteTask.value,
includeFilter in ghpagesCleanSite := AllPassFilter,
excludeFilter in ghpagesCleanSite := NothingFilter
ghpagesCleanSite / includeFilter := AllPassFilter,
ghpagesCleanSite / excludeFilter := NothingFilter
)

private def updatedRepo(repo: SettingKey[File], remote: SettingKey[String], branch: SettingKey[Option[String]]) =
Expand All @@ -59,8 +59,8 @@ object GhpagesPlugin extends AutoPlugin {
val mappings = ghpagesPrivateMappings.value
val repo = ghpagesUpdatedRepository.value
val s = streams.value
val incl = (includeFilter in ghpagesCleanSite).value
val excl = (excludeFilter in ghpagesCleanSite).value
val incl = (ghpagesCleanSite / includeFilter).value
val excl = (ghpagesCleanSite / excludeFilter).value
// TODO - an sbt.Synch with cache of previous mappings to make this more efficient. */
val betterMappings = mappings map { case (file, target) => (file, repo / target) }
// First, remove 'stale' files.
Expand All @@ -73,7 +73,7 @@ object GhpagesPlugin extends AutoPlugin {

private def cleanSiteTask =
Def.task {
cleanSiteForRealz(ghpagesUpdatedRepository.value, GitKeys.gitRunner.value, streams.value, (includeFilter in ghpagesCleanSite).value, (excludeFilter in ghpagesCleanSite).value)
cleanSiteForRealz(ghpagesUpdatedRepository.value, GitKeys.gitRunner.value, streams.value, (ghpagesCleanSite / includeFilter).value, (ghpagesCleanSite / excludeFilter).value)
}
private def cleanSiteForRealz(dir: File, git: GitRunner, s: TaskStreams, incl: FileFilter, excl: FileFilter): Unit = {
val toClean = IO.listFiles(dir)
Expand Down