Skip to content

Commit

Permalink
use slash syntax instead of deprecated in
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Nov 10, 2022
1 parent 25d7260 commit 4ef3ede
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 4ef3ede

Please sign in to comment.