Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
You can now specify the static file directory
Browse files Browse the repository at this point in the history
  • Loading branch information
gklopper committed May 24, 2012
1 parent dde97d2 commit 3119f14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project/PluginBuild.scala
Expand Up @@ -8,7 +8,7 @@ object PluginBuild extends Build {
// they are dependencies of the plugin itself and not associated with the
// build definition as plugins usually are.

val playArtifactPluginVersion = "1.6"
val playArtifactPluginVersion = "1.8"

lazy val playSnapshots = Resolver.url("Play 2.1-SNAPSHOT",
url("http://guardian.github.com/ivy/repo-snapshots"))(Resolver.ivyStylePatterns)
Expand Down
11 changes: 8 additions & 3 deletions src/main/scala/PlayAssetHash.scala
Expand Up @@ -9,6 +9,11 @@ import sbtassembly.Plugin.AssemblyKeys._

object PlayAssetHash extends Plugin {

lazy val staticFilesPackage: SettingKey[String] =
SettingKey("static-files-package", "Package to deploy static files to when building artifact")

staticFilesPackage := "static-files"

lazy val playAssetHashCompileSettings: Seq[Setting[_]] = Seq(
resourceGenerators in Compile <+= cssGeneratorTask,
resourceGenerators in Compile <+= imageGeneratorTask,
Expand Down Expand Up @@ -64,8 +69,8 @@ object PlayAssetHash extends Plugin {
assetMapFile +: (current updateWith assetRemappings).toSeq
}

private def assetMapResources = (assembly, target, executableName) map {
(assembly, target, projectName) =>
private def assetMapResources = (assembly, target, staticFilesPackage) map {
(assembly, target, staticDir) =>
val targetDist = target / "dist"
if (targetDist exists) {
targetDist.delete
Expand All @@ -85,7 +90,7 @@ object PlayAssetHash extends Plugin {
}

val staticFiles = assetMaps flatMap { _.values } map { file =>
(targetDist / "public" / file, "packages/%s/static-files/%s".format(projectName, file))
(targetDist / "public" / file, "packages/%s/%s".format(staticDir, file))
}

staticFiles
Expand Down

0 comments on commit 3119f14

Please sign in to comment.