Skip to content

Instantly share code, notes, and snippets.

@dimitrov
Created June 9, 2013 19:49
Show Gist options
  • Save dimitrov/5744940 to your computer and use it in GitHub Desktop.
Save dimitrov/5744940 to your computer and use it in GitHub Desktop.
#!/bin/bash
COMMON_DIRS=(bin doc etc tests)
COMMON_FILES=(README ABOUT INSTALL TODO NEWS CHANGELOG LICENSE Makefile)
BASE_PATH=$PROJECT_PATH/$PROJECT_NAME
function create_directories {
mkdir -p $BASE_PATH/$PROJECT_NAME
for dir in ${COMMON_DIRS[*]}; do
mkdir $BASE_PATH/${dir}
done
}
function create_files {
for file in ${COMMON_FILES[*]}; do
touch $BASE_PATH/${file}
done
touch $BASE_PATH/tests/__init__.py
touch $BASE_PATH/$PROJECT_NAME/__init__.py
touch $BASE_PATH/requirements.txt
}
function copy_license {
cp licenses/$LICENSE/$LICENSE.license $BASE_PATH/LICENSE
# TODO: Add license to each source-code file
}
function copy_templates {
cp $TEMPLATES/Makefile.template $BASE_PATH/Makefile
cp $TEMPLATES/setup.py.template $BASE_PATH/setup.py
}
function render_templates {
render_template $BASE_PATH/Makefile
render_template $BASE_PATH/setup.py
}
function initialize_vcs {
if [ $VCS == "GIT" ]; then
for dir in ${COMMON_DIRS[*]}; do
if [ ${dir} != "tests" ]; then
touch $BASE_PATH/${dir}/.gitkeep
fi
done
git init $BASE_PATH
fi
# TODO: Code for additional VCSs.
}
function bootstrap {
create_directories
create_files
copy_license
copy_templates
render_templates
initialize_vcs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment