Skip to content

Commit

Permalink
Prefer normalizedName for linux-friendly packages, rather than requir…
Browse files Browse the repository at this point in the history
…ing linux friendly names.

Fixes #38
  • Loading branch information
jsuereth committed Sep 23, 2013
1 parent 6ef4ec8 commit af95396
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ trait GenericPackageSettings

def mapGenericFilesToLinux: Seq[Setting[_]] = Seq(
// First we look at the src/linux files
linuxPackageMappings <++= (name in Universal, sourceDirectory in Linux) map { (pkg, dir) =>
linuxPackageMappings <++= (sourceDirectory in Linux) map { dir =>
mapGenericMappingsToLinux((dir.*** --- dir) x relativeTo(dir))(identity)
},
// Now we look at the src/universal files.
linuxPackageMappings <++= (name in Universal, mappings in Universal) map { (pkg, mappings) =>
linuxPackageMappings <++= (normalizedName in Universal, mappings in Universal) map { (pkg, mappings) =>
// TODO - More windows filters...
def isWindowsFile(f: (File, String)): Boolean =
f._2 endsWith ".bat"
Expand All @@ -77,7 +77,7 @@ trait GenericPackageSettings
}
},
// Now we generate symlinks.
linuxPackageSymlinks <++= (name in Universal, mappings in Universal) map { (pkg, mappings) =>
linuxPackageSymlinks <++= (normalizedName in Universal, mappings in Universal) map { (pkg, mappings) =>
for {
(file, name) <- mappings
if !file.isDirectory
Expand All @@ -86,7 +86,7 @@ trait GenericPackageSettings
} yield LinuxSymlink("/usr/" + name, installLocation+"/"+pkg+"/"+name)
},
// Map configuration files
linuxPackageSymlinks <++= (name in Universal, mappings in Universal) map { (pkg, mappings) =>
linuxPackageSymlinks <++= (normalizedName in Universal, mappings in Universal) map { (pkg, mappings) =>
val needsConfLink =
mappings exists { case (file, name) =>
(name startsWith "conf/") && !file.isDirectory
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/com/typesafe/sbt/packager/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ object Keys extends linux.Keys
with universal.UniversalKeys {

// TODO - Do these keys belong here?
def normalizedName = sbt.Keys.normalizedName

// These keys are used by the JavaApp archetype.
val makeBashScript = TaskKey[Option[File]]("makeBashScript", "Creates or discovers the bash script used by this project.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ object Keys extends UniversalKeys {
def packageSrc = sbt.Keys.packageSrc
def packageDoc = sbt.Keys.packageDoc
def name = sbt.Keys.name
def normalizedName = sbt.Keys.normalizedName
def target = sbt.Keys.target
def sourceDirectory = sbt.Keys.sourceDirectory
def streams = sbt.Keys.streams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait UniversalPlugin extends Plugin {
dist <<= dist in Universal,
stage <<= stage in Universal,
// TODO - New default to naming, is this right?
name in Universal <<= (name, version) apply (_ + "-" + _)
name in Universal <<= (normalizedName, version) apply (_ + "-" + _)
) ++
makePackageSettingsForConfig(Universal) ++
makePackageSettingsForConfig(UniversalDocs) ++
Expand Down

0 comments on commit af95396

Please sign in to comment.