Adding github creation support.

This commit is contained in:
Paul Phillips 2011-04-02 18:45:23 -07:00
parent 592b4aca30
commit 1ce37d80bb
3 changed files with 30 additions and 1 deletions

8
README
View File

@ -1 +1,7 @@
This is a skeleton project for sbt. This is a skeleton project for sbt.
Simple usage:
bin/sbt-setup my-fancy-project
That's it. Start hacking.

View File

@ -9,6 +9,7 @@ declare -a args
TEMPLATE="simple" TEMPLATE="simple"
SCALA_VERSION="2.8.1" SCALA_VERSION="2.8.1"
PROJECT_VERSION="0.0.1" PROJECT_VERSION="0.0.1"
DO_GITHUB=
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@ -25,6 +26,10 @@ while [ $# -gt 0 ]; do
PROJECT_VERSION="$1" PROJECT_VERSION="$1"
shift shift
;; ;;
--github)
shift
DO_GITHUB="true"
;;
--28) --28)
SCALA_VERSION="2.8.1" SCALA_VERSION="2.8.1"
shift shift
@ -47,6 +52,7 @@ if [[ $# -ne 1 ]]; then
cat <<EOM cat <<EOM
Usage: $(basename $0) [options] <project> [dependencies] Usage: $(basename $0) [options] <project> [dependencies]
--hub create github project (requires hub and more)
--simple use simple project template --simple use simple project template
--fancy use multi-file project template --fancy use multi-file project template
--28 latest release of scala 2.8.x --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)." git commit -m "Initial Import for ${PROJECT_CC} (autogenerated by sbt-setup)."
sbt update package test 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 ""
echo "Ready to roll in $PWD" echo "Ready to roll in $PWD"

View File

@ -12,3 +12,11 @@ function camelCase () {
echo $1 | $SED -e 's/[-_]\([a-z]\)/\u\1/g' | $SED -e 's/^./\u&/;' 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)
}