diff --git a/bin/sbt-setup b/bin/sbt-setup index 547df317d..e9c82ffe5 100755 --- a/bin/sbt-setup +++ b/bin/sbt-setup @@ -17,8 +17,8 @@ BASE=$(abspath $BINDIR/..) declare -a args TEMPLATE="simple" - SCALA_VERSION="2.9.0" -PROJECT_VERSION="0.0.1" + SCALA_VERSION="2.9.1" +PROJECT_VERSION="0.1" DO_GITHUB= while [ $# -gt 0 ]; do @@ -112,81 +112,8 @@ build.scala.versions=$SCALA_VERSION project.initialize=false EOF -# cat > src/main/scala/Main.scala < src/test/scala/${SPEC_CLASS}.scala <> { - 1 mustEqual 1 - } - } -} -EOF - -FILE=project/build/${PROJECT_CLASS}.scala -if [[ $TEMPLATE == "fancy" ]]; then - cp $BASE/src/template/Libraries.scala project/build - cp $BASE/src/template/Repositories.scala project/build - cp $BASE/src/template/Plugins.scala project/plugins - - cat > $FILE < $FILE <> $FILE - cp $BASE/src/template/Plugins.scala project/plugins -fi - -ln -s $FILE - -cat > .gitignore < .gitignore < project initial version +EOM +} + +# no args +[[ $# -gt 0 ]] || { usage ; exit 1; } + +# run +java \ + $JAVA_OPTS \ + $jvm_opts_standard \ + $jvm_opts_memory \ + $SBT_OPTS \ -jar "$sbt_jar" \ "$@" + + diff --git a/project/Build.scala b/project/Build.scala index 8b2acbe31..5f0a92a11 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -3,7 +3,26 @@ import Keys._ import Load.{ BuildStructure, StructureIndex } import scala.collection.{ mutable, immutable } -object TemplateBuild extends Build { +trait SbtCreateConfig { + def name: String + def organization: String + def version: String + def scalaVersion: String +} +object SbtCreateConfig { + private def prop(propName: String, alt: String) = System.getProperty(propName) match { + case null => alt + case value => value + } + implicit def defaultProjectConfig = new SbtCreateConfig { + def name = prop("sbt-create.name", "project-name-here") + def organization = prop("sbt-create.organization", "your.organization.here") + def version = prop("sbt-create.version", "0.1") + def scalaVersion = prop("sbt-create.scalaVersion", "2.9.0-1") + } +} + +class TemplateBuild(implicit sbtCreateConfig: SbtCreateConfig) extends Build { // BuildStructure contains: // units: Map[URI, LoadedBuildUnit] // root: URI @@ -96,3 +115,5 @@ object TemplateBuild extends Build { state tap (_.sortedKeys map (_.label) show) } } + +object TemplateBuild extends TemplateBuild { }