Skip to content

Commit

Permalink
Merge pull request #88 from mekanix/feature/20
Browse files Browse the repository at this point in the history
Build new created projects just like Freenit
  • Loading branch information
mekanix authored Jan 12, 2021
2 parents f9b3862 + 7870948 commit 36dfa87
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 15 deletions.
28 changes: 15 additions & 13 deletions bin/freenit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@ fi


PROJECT_ROOT=`python${PY_VERSION} -c 'import os; import freenit; print(os.path.dirname(os.path.abspath(freenit.__file__)))'`
export SED_CMD="sed -i"

mkdir ${NAME}
cd ${NAME}
cp -r ${PROJECT_ROOT}/project/* .
case `uname` in
*BSD)
export SED_CMD="sed -i ''"
${SED_CMD} '' -e "s/NAME/${NAME}/g" setup.py
${SED_CMD} '' -e "s/DBTYPE/${TYPE}/g" setup.py
${SED_CMD} '' -e "s/TYPE/${TYPE}/g" project/models/role.py
${SED_CMD} '' -e "s/TYPE/${TYPE}/g" project/models/user.py
;;
*)
export SED_CMD="sed -i"
${SED_CMD} -e "s/NAME/${NAME}/g" setup.py
${SED_CMD} -e "s/DBTYPE/${TYPE}/g" setup.py
${SED_CMD} -e "s/TYPE/${TYPE}/g" project/models/role.py
${SED_CMD} -e "s/TYPE/${TYPE}/g" project/models/user.py
;;


mkdir ${NAME}
cd ${NAME}
cp -r ${PROJECT_ROOT}/project/* .
${SED_CMD} -e "s/NAME/${NAME}/g" setup.py
${SED_CMD} -e "s/DBTYPE/${TYPE}/g" project/setup.py
${SED_CMD} -e "s/TYPE/${TYPE}/g" project/models/role.py
${SED_CMD} -e "s/TYPE/${TYPE}/g" project/models/user.py
esac
mv project ${NAME}
echo "app_name=\"${NAME}\" # noqa: E225" >name.py
echo "DEVEL_MODE = YES" >vars.mk
echo "# ${NAME}" >README.mk
mkdir templates
echo "# ${NAME}" >README.md
echo "- onelove-roles.freebsd_freenit" >>requirements.yml
if [ "${TYPE}" = "sql" -o "${TYPE}" = "all" ]; then
echo "- onelove-roles.freebsd_freenit_sql" >>requirements.yml
Expand Down
2 changes: 1 addition & 1 deletion freenit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from importlib import import_module

VERSION = '0.1.18'
VERSION = '0.1.24'


def sqlinit(app):
Expand Down
25 changes: 25 additions & 0 deletions freenit/project/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2017, Goran Mekić
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7 changes: 7 additions & 0 deletions freenit/project/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include README.md
include LICENSE
include common_config.py
include config.py
include name.py
graft migrations
graft tests
23 changes: 23 additions & 0 deletions freenit/project/bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh


set -e

export BIN_DIR=`dirname $0`
export PROJECT_ROOT="${BIN_DIR}/.."
export OFFLINE=${OFFLINE:=no}
export SYSPKG=${SYSPKG:="no"}
. ${BIN_DIR}/common.sh
setup


if [ "${SYSPKG}" = "no" ]; then
if [ "${OFFLINE}" != "yes" ]; then
pip install -U --upgrade-strategy eager wheel
pip install -U --upgrade-strategy eager -e '.[dev]'
fi
fi

cd ${PROJECT_ROOT}
rm -rf *.egg-info build dist
python setup.py sdist bdist_wheel
2 changes: 1 addition & 1 deletion freenit/project/bin/common.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export BIN_DIR=`dirname $0`
export PROJECT_ROOT="${BIN_DIR}/.."
. "${PROJECT_ROOT}/name.py"
export VIRTUALENV=${VIRTUALENV:="${app_name}back"}
export VIRTUALENV=${VIRTUALENV:="${app_name}"}
export FLASK_ENV=${FLASK_ENV:="production"}
export PY_VERSION=${PY_VERSION:="3.7"}
export SYSPKG=${SYSPKG:="no"}
Expand Down

0 comments on commit 36dfa87

Please sign in to comment.