Create a gist now

Instantly share code, notes, and snippets.

@ToQoz /sugu-play.sh
Last active Mar 21, 2017

What would you like to do?
すぐ play
#!/bin/bash
# ./play-bootstrap.sh -a app_name -s 2.11.7 -p 2.5.9
usage_exit() {
echo "Usage: $0 [-a application name] [-s scala version] [-p play version]" 1>&2
exit 1
}
while getopts p:a:s:b:h OPT
do
case $OPT in
j) PROJECT_NAME=$OPTARG
;;
a) APPLICATION_NAME=$OPTARG
;;
s) SCALA_VERSION=$OPTARG
;;
p) PLAY_VERSION=$OPTARG
;;
h) usage_exit
;;
\?) usage_exit
;;
esac
done
SBT_VERSION=$(sbt sbtVersion | grep -o -e '[0-9][0-9]*\.[0-9][0-9]*.[0-9][0-9]*')
mkdir $APPLICATION_NAME && cd $APPLICATION_NAME
# ./build.sbt
echo 'name := "'$APPLICATION_NAME'"
version := "1.0"
scalaVersion := "'$SCALA_VERSION'"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
' > build.sbt
mkdir project
# ./project/build.properties
echo 'sbt.version='$SBT_VERSION'
' > project/build.properties
# ./project/plugins.sbt
echo 'resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/maven-releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "'$PLAY_VERSION'")
' > project/plugins.sbt
sbt run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment