Commit 63795880 authored by Moritz Sokoll's avatar Moritz Sokoll 🦀
Browse files

added git and licenses to bootstrap

parent 72986d75
#!/bin/sh
# bootstrap useful things for a project
# initalizes git and important files (including MIT as a license, later there may be more supported licenses)
HELP="
Usage: bootstrap [OPTIONS]
......@@ -9,7 +12,27 @@ Options:
-l <lang>: bootstrap a project for <lang>
"
VERSION="bootstrap v1.0.0"
HASCARGO=0
MIT_CLAUSE=" The MIT License (MIT)
Copyright © 2021 <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
deps() {
which git 2>&1 >/dev/null
if [ ! $? = 0 ]; then
echo "git is not callable from the script. possibly not installed" >&2
exit 1
fi
which cargo 2>&1 >/dev/null
if [ ! $? = 0 ]; then
echo "cargo is not callable from the script. possibly not installed (optional)" >&2
HASCARGO=1
fi
}
args() {
local opts
while getopts "hvl:" opts; do
......@@ -47,6 +70,7 @@ args() {
}
main() {
deps
local LANG
args "$@"
case "$LANG" in
......@@ -54,22 +78,37 @@ main() {
mkdir -p include src
touch Makefile COPYING configure.sh src/main.c README.md
chmod +x configure.sh
git init 2>&1 >/dev/null
echo "$MIT_CLAUSE" > COPYING
;;
cpp)
mkdir -p include src
touch Makefile COPYING configure.sh src/main.cpp README.md
chmod +x configure.sh
git init 2>&1 >/dev/null
echo "$MIT_CLAUSE" > COPYING
;;
rust)
if [ -f "/usr/bin/cargo" ]; then
echo 'cargo is installed. Use `cargo new <projectname>` to create a new rust project'
if [ ! HASCARGO = 0 ]; then
echo "project creation cannot be done with cargo. Manual creation..." >&2
mkdir -p src
touch README.md COPYING src/main.rs
echo "$MIT_CLAUSE" > COPYING
else
echo 'cargo is not installed. Please install cargo and use `cargo new <projectname>` to create a new project'
cargo init 2>&1 >/dev/null
if [ ! $? = 0 ]; then
echo "problems initalizing project with \`cargo init\`" >&2
exit 1
fi
touch COPYING README.md
echo "$MIT_CLAUSE" > COPYING
fi
;;
python)
mkdir -p src
touch requirements.txt src/main.py
touch requirements.txt src/main.py COPYING
echo "$MIT_CLAUSE" > COPYING
git init 2>&1 >/dev/null
;;
esac
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment