Skip to content

Instantly share code, notes, and snippets.

@glava
Last active August 29, 2015 14:02
Show Gist options
  • Save glava/b2b76bb6233a181a2519 to your computer and use it in GitHub Desktop.
Save glava/b2b76bb6233a181a2519 to your computer and use it in GitHub Desktop.
Creates a SBT project directory structure
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbt-template.sh
# Purpose: Create an SBT project directory structure
# Usage: project=foo ./sbt-template.sh
#------------------------------------------------------------------------------
set -e
if [ -d "${project}" ]; then
echo "ERROR: Directory with specified ${project} name exist."
exit 1;
fi
echo "creating project structure"
mkdir -p ${project}/src/{main,test}/{resources,scala}
mkdir $project/project
echo "creating plugins.sbt file"
cat > ${project}/project/plugins.sbt << EOF
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
EOF
echo "creating project defintion file"
cat > $project/build.sbt << EOF
name := "$project"
version := "1.0"
scalaVersion := "2.11.7"
mainClass in (Compile, packageBin) := Some("Main")
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"
)
EOF
echo "creating simple main"
cat > ${project}/src/main/scala/Main.scala << EOF
object Main extends App {
}
EOF
echo "puting .gitignore to place"
cat > ${project}/.gitignore << EOF
bin/
project/
target/
.cache
.classpath
.project
.idea
.settings
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment