Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit ff66784

Browse files
committed
Allow plugins to have hyphens in their names
1 parent c2bf392 commit ff66784

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

project/Plugin.scala

+4-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Plugin(val pluginSourceDirectoryName: String, val name: String) {
4141
val sbtFile = new SbtFile(name, version)
4242

4343
// The name of the sbt file is the plugin name. This worked in first tests
44-
sbtFile.save(s"$pluginDirectoryPath/$name.sbt")
44+
sbtFile.save(s"$pluginDirectoryPath/$normalizedName.sbt")
4545
}
4646

4747
/**
@@ -82,12 +82,11 @@ class Plugin(val pluginSourceDirectoryName: String, val name: String) {
8282
* @return true, if everything was successful
8383
*/
8484
def createSourceFile(language: PluginLanguage.Value): Boolean = {
85-
val content = PluginLanguage.getSourceFileContent(name, language)
85+
val content = PluginLanguage.getSourceFileContent(normalizedName, language)
8686
val langName = language.toString.toLowerCase
8787

88-
8988
Try(
90-
IO.write(new File(s"$pluginDirectoryPath/src/main/$langName/${name}Plugin.$langName"), content.getBytes)
89+
IO.write(new File(s"$pluginDirectoryPath/src/main/$langName/${normalizedName}Plugin.$langName"), content.getBytes)
9190
).isSuccess
9291
}
9392

@@ -148,7 +147,7 @@ object Plugin {
148147
pluginSourceFolder.exists() && pluginSourceFolder.isDirectory
149148
}
150149

151-
private def toPluginPathName(name: String) = name.replace(" ", "").toLowerCase
150+
private def toPluginPathName(name: String) = name.replaceAll("[ -]", "").toLowerCase
152151

153152
private def containsPluginXMLFile(directory: File): Boolean = {
154153
new File(s"$directory/src/main/resources/plugin.xml").exists()

0 commit comments

Comments
 (0)