Skip to content

Instantly share code, notes, and snippets.

@jmather
Created December 4, 2012 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmather/4209716 to your computer and use it in GitHub Desktop.
Save jmather/4209716 to your computer and use it in GitHub Desktop.
Easily create a new project
#!/bin/bash
source /etc/profile
git init
mv base.iml $1.iml
cd .idea/
cat modules.xml | sed "s/base/$1/g" > modules.xml.new
mv modules.xml.new modules.xml
cat workspace.xml | sed "s/base/$1/g" > workspace.xml.new
mv workspace.xml.new workspace.xml
#!/bin/bash
source /etc/profile
PATH=$1
SKELETON=~/var/project-skeleton
ROOT=~/Projects
NAME=${PATH##*/}
DIR=${PATH%%/*}
if [ "$DIR/$NAME" != "$1" ]
then
echo "Please enter your project in a directory/name format. Entered: $1"
exit
fi
if [ -d "$ROOT/$DIR/$NAME" ] || [ -f "$ROOT/$DIR/$NAME" ]
then
echo "The project '$1' already exists."
exit
fi
if [ ! -f $ROOT/$DIR ] && [ ! -d $ROOT/$DIR ]
then
echo mkdir $ROOT/$DIR
fi
cp -a $SKELETON $ROOT/$DIR/$NAME
cd $ROOT/$DIR/$NAME
if [ -f bin/.init.sh ]
then
sh bin/.init.sh $NAME
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment