-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnewproject
More file actions
executable file
·34 lines (32 loc) · 1.45 KB
/
newproject
File metadata and controls
executable file
·34 lines (32 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# NewProject supportive script. Copyright (c) 2017, anselmos.github.com
# Uses two parameters - newproject [PROJECT] [TYPE]
# Parameters: PROJECT - you define name of your project and for this name will be created a dir.
# Parameters: TYPE - type of the project. For now only 'python' type is supported - and it creates a venv.
# Script will create new project directory, initialize git and create empty init commit for startup.
PROJECT=$1
TYPE=$2
VERSION=$3 || 3.6
echo $PROJECT
echo $TYPE
echo $VERSION
if [ -n "$PROJECT" ]; then
mkdir $PROJECT
cd $PROJECT && git init . && git commit --allow-empty -m "Initialization of empty project '$PROJECT'"
if [ "$TYPE" = "python" ]; then
echo "A python project you say, huh? Ok. Let's create a virtualenv for you!"
pipenv --python $(VERSION)
wget https://www.gitignore.io/api/python -O .gitignore
git add .gitignore && git commit -m "Adds gitignore for python"
elif [ "$TYPE" == "docker" ]; then
echo -e "FROM ... \nENTRYPOINT ..." > Dockerfile
echo -e "#!/bin/bash\ndocker build -t anselmos/$PROJECT ." > build.sh
chmod +x build.sh
echo -e "#!/bin/bash\ndocker run -it anselmos/$PROJECT /bin/bash" > run_bash.sh
chmod +x run_bash.sh
echo -e "#!/bin/bash\ndocker run -it anselmos/$PROJECT" > run.sh
chmod +x run.sh
git add Dockerfile && git commit -m "Adds empty dockerfile"
vim Dockerfile
fi
fi