From 1ce37d80bb39c66e5db91bd98f95bb90a996f1c2 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 2 Apr 2011 18:45:23 -0700 Subject: [PATCH] Adding github creation support. --- README | 8 +++++++- bin/sbt-setup | 15 +++++++++++++++ bin/util.sh | 8 ++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README b/README index 2d6b127b5..6068779c1 100644 --- a/README +++ b/README @@ -1 +1,7 @@ -This is a skeleton project for sbt. \ No newline at end of file +This is a skeleton project for sbt. + +Simple usage: + + bin/sbt-setup my-fancy-project + +That's it. Start hacking. \ No newline at end of file diff --git a/bin/sbt-setup b/bin/sbt-setup index 5bc09859c..3fb327ced 100755 --- a/bin/sbt-setup +++ b/bin/sbt-setup @@ -9,6 +9,7 @@ declare -a args TEMPLATE="simple" SCALA_VERSION="2.8.1" PROJECT_VERSION="0.0.1" +DO_GITHUB= while [ $# -gt 0 ]; do case "$1" in @@ -25,6 +26,10 @@ while [ $# -gt 0 ]; do PROJECT_VERSION="$1" shift ;; + --github) + shift + DO_GITHUB="true" + ;; --28) SCALA_VERSION="2.8.1" shift @@ -47,6 +52,7 @@ if [[ $# -ne 1 ]]; then cat < [dependencies] + --hub create github project (requires hub and more) --simple use simple project template --fancy use multi-file project template --28 latest release of scala 2.8.x @@ -163,5 +169,14 @@ git add -f project/plugins/Plugins.scala git commit -m "Initial Import for ${PROJECT_CC} (autogenerated by sbt-setup)." sbt update package test +if [[ $DO_GITHUB ]]; then + GIT_URL="git@github.com:$(githubUser)/$PROJECT.git" + echo Creating $GIT_URL + hub create + git config --local --add branch.master.remote origin + git config --local --add branch.master.merge refs/heads/master + git push origin master +fi + echo "" echo "Ready to roll in $PWD" diff --git a/bin/util.sh b/bin/util.sh index b29f28417..11915dbbe 100755 --- a/bin/util.sh +++ b/bin/util.sh @@ -12,3 +12,11 @@ function camelCase () { echo $1 | $SED -e 's/[-_]\([a-z]\)/\u\1/g' | $SED -e 's/^./\u&/;' } + +function githubUser () { + echo $(git config --global github.user) +} + +function githubToken () { + echo $(git config --global github.token) +}