Возможность обновления файлов настроек
This commit is contained in:
parent
82fe3c1b4f
commit
2032540265
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(myx-dev VERSION 0.1.2)
|
project(myx-dev VERSION 0.1.6)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(DIRECTORY bin/ DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
install(DIRECTORY bin/ DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
key="$1"
|
|
||||||
|
|
||||||
case $key in
|
|
||||||
-s|--server)
|
|
||||||
SERVER="$2"
|
|
||||||
shift # past argument
|
|
||||||
shift # past value
|
|
||||||
;;
|
|
||||||
-d|--dir|--directory)
|
|
||||||
DIRECTORY="$2"
|
|
||||||
shift # past argument
|
|
||||||
shift # past value
|
|
||||||
;;
|
|
||||||
*) # unknown option
|
|
||||||
DIRECTORY="$1"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ -z "$DIRECTORY" ]] && DIRECTORY="$(pwd)"
|
|
||||||
if [[ -d "${DIRECTORY}/.git" ]]; then
|
|
||||||
echo "Directory already has repository. Exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z "${SERVER}" ]] && SERVER=gitlab.2
|
|
||||||
|
|
||||||
TYPE=gitea
|
|
||||||
[[ "${SERVER}" == *"gitlab"* ]] && TYPE=gitlab
|
|
||||||
|
|
||||||
if [[ "$TYPE" == "gitea" ]]; then
|
|
||||||
BASE_URL="https://${SERVER}"
|
|
||||||
BRANCH_API="raw/branch"
|
|
||||||
GITHOOKS_ARCHIVE="archive/master.tar.gz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$TYPE" == "gitlab" ]]; then
|
|
||||||
BASE_URL="http://${SERVER}"
|
|
||||||
BRANCH_API="-/raw"
|
|
||||||
GITHOOKS_ARCHIVE="-/archive/master/githooks-master.tar.gz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! mkdir -p "$DIRECTORY"; then
|
|
||||||
echo "Can't create directory for git repository"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd "$DIRECTORY" >/dev/null
|
|
||||||
|
|
||||||
if ! git init; then
|
|
||||||
echo "Can't create git repository in directory $DIRECTORY"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mkdir -p files/{etc,log,share,var}
|
|
||||||
touch files/{etc,log,share,var}/.gitkeep
|
|
||||||
|
|
||||||
wget "${BASE_URL}/f1x1t/cmake-format/${BRANCH_API}/master/.cmake-format.py"
|
|
||||||
wget "${BASE_URL}/f1x1t/cmlib-gitignore/${BRANCH_API}/master/.gitignore"
|
|
||||||
wget "${BASE_URL}/f1x1t/gitlab-ci/${BRANCH_API}/master/.gitlab-ci.yml"
|
|
||||||
wget -o files/etc/uncrustify.cfg "${BASE_URL}/f1x1t/uncrustify-config/${BRANCH_API}/master/default.cfg"
|
|
||||||
wget -O - "${BASE_URL}/f1x1t/githooks/${GITHOOKS_ARCHIVE}" | tar zx --strip-components=1 -C .git/hooks
|
|
||||||
|
|
||||||
sed -i '/.*_CMD.*/d' .gitlab-ci.yml
|
|
||||||
sed -i '/.*variables:.*/d' .gitlab-ci.yml
|
|
||||||
sed -i 's/^UNCRUST_CONFIG.*/UNCRUST_CONFIG=$REPO\/files\/etc\/uncrustify.cfg/' .git/hooks/pre-commit-uncrustify.cfg
|
|
||||||
|
|
||||||
git add .cmake-format.py .gitignore .gitlab-ci.yml files
|
|
||||||
git commit -m "Начало проекта"
|
|
||||||
|
|
||||||
if [ -e .gitmodules ]; then
|
|
||||||
sed -i 's/git@${SERVER}:/..\/..\//' .gitmodules
|
|
||||||
git submodule sync --recursive
|
|
||||||
git commit -m "Относительные пути к подмодулям" .gitmodules
|
|
||||||
fi
|
|
||||||
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
187
bin/myx-dev-project
Executable file
187
bin/myx-dev-project
Executable file
@ -0,0 +1,187 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print-help()
|
||||||
|
{
|
||||||
|
echo "Usage: myx-dev-project COMMAND [ARGS]"
|
||||||
|
echo "COMMAND:"
|
||||||
|
echo " -i Initialization"
|
||||||
|
echo " -u Update"
|
||||||
|
echo " -h Help"
|
||||||
|
echo "ARGS:"
|
||||||
|
echo " -s server (default: gitlab.2)"
|
||||||
|
echo " -d directory (default: .)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
-h|--help)
|
||||||
|
print-help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-i|--init)
|
||||||
|
INIT="1"
|
||||||
|
UPDATE="1"
|
||||||
|
ACTION="1"
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
-u|--update)
|
||||||
|
UPDATE="1"
|
||||||
|
ACTION="1"
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
-s|--server)
|
||||||
|
SERVER="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-d|--dir|--directory)
|
||||||
|
DIRECTORY="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
*) # unknown option
|
||||||
|
DIRECTORY="$1"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "${ACTION}" ]]; then
|
||||||
|
echo "Command is not defined."
|
||||||
|
print-help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z "${SERVER}" ]] && SERVER=gitlab.2
|
||||||
|
|
||||||
|
TYPE=gitea
|
||||||
|
[[ "${SERVER}" == *"gitlab"* ]] && TYPE=gitlab
|
||||||
|
|
||||||
|
if [[ "$TYPE" == "gitea" ]]; then
|
||||||
|
BASE_URL="https://${SERVER}"
|
||||||
|
BRANCH_API="raw/branch"
|
||||||
|
GITHOOKS_ARCHIVE="archive/master.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$TYPE" == "gitlab" ]]; then
|
||||||
|
BASE_URL="http://${SERVER}"
|
||||||
|
BRANCH_API="-/raw"
|
||||||
|
GITHOOKS_ARCHIVE="-/archive/master/githooks-master.tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "x$INIT" == "x1" ]] ; then
|
||||||
|
[[ -z "$DIRECTORY" ]] && DIRECTORY="$(pwd)"
|
||||||
|
if [[ -d "${DIRECTORY}/.git" ]]; then
|
||||||
|
echo "Directory already has repository. Exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mkdir -p "$DIRECTORY"; then
|
||||||
|
echo "Can't create directory for git repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! cd "$DIRECTORY" >/dev/null; then
|
||||||
|
echo "Can't change directory to $DIRECTORY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "x$INIT" == "x1" ]] ; then
|
||||||
|
if ! git init; then
|
||||||
|
echo "Can't create git repository in directory $DIRECTORY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p files/{etc,log,share,var}
|
||||||
|
touch files/{etc,log,share,var}/.gitkeep
|
||||||
|
|
||||||
|
TF=$(mktemp -u)
|
||||||
|
if ! wget -O "$TF" "${BASE_URL}/f1x1t/cmake-format/${BRANCH_API}/master/.cmake-format.py" 2>/dev/null; then
|
||||||
|
echo "Can't download .clang-format.py"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mv -f "$TF" .clang-format.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! wget -O "$TF" "${BASE_URL}/f1x1t/cmlib-gitignore/${BRANCH_API}/master/.gitignore" 2>/dev/null; then
|
||||||
|
echo "Can't download .gitignore"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mv -f "$TF" .gitignore
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! wget -O "$TF" "${BASE_URL}/f1x1t/gitlab-ci/${BRANCH_API}/master/.gitlab-ci.yml" 2>/dev/null; then
|
||||||
|
echo "Can't download .gitlab-ci.yml"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mv -f "$TF" .gitlab-ci.yml
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! wget -O "$TF" "${BASE_URL}/f1x1t/uncrustify-config/${BRANCH_API}/master/default.cfg" 2>/dev/null; then
|
||||||
|
echo "Can't download .uncrustify.cfg"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mv -f "$TF" .uncrustify.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! wget -O "$TF" "${BASE_URL}/f1x1t/clang-tidy-config/${BRANCH_API}/master/.clang-tidy" 2>/dev/null; then
|
||||||
|
echo "Can't download .clang-tidy"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mv -f "$TF" .clang-tidy
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! wget -O - "${BASE_URL}/f1x1t/githooks/${GITHOOKS_ARCHIVE}" | tar zx --strip-components=1 -C .git/hooks; then
|
||||||
|
echo "Can't download ${GITHOOKS_ARCHIVE}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i '/.*_CMD.*/d' .gitlab-ci.yml
|
||||||
|
sed -i '/.*variables:.*/d' .gitlab-ci.yml
|
||||||
|
sed -i 's/^UNCRUST_CONFIG.*/UNCRUST_CONFIG=$REPO\/.uncrustify.cfg/' .git/hooks/pre-commit-uncrustify.cfg
|
||||||
|
|
||||||
|
if [[ "x$INIT" != "x1" ]] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
tee -a CMakeLists.txt >/dev/null <<CML
|
||||||
|
# Минимальная версия CMake
|
||||||
|
cmake_minimum_required(VERSION 3.3)
|
||||||
|
|
||||||
|
# Предпочтительно следовать стандартам принятым в указанном диапазоне версий
|
||||||
|
cmake_policy(VERSION 3.0.2..3.7)
|
||||||
|
|
||||||
|
# Название и версия проекта и используемые языки программирования
|
||||||
|
project(FIXME VERSION 0.0.1 LANGUAGES C CXX)
|
||||||
|
|
||||||
|
###
|
||||||
|
# Обязательные переменные для MyxCMake
|
||||||
|
###
|
||||||
|
# Название организации
|
||||||
|
set(MYX_CMAKE_ORGANIZATION_NAME "FIXME" CACHE STRING "")
|
||||||
|
|
||||||
|
# Имя автора
|
||||||
|
set(MYX_CMAKE_AUTHOR_NAME "FIXME" CACHE STRING "")
|
||||||
|
|
||||||
|
# Почта автора
|
||||||
|
set(MYX_CMAKE_AUTHOR_EMAIL "FIXME" CACHE STRING "")
|
||||||
|
|
||||||
|
# Краткое описание проекта
|
||||||
|
set(MYX_CMAKE_DESCRIPTION "FIXME" CACHE STRING "")
|
||||||
|
|
||||||
|
find_package(MyxCMake 0.3.8 REQUIRED)
|
||||||
|
CML
|
||||||
|
|
||||||
|
git add CMakeLists.txt .clang-tidy .cmake-format.py .gitignore .gitlab-ci.yml .uncrustify.cfg files
|
||||||
|
git commit -m "Начало проекта"
|
||||||
|
|
||||||
|
if [ -e .gitmodules ]; then
|
||||||
|
sed -i 's/git@${SERVER}:/..\/..\//' .gitmodules
|
||||||
|
git submodule sync --recursive
|
||||||
|
git commit -m "Относительные пути к подмодулям" .gitmodules
|
||||||
|
fi
|
||||||
|
|
5
debian/control
vendored
5
debian/control
vendored
@ -8,8 +8,9 @@ Standards-Version: 4.2.0
|
|||||||
Package: myx-dev
|
Package: myx-dev
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Section: utils
|
Section: utils
|
||||||
Depends: git, git-lfs
|
Depends: git
|
||||||
Recommends: build-essential, cmake, cmake-format, dos2unix, libdistro-info-perl
|
Recommends: build-essential, cmake, dos2unix, libdistro-info-perl
|
||||||
|
Suggests: cmake-format, uncrustify
|
||||||
Description: Mixed development scripts
|
Description: Mixed development scripts
|
||||||
Mixed development scripts
|
Mixed development scripts
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user