2025-03-31
|
@ -1,44 +1,47 @@
|
||||||
## Дерево каталогов
|
## Дерево каталогов
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
<a href='.'>.</a>
|
<a href=".">.</a>
|
||||||
├─ <a href='avatars'>avatars</a>
|
├─ <a href="avatars">avatars</a>
|
||||||
│ ├─ <a href='avatars/README.md'>README.md</a>
|
│ ├─ <a href="avatars/LISTVIEW.md">LISTVIEW.md</a><small> 551</small>
|
||||||
│ ├─ <a href='avatars/color-tomato-theme.jpg'>color-tomato-theme.jpg</a>
|
│ ├─ <a href="avatars/color-tomato-theme.jpg">color-tomato-theme.jpg</a><small> 4,9K</small>
|
||||||
│ ├─ <a href='avatars/dispatcher.jpg'>dispatcher.jpg</a>
|
│ ├─ <a href="avatars/dispatcher.jpg">dispatcher.jpg</a><small> 3,7K</small>
|
||||||
│ ├─ <a href='avatars/older-tomato-theme.jpg'>older-tomato-theme.jpg</a>
|
│ ├─ <a href="avatars/older-tomato-theme.jpg">older-tomato-theme.jpg</a><small> 4,2K</small>
|
||||||
│ ├─ <a href='avatars/pomodoro.jpg'>pomodoro.jpg</a>
|
│ ├─ <a href="avatars/pomodoro.jpg">pomodoro.jpg</a><small> 3,3K</small>
|
||||||
│ └─ <a href='avatars/website.jpg'>website.jpg</a>
|
│ └─ <a href="avatars/website.jpg">website.jpg</a><small> 3,9K</small>
|
||||||
├─ <a href='bash_scripts'>bash_scripts</a>
|
├─ <a href="bash_scripts">bash_scripts</a>
|
||||||
│ ├─ <a href='bash_scripts/archive_backup.sh'>archive_backup.sh</a>
|
│ ├─ <a href="bash_scripts/archive_backup.sh">archive_backup.sh</a><small> 1,4K</small>
|
||||||
│ ├─ <a href='bash_scripts/archive_cleanup.sh'>archive_cleanup.sh</a>
|
│ ├─ <a href="bash_scripts/archive_cleanup.sh">archive_cleanup.sh</a><small> 916</small>
|
||||||
│ ├─ <a href='bash_scripts/archive_packaging.sh'>archive_packaging.sh</a>
|
│ ├─ <a href="bash_scripts/archive_packaging.sh">archive_packaging.sh</a><small> 2,1K</small>
|
||||||
│ ├─ <a href='bash_scripts/info_param.sh'>info_param.sh</a>
|
│ ├─ <a href="bash_scripts/info_param.sh">info_param.sh</a><small> 148</small>
|
||||||
│ ├─ <a href='bash_scripts/info_references.sh'>info_references.sh</a>
|
│ ├─ <a href="bash_scripts/info_references.sh">info_references.sh</a><small> 1,2K</small>
|
||||||
│ ├─ <a href='bash_scripts/info_tree_license.sh'>info_tree_license.sh</a>
|
│ ├─ <a href="bash_scripts/info_tree_license.sh">info_tree_license.sh</a><small> 3,3K</small>
|
||||||
│ ├─ <a href='bash_scripts/repo_compose.sh'>repo_compose.sh</a>
|
│ ├─ <a href="bash_scripts/repo_compose.sh">repo_compose.sh</a><small> 5,5K</small>
|
||||||
│ ├─ <a href='bash_scripts/repo_forgejo.tmpl.sh'>repo_forgejo.tmpl.sh</a>
|
│ ├─ <a href="bash_scripts/repo_forgejo.tmpl.sh">repo_forgejo.tmpl.sh</a><small> 4,0K</small>
|
||||||
│ ├─ <a href='bash_scripts/repo_forgejo2.tmpl.sh'>repo_forgejo2.tmpl.sh</a>
|
│ ├─ <a href="bash_scripts/repo_forgejo2.tmpl.sh">repo_forgejo2.tmpl.sh</a><small> 4,0K</small>
|
||||||
│ ├─ <a href='bash_scripts/repo_gitlab.tmpl.sh'>repo_gitlab.tmpl.sh</a>
|
│ ├─ <a href="bash_scripts/repo_gitlab.tmpl.sh">repo_gitlab.tmpl.sh</a><small> 4,2K</small>
|
||||||
│ ├─ <a href='bash_scripts/repo_local.tmpl.sh'>repo_local.tmpl.sh</a>
|
│ ├─ <a href="bash_scripts/repo_local.tmpl.sh">repo_local.tmpl.sh</a><small> 1,7K</small>
|
||||||
│ ├─ <a href='bash_scripts/repo_testing.smpl.sh'>repo_testing.smpl.sh</a>
|
│ ├─ <a href="bash_scripts/suite_orchestrate.sh">suite_orchestrate.sh</a><small> 5,1K</small>
|
||||||
│ ├─ <a href='bash_scripts/suite_orchestrate.sh'>suite_orchestrate.sh</a>
|
│ ├─ <a href="bash_scripts/suite_pages2.sh">suite_pages2.sh</a><small> 4,3K</small>
|
||||||
│ └─ <a href='bash_scripts/suite_pages2.sh'>suite_pages2.sh</a>
|
│ ├─ <a href="bash_scripts/suite_profile2.sh">suite_profile2.sh</a><small> 4,6K</small>
|
||||||
├─ <a href='print_screen'>print_screen</a>
|
│ └─ <a href="bash_scripts/suite_testing.sh">suite_testing.sh</a><small> 2,1K</small>
|
||||||
│ ├─ <a href='print_screen/LISTVIEW.md'>LISTVIEW.md</a>
|
├─ <a href="print_screen">print_screen</a>
|
||||||
│ ├─ <a href='print_screen/archive_cleanup.png'>archive_cleanup.png</a>
|
│ ├─ <a href="print_screen/LISTVIEW.md">LISTVIEW.md</a><small> 1,4K</small>
|
||||||
│ ├─ <a href='print_screen/archive_packaging.gif'>archive_packaging.gif</a>
|
│ ├─ <a href="print_screen/archive_backup.png">archive_backup.png</a><small> 2,9K</small>
|
||||||
│ ├─ <a href='print_screen/info_references.png'>info_references.png</a>
|
│ ├─ <a href="print_screen/archive_cleanup.png">archive_cleanup.png</a><small> 1,5K</small>
|
||||||
│ ├─ <a href='print_screen/info_tree_license.png'>info_tree_license.png</a>
|
│ ├─ <a href="print_screen/archive_packaging.gif">archive_packaging.gif</a><small> 22K</small>
|
||||||
│ ├─ <a href='print_screen/repo_compose.png'>repo_compose.png</a>
|
│ ├─ <a href="print_screen/info_references.png">info_references.png</a><small> 2,3K</small>
|
||||||
│ ├─ <a href='print_screen/repo_testing.smpl.png'>repo_testing.smpl.png</a>
|
│ ├─ <a href="print_screen/info_tree_license.png">info_tree_license.png</a><small> 1,6K</small>
|
||||||
│ ├─ <a href='print_screen/suite_orchestrate.gif'>suite_orchestrate.gif</a>
|
│ ├─ <a href="print_screen/repo_compose.png">repo_compose.png</a><small> 1,8K</small>
|
||||||
│ └─ <a href='print_screen/suite_pages2.gif'>suite_pages2.gif</a>
|
│ ├─ <a href="print_screen/suite_orchestrate.gif">suite_orchestrate.gif</a><small> 293K</small>
|
||||||
├─ <a href='.gitignore'>.gitignore</a>
|
│ ├─ <a href="print_screen/suite_pages2.gif">suite_pages2.gif</a><small> 109K</small>
|
||||||
├─ <a href='CONTRIBUTING.md'>CONTRIBUTING.md</a>
|
│ ├─ <a href="print_screen/suite_profile2.gif">suite_profile2.gif</a><small> 106K</small>
|
||||||
├─ <a href='DIRECTORY_TREE.md'>DIRECTORY_TREE.md</a>
|
│ └─ <a href="print_screen/suite_testing.png">suite_testing.png</a><small> 3,9K</small>
|
||||||
├─ <a href='LICENSE.md'>LICENSE.md</a>
|
├─ <a href=".gitignore">.gitignore</a><small> 29</small>
|
||||||
├─ <a href='OPEN_LICENSE.txt'>OPEN_LICENSE.txt</a>
|
├─ <a href="CONTRIBUTING.md">CONTRIBUTING.md</a><small> 557</small>
|
||||||
├─ <a href='README.en.md'>README.en.md</a>
|
├─ <a href="DIRECTORY_TREE.md">DIRECTORY_TREE.md</a><small> 3,8K</small>
|
||||||
└─ <a href='README.md'>README.md</a>
|
├─ <a href="LICENSE.md">LICENSE.md</a><small> 955</small>
|
||||||
|
├─ <a href="OPEN_LICENSE.txt">OPEN_LICENSE.txt</a><small> 25K</small>
|
||||||
|
├─ <a href="README.en.md">README.en.md</a><small> 5,1K</small>
|
||||||
|
└─ <a href="README.md">README.md</a><small> 6,1K</small>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
13
README.en.md
|
@ -1,10 +1,10 @@
|
||||||
# [Dispatcher](README.md)
|
# [Dispatcher](README.md)
|
||||||
|
|
||||||
Creating the archive, switching a domain, saving scripts in the directories of projects and publishing the repositories on to server.
|
Creating the archive, switching a domain, saving scripts in the directories of projects and publishing repositories on the server.
|
||||||
|
|
||||||
| № | Bash script | Actions performed | (+) |
|
| № | Bash script | Actions performed | (+) |
|
||||||
|:-:|:--------------------------------------------------------------|:------------------------------------------------------------------------------------------------|:-----------------------------------------:|
|
|:-:|:--------------------------------------------------------------|:------------------------------------------------------------------------------------------------|:-----------------------------------------:|
|
||||||
| 1 | [**archive_backup.sh**](bash_scripts/archive_backup.sh) | Creating a common archive for the directories of projects on the current date. | |
|
| 1 | [**archive_backup.sh**](bash_scripts/archive_backup.sh) | Creating a common archive for the directories of projects on the current date. | [png](print_screen/archive_backup.png) |
|
||||||
| | [archive_cleanup.sh](bash_scripts/archive_cleanup.sh) | Deleting files and folders from the directories of projects before restoring the archive. | [png](print_screen/archive_cleanup.png) |
|
| | [archive_cleanup.sh](bash_scripts/archive_cleanup.sh) | Deleting files and folders from the directories of projects before restoring the archive. | [png](print_screen/archive_cleanup.png) |
|
||||||
| | [archive_packaging.sh](bash_scripts/archive_packaging.sh) | Building websites, packaging and copying archives for deployment. | [gif](print_screen/archive_packaging.gif) |
|
| | [archive_packaging.sh](bash_scripts/archive_packaging.sh) | Building websites, packaging and copying archives for deployment. | [gif](print_screen/archive_packaging.gif) |
|
||||||
| 2 | [**info_param.sh**](bash_scripts/info_param.sh) | Parameter for other scripts. Switching the domain of the remote repository. | |
|
| 2 | [**info_param.sh**](bash_scripts/info_param.sh) | Parameter for other scripts. Switching the domain of the remote repository. | |
|
||||||
|
@ -12,12 +12,13 @@ Creating the archive, switching a domain, saving scripts in the directories of p
|
||||||
| | [info_tree_license.sh](bash_scripts/info_tree_license.sh) | Building a directory tree for each project and copying license files. | [png](print_screen/info_tree_license.png) |
|
| | [info_tree_license.sh](bash_scripts/info_tree_license.sh) | Building a directory tree for each project and copying license files. | [png](print_screen/info_tree_license.png) |
|
||||||
| 3 | [**repo_compose.sh**](bash_scripts/repo_compose.sh) | Creating scripts from templates with parameters and saving them in the directories of projects. | [png](print_screen/repo_compose.png) |
|
| 3 | [**repo_compose.sh**](bash_scripts/repo_compose.sh) | Creating scripts from templates with parameters and saving them in the directories of projects. | [png](print_screen/repo_compose.png) |
|
||||||
| | [repo_forgejo.tmpl.sh](bash_scripts/repo_forgejo.tmpl.sh) | Template of a script without parameters to create a remote repository forgejo. | |
|
| | [repo_forgejo.tmpl.sh](bash_scripts/repo_forgejo.tmpl.sh) | Template of a script without parameters to create a remote repository forgejo. | |
|
||||||
| | [repo_forgejo2.tmpl.sh](bash_scripts/repo_forgejo2.tmpl.sh) | Template of a script without parameters to deploy a website on the server codeberg. | |
|
| | [repo_forgejo2.tmpl.sh](bash_scripts/repo_forgejo2.tmpl.sh) | Template of a script without parameters to publish a website on the server codeberg. | |
|
||||||
| | [repo_gitlab.tmpl.sh](bash_scripts/repo_gitlab.tmpl.sh) | Template of a script without parameters to create a remote repository gitlab. | |
|
| | [repo_gitlab.tmpl.sh](bash_scripts/repo_gitlab.tmpl.sh) | Template of a script without parameters to create a remote repository gitlab. | |
|
||||||
| | [repo_local.tmpl.sh](bash_scripts/repo_local.tmpl.sh) | Template of a script without parameters to create a local repository git. | |
|
| | [repo_local.tmpl.sh](bash_scripts/repo_local.tmpl.sh) | Template of a script without parameters to create a local repository git. | |
|
||||||
| | [repo_testing.smpl.sh](bash_scripts/repo_testing.smpl.sh) | Sample of a script for testing the accessibility of pages in the web-interface on the server. | [png](print_screen/repo_testing.smpl.png) |
|
| 4 | [**suite_orchestrate.sh**](bash_scripts/suite_orchestrate.sh) | Execution of scripts. Publishing the source code from the directories of projects. | [gif](print_screen/suite_orchestrate.gif) |
|
||||||
| 4 | [**suite_orchestrate.sh**](bash_scripts/suite_orchestrate.sh) | Parallel execution of scripts and publishing the repositories for the directories of projects. | [gif](print_screen/suite_orchestrate.gif) |
|
| | [suite_pages2.sh](bash_scripts/suite_pages2.sh) | Execution of scripts. Publishing the finished websites on the server codeberg. | [gif](print_screen/suite_pages2.gif) |
|
||||||
| | [suite_pages2.sh](bash_scripts/suite_pages2.sh) | Parallel execution of scripts and deploying the websites on the server codeberg. | [gif](print_screen/suite_pages2.gif) |
|
| | [suite_profile2.sh](bash_scripts/suite_profile2.sh) | Execution of scripts. Publishing the tables of contents of websites on the server codeberg. | [gif](print_screen/suite_profile2.gif) |
|
||||||
|
| | [suite_testing.sh](bash_scripts/suite_testing.sh) | Testing the accessibility of pages in the web-interface on the server. | [png](print_screen/suite_testing.png) |
|
||||||
|
|
||||||
## Directories of projects
|
## Directories of projects
|
||||||
|
|
||||||
|
|
33
README.md
|
@ -2,22 +2,23 @@
|
||||||
|
|
||||||
Создание архива, переключение домена, сохранение скриптов в каталогах проектов и публикация репозиториев на сервере.
|
Создание архива, переключение домена, сохранение скриптов в каталогах проектов и публикация репозиториев на сервере.
|
||||||
|
|
||||||
| № | Скрипт Bash | Выполняемые действия | (+) |
|
| № | Скрипт Bash | Выполняемые действия | (+) |
|
||||||
|:-:|:--------------------------------------------------------------|:-----------------------------------------------------------------------------------|:-----------------------------------------:|
|
|:-:|:--------------------------------------------------------------|:----------------------------------------------------------------------------------|:-----------------------------------------:|
|
||||||
| 1 | [**archive_backup.sh**](bash_scripts/archive_backup.sh) | Создание общего архива для каталогов проектов на текущую дату. | |
|
| 1 | [**archive_backup.sh**](bash_scripts/archive_backup.sh) | Создание общего архива для каталогов проектов на текущую дату. | [png](print_screen/archive_backup.png) |
|
||||||
| | [archive_cleanup.sh](bash_scripts/archive_cleanup.sh) | Удаление файлов и папок из каталогов проектов перед восстановлением архива. | [png](print_screen/archive_cleanup.png) |
|
| | [archive_cleanup.sh](bash_scripts/archive_cleanup.sh) | Удаление файлов и папок из каталогов проектов перед восстановлением архива. | [png](print_screen/archive_cleanup.png) |
|
||||||
| | [archive_packaging.sh](bash_scripts/archive_packaging.sh) | Сборка вёб-сайтов, упаковка и копирование архивов для развёртывания. | [gif](print_screen/archive_packaging.gif) |
|
| | [archive_packaging.sh](bash_scripts/archive_packaging.sh) | Сборка вёб-сайтов, упаковка и копирование архивов для развёртывания. | [gif](print_screen/archive_packaging.gif) |
|
||||||
| 2 | [**info_param.sh**](bash_scripts/info_param.sh) | Параметр для других скриптов. Переключение домена удалённого репозитория. | |
|
| 2 | [**info_param.sh**](bash_scripts/info_param.sh) | Параметр для других скриптов. Переключение домена удалённого репозитория. | |
|
||||||
| | [info_references.sh](bash_scripts/info_references.sh) | Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях. | [png](print_screen/info_references.png) |
|
| | [info_references.sh](bash_scripts/info_references.sh) | Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях. | [png](print_screen/info_references.png) |
|
||||||
| | [info_tree_license.sh](bash_scripts/info_tree_license.sh) | Построение дерева каталогов для каждого проекта и копирование файлов лицензии. | [png](print_screen/info_tree_license.png) |
|
| | [info_tree_license.sh](bash_scripts/info_tree_license.sh) | Построение дерева каталогов для каждого проекта и копирование файлов лицензии. | [png](print_screen/info_tree_license.png) |
|
||||||
| 3 | [**repo_compose.sh**](bash_scripts/repo_compose.sh) | Создание скриптов из шаблонов с параметрами и сохранение их в каталогах проектов. | [png](print_screen/repo_compose.png) |
|
| 3 | [**repo_compose.sh**](bash_scripts/repo_compose.sh) | Создание скриптов из шаблонов с параметрами и сохранение их в каталогах проектов. | [png](print_screen/repo_compose.png) |
|
||||||
| | [repo_forgejo.tmpl.sh](bash_scripts/repo_forgejo.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория forgejo. | |
|
| | [repo_forgejo.tmpl.sh](bash_scripts/repo_forgejo.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория forgejo. | |
|
||||||
| | [repo_forgejo2.tmpl.sh](bash_scripts/repo_forgejo2.tmpl.sh) | Шаблон скрипта без параметров для развёртывания вёб-сайта на сервере codeberg. | |
|
| | [repo_forgejo2.tmpl.sh](bash_scripts/repo_forgejo2.tmpl.sh) | Шаблон скрипта без параметров для публикации вёб-сайта на сервере codeberg. | |
|
||||||
| | [repo_gitlab.tmpl.sh](bash_scripts/repo_gitlab.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория gitlab. | |
|
| | [repo_gitlab.tmpl.sh](bash_scripts/repo_gitlab.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория gitlab. | |
|
||||||
| | [repo_local.tmpl.sh](bash_scripts/repo_local.tmpl.sh) | Шаблон скрипта без параметров для создания локального репозитория git. | |
|
| | [repo_local.tmpl.sh](bash_scripts/repo_local.tmpl.sh) | Шаблон скрипта без параметров для создания локального репозитория git. | |
|
||||||
| | [repo_testing.smpl.sh](bash_scripts/repo_testing.smpl.sh) | Образец скрипта для тестирования доступности страниц в вёб-интерфейсе на сервере. | [png](print_screen/repo_testing.smpl.png) |
|
| 4 | [**suite_orchestrate.sh**](bash_scripts/suite_orchestrate.sh) | Выполнение скриптов. Публикация исходного кода из каталогов проектов. | [gif](print_screen/suite_orchestrate.gif) |
|
||||||
| 4 | [**suite_orchestrate.sh**](bash_scripts/suite_orchestrate.sh) | Параллельное выполнение скриптов и публикация репозиториев для каталогов проектов. | [gif](print_screen/suite_orchestrate.gif) |
|
| | [suite_pages2.sh](bash_scripts/suite_pages2.sh) | Выполнение скриптов. Публикация готовых вёб-сайтов на сервере codeberg. | [gif](print_screen/suite_pages2.gif) |
|
||||||
| | [suite_pages2.sh](bash_scripts/suite_pages2.sh) | Параллельное выполнение скриптов и развёртывание вёб-сайтов на сервере codeberg. | [gif](print_screen/suite_pages2.gif) |
|
| | [suite_profile2.sh](bash_scripts/suite_profile2.sh) | Выполнение скриптов. Публикация оглавлений вёб-сайтов на сервере codeberg. | [gif](print_screen/suite_profile2.gif) |
|
||||||
|
| | [suite_testing.sh](bash_scripts/suite_testing.sh) | Тестирование доступности страниц в вёб-интерфейсе на сервере. | [png](print_screen/suite_testing.png) |
|
||||||
|
|
||||||
## Каталоги проектов
|
## Каталоги проектов
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 3.9 KiB |
|
@ -1,9 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Создание общего архива для каталогов проектов на текущую дату."
|
echo "Создание общего архива для каталогов проектов на текущую дату."
|
||||||
cd ../.. # выход из папки и из репозитория
|
|
||||||
filename="pomodoro-$(date '+%Y-%m-%d').zip"
|
filename="pomodoro-$(date '+%Y-%m-%d').zip"
|
||||||
# сводная строка исключений для всех проектов из файлов ".gitignore"
|
cd ../.. # выход из папки и из репозитория
|
||||||
exclusions="$(find . -maxdepth 2 -type f -name '.gitignore' -exec \
|
time_ms="$(date '+%s%3N')"
|
||||||
sed -E "s|^(.*)$|-xr!'\1'|" {} \; | sort | uniq | tr '\n' ' ')"
|
rm -vf "$filename" # удаление старого файла
|
||||||
rm -f "$filename"
|
# поиск всех каталогов на одном уровне с текущим, кроме папки ".idea", сортировка и добавление
|
||||||
eval "7z a -tzip '$filename' . -xr!'.git' $exclusions" | grep -E '\S'
|
# в общий архив их содержимого, за исключением неотслеживаемых файлов по спискам ".gitignore"
|
||||||
|
find . -mindepth 1 -maxdepth 1 -type d -not -path "*.idea*" -printf '%P\n' | sort | xargs -I{} bash -c \
|
||||||
|
"echo 'Обработка += {}' && 7z u -tzip $filename {} -xr!'.git' -xr@'{}/.gitignore' &>/dev/null"
|
||||||
|
# вывод общей информации о целостности полученного архива
|
||||||
|
7z t "$filename" |& grep -E '\S' | grep -E "\-\-|ERROR" -A20
|
||||||
|
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
||||||
|
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
||||||
|
ms="$((tms % 1000))" && printf 'Общее время выполнения: %02d:%02d.%03d мс.\n' "$min" "$sec" "$ms"
|
||||||
|
|
|
@ -4,23 +4,23 @@ echo "Сборка вёб-сайтов, упаковка и копировани
|
||||||
function packaging {
|
function packaging {
|
||||||
dir="pomodoro${1}" && red="\e[91m" && green="\e[92m" && norm="\e[0m"
|
dir="pomodoro${1}" && red="\e[91m" && green="\e[92m" && norm="\e[0m"
|
||||||
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
||||||
num="$((7 - ${1}))" && pre="\e[${num}A${dir}: " && aft="\e[K\e[${num}B\r"
|
num="$((7 - ${1}))" && pre="\e[${num}A${dir} " && aft="\e[K\e[${num}B\r"
|
||||||
printf "${pre}%s${aft}" "Обработка."
|
printf "${pre}%s %s${aft}" "[•••]" "Обработка."
|
||||||
cd "./$dir" &>/dev/null || { printf "${pre}${red}%s${norm}${aft}" "Не найден каталог." && return; }
|
cd "./$dir" &>/dev/null || { printf "${pre}${red}%s${norm} %s${aft}" "[•••]" "Не найден каталог." && return; }
|
||||||
printf "${pre}%s${aft}" "Сборка."
|
printf "${pre}%s %s${aft}" "[#••]" "Сборка."
|
||||||
./build.sh &>/dev/null || { printf "${pre}${red}%s${norm}${aft}" "Ошибка сборки." && return; }
|
./build.sh &>/dev/null || { printf "${pre}${red}%s${norm} %s${aft}" "[#••]" "Ошибка сборки." && return; }
|
||||||
printf "${pre}%s${aft}" "Упаковка."
|
printf "${pre}%s %s${aft}" "[##•]" "Упаковка."
|
||||||
./package.sh &>/dev/null || { printf "${pre}${red}%s${norm}${aft}" "Ошибка упаковки." && return; }
|
./package.sh &>/dev/null || { printf "${pre}${red}%s${norm} %s${aft}" "[##•]" "Ошибка упаковки." && return; }
|
||||||
printf "${pre}%s${aft}" "Копирование."
|
printf "${pre}%s %s${aft}" "[###]" "Копирование."
|
||||||
cp "$dir".zip .. &>/dev/null || { printf "${pre}${red}%s${norm}${aft}" "Ошибка копирования." && return; }
|
cp "$dir".zip .. &>/dev/null || { printf "${pre}${red}%s${norm} %s${aft}" "[###]" "Ошибка копирования." && return; }
|
||||||
printf "${pre}${green}%s${norm}${aft}" "Выполнено."
|
printf "${pre}${green}%s${norm} %s${aft}" "[###]" "Выполнено."
|
||||||
}
|
}
|
||||||
export -f packaging
|
export -f packaging
|
||||||
cd ../.. # выход из папки и из репозитория
|
cd ../.. # выход из папки и из репозитория
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
# смещение курсора вниз на соответствующее количество строк
|
# смещение курсора вниз на соответствующее количество строк
|
||||||
printf 'pomodoro%s\n' {1..6}
|
printf 'pomodoro%s\n' {1..6}
|
||||||
# обход всех вёб-сайтов и параллельный запуск функции для каждого
|
# вывод номеров вёб-сайтов и параллельный запуск функции для каждого
|
||||||
printf 'packaging "%s"\0' {1..6} | xargs -n1 -0 -P0 bash -c
|
printf 'packaging "%s"\0' {1..6} | xargs -n1 -0 -P0 bash -c
|
||||||
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
||||||
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
||||||
|
|
|
@ -17,7 +17,7 @@ else
|
||||||
fi
|
fi
|
||||||
cd ../.. # выход из папки и из репозитория
|
cd ../.. # выход из папки и из репозитория
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
# поиск файлов "README" и параллельная подстановка значений по шаблонам для каждого
|
# поиск файлов "README" в корне каждого репозитория, замена строк по шаблонам и сортировка вывода
|
||||||
find . -type f -name "README*.md" -printf '%p\0' | xargs -I{} -n1 -0 -P0 bash -c \
|
find . -maxdepth 2 -type f -name "README*.md" -printf '%p\0' | xargs -I{} -n1 -0 -P0 bash -c \
|
||||||
"echo '$domain => {}' && sed -i $(printf " -e '%s'" "${expr[@]}") '{}'"
|
"echo '$domain => {}' && sed -i $(printf " -e '%s'" "${expr[@]}") '{}'" | LC_COLLATE=C sort
|
||||||
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
||||||
|
|
|
@ -20,7 +20,10 @@ function directory_tree {
|
||||||
# префикс текущего элемента, сворачивать синглтоны в одну строку
|
# префикс текущего элемента, сворачивать синглтоны в одну строку
|
||||||
[ "$4" == "one" ] && printf '%s' "/" || printf '\n%s' "$head"
|
[ "$4" == "one" ] && printf '%s' "/" || printf '\n%s' "$head"
|
||||||
# текущий элемент дерева — относительная гиперссылка
|
# текущий элемент дерева — относительная гиперссылка
|
||||||
printf '%s' "<a href='${path#*/}'>${path##*/}</a>"
|
printf '<a href="%s">%s</a>' "${path#*/}" "${path##*/}"
|
||||||
|
# суффикс текущего элемента — размер файла меньшим шрифтом
|
||||||
|
[ -f "$path" ] && printf '<small> %s</small>' \
|
||||||
|
"$(stat -c %s "$path" | numfmt --to=iec --round=nearest)"
|
||||||
# рекурсивные вызовы для подкаталогов
|
# рекурсивные вызовы для подкаталогов
|
||||||
if [ -d "$path" ]; then
|
if [ -d "$path" ]; then
|
||||||
local i # счётчик
|
local i # счётчик
|
||||||
|
@ -46,7 +49,7 @@ function tree_license {
|
||||||
fi
|
fi
|
||||||
# строка исключений для "ls" из списка неотслеживаемых файлов ".gitignore"
|
# строка исключений для "ls" из списка неотслеживаемых файлов ".gitignore"
|
||||||
exclusions="-I'.git' $(sed -E "s|^(.*)$|-I'\1'|" .gitignore | tr '\n' ' ')"
|
exclusions="-I'.git' $(sed -E "s|^(.*)$|-I'\1'|" .gitignore | tr '\n' ' ')"
|
||||||
# помещаем дерево в контейнер, добавляем заголовок и выводим в файл
|
# поместить дерево в контейнер, добавить заголовок и вывести в файл
|
||||||
printf '%s\n' "## Дерево каталогов" "" "<pre>" \
|
printf '%s\n' "## Дерево каталогов" "" "<pre>" \
|
||||||
"$(directory_tree . | grep '\S')" "</pre>" >DIRECTORY_TREE.md
|
"$(directory_tree . | grep '\S')" "</pre>" >DIRECTORY_TREE.md
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,8 @@ export basedir="$PWD" # текущая папка
|
||||||
function compose {
|
function compose {
|
||||||
echo "Обработка: $1"
|
echo "Обработка: $1"
|
||||||
cd "$1" || return
|
cd "$1" || return
|
||||||
# добавление скриптов в список неотслеживаемых файлов, если ещё не добавлено
|
# удаление скриптов предыдущей компоновки, если таковые имеются
|
||||||
if [[ ! -f ".gitignore" || "$(grep -cF ".repo_*" ".gitignore")" == 0 ]]; then
|
find . -maxdepth 1 -type f -name ".repo_*" -exec rm -f {} \;
|
||||||
echo ".repo_*" >>".gitignore" && echo "Обновлён файл: $1/.gitignore"
|
|
||||||
fi
|
|
||||||
# подготовка значений для параметров
|
# подготовка значений для параметров
|
||||||
user="golovin" && owner="$user" && repo="$1"
|
user="golovin" && owner="$user" && repo="$1"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -25,63 +23,74 @@ function compose {
|
||||||
pomodoro) description="Описание и оглавление" ;;
|
pomodoro) description="Описание и оглавление" ;;
|
||||||
color*) description="Тема оформления / Цветной помидор" ;;
|
color*) description="Тема оформления / Цветной помидор" ;;
|
||||||
older*) description="Тема оформления / Старый помидор" ;;
|
older*) description="Тема оформления / Старый помидор" ;;
|
||||||
*) return ;; # шесть помидорных вёб-сайтов и три сопутствующих проекта
|
*) return ;; # шесть помидорных вёб-сайтов и четыре сопутствующих проекта
|
||||||
esac
|
esac
|
||||||
file="DIRECTORY_TREE.md"
|
|
||||||
if [ "$domain" == "hub.mos.ru" ]; then
|
if [ "$domain" == "hub.mos.ru" ]; then
|
||||||
model="gitlab" && folder="blob" && wiki_home="-/wikis/home"
|
model="gitlab" && [ -f "WIKI.md" ] && wiki="$(uni2ascii -aU -qpsn "WIKI.md")"
|
||||||
[ -f "WIKI.md" ] && wiki="$(uni2ascii -aU -qpsn "WIKI.md")"
|
|
||||||
else
|
else
|
||||||
model="forgejo" && folder="src/branch" && wiki_home="wiki"
|
model="forgejo" && [ -f "WIKI.md" ] && wiki="$(basenc --base64 -w0 "WIKI.md")"
|
||||||
[ -f "WIKI.md" ] && wiki="$(basenc "WIKI.md" --base64 -w0)"
|
|
||||||
fi
|
fi
|
||||||
if [ "$domain" == "codeberg.org" ]; then
|
if [ "$domain" == "codeberg.org" ]; then
|
||||||
[[ "$1" =~ [1-6] ]] && description2="Исходные тексты вёб-сайта — https://$domain/$owner/$repo"
|
[[ "$1" =~ [1-6] ]] && description2="Исходные тексты вёб-сайта — https://$domain/$owner/$repo"
|
||||||
[ -f "WIKI.md" ] && wiki="$(sed 's|mircloud\.ru|codeberg.page|g' WIKI.md | basenc --base64 -w0)"
|
[ -f "WIKI.md" ] && wiki="$(sed 's|mircloud\.ru|codeberg.page|g' WIKI.md | basenc --base64 -w0)"
|
||||||
description="${description//mircloud.ru/codeberg.page}"
|
description="${description//mircloud.ru/codeberg.page}"
|
||||||
fi
|
fi
|
||||||
# создание трёх скриптов в каталоге проекта с одинаковой шапкой для всех
|
# параметры для публикации репозитория
|
||||||
echo "#!/bin/bash" | tee ".repo_remote.sh" ".repo_local.sh" >".repo_testing.sh"
|
repo_publish+=("#!/bin/bash")
|
||||||
chmod +x ".repo_remote.sh" ".repo_local.sh" ".repo_testing.sh"
|
repo_publish+=("domain='$domain'")
|
||||||
# параметры для удалённого репозитория
|
repo_publish+=("owner='$owner'")
|
||||||
param_remote+=("domain='$domain'")
|
repo_publish+=("user='$user'")
|
||||||
param_remote+=("owner='$owner'")
|
repo_publish+=("repo='$repo'")
|
||||||
param_remote+=("user='$user'")
|
repo_publish+=("dir='$1'")
|
||||||
param_remote+=("repo='$repo'")
|
repo_publish+=("description='$description'")
|
||||||
param_remote+=("description='$description'")
|
repo_publish+=("wiki='$wiki'")
|
||||||
param_remote+=("wiki='$wiki'")
|
repo_publish+=("token='$(head -n+1 "$basedir/.token_$model")'")
|
||||||
param_remote+=("token='$(head -n+1 "$basedir/.token_$model")'")
|
# шаблоны для публикации репозитория
|
||||||
# скрипт для создания удалённого репозитория
|
tmpl_remote="$basedir/repo_$model.tmpl.sh"
|
||||||
printf '%s\n' "${param_remote[@]}" >>".repo_remote.sh"
|
tmpl_local="$basedir/repo_local.tmpl.sh"
|
||||||
tail -n+2 "$basedir/repo_$model.tmpl.sh" >>".repo_remote.sh"
|
# место вставки для локального шаблона
|
||||||
# параметры для локального репозитория
|
local="$(grep -nF '#LOCAL#' "$tmpl_remote" | sed 's|:.*$||')"
|
||||||
param_local+=("domain='$domain'")
|
{ # скрипт для публикации репозитория
|
||||||
param_local+=("owner='$owner'")
|
printf '%s\n' "${repo_publish[@]}"
|
||||||
param_local+=("repo='$repo'")
|
head -n+"$((local - 1))" "$tmpl_remote" | tail -n+2
|
||||||
param_local+=("dir='$1'")
|
tail -n+2 "$tmpl_local"
|
||||||
# скрипт для создания локального репозитория
|
tail -n+"$((local + 1))" "$tmpl_remote"
|
||||||
printf '%s\n' "${param_local[@]}" >>".repo_local.sh"
|
} >".repo_publish.sh"
|
||||||
tail -n+2 "$basedir/repo_local.tmpl.sh" >>".repo_local.sh"
|
chmod 555 ".repo_publish.sh"
|
||||||
# параметры для тестирования вёб-интерфейса
|
# два скрипта для публикации вёб-сайтов
|
||||||
param_testing+=("'https://$domain/$owner/$repo/$folder/master/$file' '$file'")
|
if [[ "$domain" == "codeberg.org" ]]; then
|
||||||
[ "$wiki" ] && param_testing+=("'https://$domain/$owner/$repo/$wiki_home' 'Home'")
|
# шесть помидорных вёб-сайтов и один общий помидор
|
||||||
# скрипт для тестирования вёб-интерфейса
|
[[ "$1" =~ [1-6] ]] && group="$owner$repo" || group="pomodoro"
|
||||||
printf 'pages+=("%s")\n' "${param_testing[@]}" >>".repo_testing.sh"
|
if [[ "$1" =~ [1-6] ]]; then
|
||||||
tail -n+21 "$basedir/repo_testing.smpl.sh" >>".repo_testing.sh"
|
# параметры для развёртывания вёб-сайта
|
||||||
# создание четвёртого скрипта в каталоге вёб-сайта
|
param_pages+=("#!/bin/bash")
|
||||||
if [[ "$domain" == "codeberg.org" && "$1" =~ [1-6] ]]; then
|
param_pages+=("domain='$domain'")
|
||||||
# параметры для развёртывания вёб-сайта
|
param_pages+=("owner='$group'")
|
||||||
param_pages+=("#!/bin/bash")
|
param_pages+=("folder='_site'")
|
||||||
param_pages+=("domain='$domain'")
|
param_pages+=("repo='pages'")
|
||||||
param_pages+=("owner='$owner$repo'")
|
param_pages+=("avatar='website'")
|
||||||
param_pages+=("user='$user'")
|
param_pages+=("description='$description2'")
|
||||||
param_pages+=("repo='pages'")
|
param_pages+=("token='$(head -n+1 "$basedir/.token_forgejo")'")
|
||||||
param_pages+=("description='$description2'")
|
# скрипт для развёртывания вёб-сайта
|
||||||
param_pages+=("token='$(head -n+1 "$basedir/.token_forgejo")'")
|
printf '%s\n' "${param_pages[@]}" >".repo_pages2.sh"
|
||||||
# скрипт для развёртывания вёб-сайта
|
tail -n+2 "$basedir/repo_forgejo2.tmpl.sh" >>".repo_pages2.sh"
|
||||||
printf '%s\n' "${param_pages[@]}" >".repo_pages2.sh"
|
chmod 555 ".repo_pages2.sh"
|
||||||
tail -n+2 "$basedir/repo_forgejo2.tmpl.sh" >>".repo_pages2.sh"
|
fi
|
||||||
chmod +x ".repo_pages2.sh"
|
if [[ "$1" == "pomodoro" || "$1" =~ [1-5] ]]; then
|
||||||
|
# параметры для оглавления вёб-сайта
|
||||||
|
param_profile+=("#!/bin/bash")
|
||||||
|
param_profile+=("domain='$domain'")
|
||||||
|
param_profile+=("owner='$group'")
|
||||||
|
param_profile+=("folder='_profile'")
|
||||||
|
param_profile+=("repo='.profile'")
|
||||||
|
param_profile+=("avatar='pomodoro'")
|
||||||
|
param_profile+=("description='Оглавление / Contents'")
|
||||||
|
param_profile+=("token='$(head -n+1 "$basedir/.token_forgejo")'")
|
||||||
|
# скрипт для оглавления вёб-сайта
|
||||||
|
printf '%s\n' "${param_profile[@]}" >".repo_profile2.sh"
|
||||||
|
tail -n+2 "$basedir/repo_forgejo2.tmpl.sh" >>".repo_profile2.sh"
|
||||||
|
chmod 555 ".repo_profile2.sh"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
export -f compose
|
export -f compose
|
||||||
|
|
|
@ -1,56 +1,76 @@
|
||||||
#!/bin/false
|
#!/bin/false
|
||||||
if [[ -z "$domain" || -z "$token" || -z "$owner" || -z "$repo" || -z "$description" || -z "$user" ]]; then
|
if [[ -z "$domain" || -z "$token" || -z "$owner" || -z "$repo" || -z "$description" || -z "$user" || -z "$dir" ]]; then
|
||||||
echo "Не указаны обязательные параметры." && exit 1
|
echo "Не указаны обязательные параметры." && exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Создание удалённого репозитория для текущего проекта."
|
|
||||||
fi
|
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
if [[ -z "$1" || "$1" == "delete" ]]; then
|
if [[ -z "$1" || "$1" == "delete" ]]; then
|
||||||
echo "Удаление старого репозитория."
|
echo "Удаление старого репозитория."
|
||||||
curl -i -X DELETE "https://$domain/api/v1/repos/$owner/$repo" \
|
curl -f -X DELETE "https://$domain/api/v1/repos/$owner/$repo" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json"
|
-H "Accept: application/json" &>/dev/null \
|
||||||
|
|| { echo "Не удалось удалить репозиторий на сервере."; }
|
||||||
fi
|
fi
|
||||||
if [[ -z "$1" || "$1" == "create" ]]; then
|
if [[ -z "$1" || "$1" == "create" ]]; then
|
||||||
echo "Создание нового репозитория пользователя."
|
echo "Создание нового репозитория пользователя."
|
||||||
curl -i -X POST "https://$domain/api/v1/user/repos" \
|
curl -f -X POST "https://$domain/api/v1/user/repos" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{ \"name\": \"$repo\", \"description\": \"$description\" }"
|
-H "Content-Type: application/json" -d "{
|
||||||
|
\"name\": \"$repo\", \"description\": \"$description\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось создать репозиторий на сервере."; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "transfer" ]]; then
|
||||||
if [ "$user" != "$owner" ]; then
|
if [ "$user" != "$owner" ]; then
|
||||||
echo "Перемещение репозитория в группу."
|
echo "Перемещение репозитория в группу."
|
||||||
curl -i -X POST "https://$domain/api/v1/repos/$user/$repo/transfer" \
|
curl -f -X POST "https://$domain/api/v1/repos/$user/$repo/transfer" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{ \"new_owner\": \"$owner\" }"
|
-H "Content-Type: application/json" -d "{ \"new_owner\": \"$owner\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось переместить репозиторий в группу." && exit 1; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -z "$1" || "$1" == "options" ]]; then
|
[ -n "$wiki" ] && has_wiki=true || has_wiki=false
|
||||||
[ "$wiki" ] && has_wiki=true || has_wiki=false
|
if [[ -z "$1" || "$1" == "patch" ]]; then
|
||||||
echo "Изменение свойств репозитория / отключение ненужного."
|
echo "Изменение свойств репозитория / отключение ненужного."
|
||||||
curl -i -X PATCH "https://$domain/api/v1/repos/$owner/$repo" \
|
curl -f -X PATCH "https://$domain/api/v1/repos/$owner/$repo" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{
|
-H "Content-Type: application/json" -d "{
|
||||||
\"has_projects\": false, \"has_issues\": false,
|
\"has_projects\": false, \"has_issues\": false,
|
||||||
\"has_releases\": false, \"has_actions\": false,
|
\"has_releases\": false, \"has_actions\": false,
|
||||||
\"has_packages\": false, \"has_pull_requests\": false,
|
\"has_packages\": false, \"has_pull_requests\": false,
|
||||||
\"has_wiki\": $has_wiki }"
|
\"has_wiki\": $has_wiki }" &>/dev/null \
|
||||||
if [ "$wiki" ]; then
|
|| { echo "Не удалось изменить свойства репозитория на сервере." && exit 1; }
|
||||||
echo "Добавление страницы wiki в репозиторий."
|
fi
|
||||||
curl -i -X POST "https://$domain/api/v1/repos/$owner/$repo/wiki/new" \
|
if [[ -z "$1" || "$1" == "wiki" ]] && [[ -n "$wiki" ]]; then
|
||||||
-H "Authorization: token $token" \
|
echo "Добавление страницы wiki в репозиторий."
|
||||||
-H "Accept: application/json" \
|
curl -f -X POST "https://$domain/api/v1/repos/$owner/$repo/wiki/new" \
|
||||||
-H "Content-Type: application/json" -d "{ \"content_base64\": \"$wiki\", \"title\": \"Home\" }"
|
-H "Authorization: token $token" \
|
||||||
fi
|
-H "Accept: application/json" \
|
||||||
|
-H "Content-Type: application/json" -d "{
|
||||||
|
\"content_base64\": \"$wiki\", \"title\": \"Home\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось добавить страницу wiki для репозитория." && exit 1; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "avatar" ]]; then
|
||||||
echo "Добавление аватарки для репозитория."
|
echo "Добавление аватарки для репозитория."
|
||||||
[ "$user" != "$owner" ] && picture="website" || picture="$repo"
|
[ "$user" != "$owner" ] && picture="website" || picture="$repo"
|
||||||
avatar=$(basenc "../dispatcher/avatars/$picture.jpg" --base64 -w0)
|
avatar=$(basenc "../dispatcher/avatars/$picture.jpg" --base64 -w0)
|
||||||
curl -i -X POST "https://$domain/api/v1/repos/$owner/$repo/avatar" \
|
curl -f -X POST "https://$domain/api/v1/repos/$owner/$repo/avatar" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{ \"image\": \"$avatar\" }"
|
-H "Content-Type: application/json" -d "{ \"image\": \"$avatar\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось добавить аватарку для репозитория." && exit 1; }
|
||||||
|
fi
|
||||||
|
#LOCAL#
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Ожидание 3 секунды." && sleep 3
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "testing" ]]; then
|
||||||
|
echo "Получение списка ветвей для удалённого репозитория."
|
||||||
|
curl -f -X GET "https://$domain/api/v1/repos/$owner/$repo/branches" \
|
||||||
|
-H "Authorization: token $token" \
|
||||||
|
-H "Accept: application/json" 2>/dev/null | grep -v '^null$' &>/dev/null \
|
||||||
|
|| { echo "Не удалось получить список ветвей для репозитория." && exit 1; }
|
||||||
fi
|
fi
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
||||||
|
|
|
@ -1,59 +1,79 @@
|
||||||
#!/bin/false
|
#!/bin/false
|
||||||
if [[ -z "$domain" || -z "$token" || -z "$owner" || -z "$repo" || -z "$description" || -z "$user" ]]; then
|
if [[ -z "$domain" || -z "$token" || -z "$owner" || -z "$repo" || -z "$description" || -z "$folder" ]]; then
|
||||||
echo "Не указаны обязательные параметры." && exit 1
|
echo "Не указаны обязательные параметры." && exit 1
|
||||||
elif [ "$domain" != "codeberg.org" ]; then
|
elif [ "$domain" != "codeberg.org" ]; then
|
||||||
echo "Некорректно указан сервер." && exit 1
|
echo "Некорректно указан сервер." && exit 1
|
||||||
fi
|
fi
|
||||||
cd _site || exit 1
|
if [[ -z "$1" || "$1" == "prepare" ]] && [[ "$folder" == ".profile" ]]; then
|
||||||
if [ -z "$1" ]; then
|
echo "Создание каталога и создание файлов в каталоге."
|
||||||
echo "Создание удалённого репозитория, локального репозитория, отправка данных и проверка их получения."
|
rm -rf "$folder" && mkdir "$folder"
|
||||||
|
if [[ "$owner" == "pomodoro" ]]; then
|
||||||
|
expr+=" -e 's|details open|details|'"
|
||||||
|
fi
|
||||||
|
expr+=" -e 's|mircloud\.ru|codeberg.page|g'"
|
||||||
|
eval "sed $expr 'WIKI.md'" >"$folder/README.md"
|
||||||
|
echo "*.md linguist-language=INFO" >"$folder/.gitattributes"
|
||||||
fi
|
fi
|
||||||
|
cd "$folder" || exit 1
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
if [[ -z "$1" || "$1" == "remote" ]]; then
|
if [[ -z "$1" || "$1" == "delete" ]]; then
|
||||||
echo "Удаление старого репозитория на сервере."
|
echo "Удаление старого репозитория на сервере."
|
||||||
curl -i -X DELETE "https://$domain/api/v1/repos/$owner/$repo" \
|
curl -f -X DELETE "https://$domain/api/v1/repos/$owner/$repo" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json"
|
-H "Accept: application/json" &>/dev/null \
|
||||||
|
|| { echo "Не удалось удалить репозиторий на сервере."; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "create" ]]; then
|
||||||
echo "Создание нового репозитория в группе на сервере."
|
echo "Создание нового репозитория в группе на сервере."
|
||||||
curl -i -X POST "https://$domain/api/v1/orgs/$owner/repos" \
|
curl -f -X POST "https://$domain/api/v1/orgs/$owner/repos" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{
|
-H "Content-Type: application/json" -d "{
|
||||||
\"name\": \"$repo\", \"description\": \"$description\" }"
|
\"name\": \"$repo\", \"description\": \"$description\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось создать репозиторий на сервере." && exit 1; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "patch" ]]; then
|
||||||
echo "Изменение свойств репозитория / отключение ненужного."
|
echo "Изменение свойств репозитория / отключение ненужного."
|
||||||
curl -i -X PATCH "https://$domain/api/v1/repos/$owner/$repo" \
|
curl -f -X PATCH "https://$domain/api/v1/repos/$owner/$repo" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{
|
-H "Content-Type: application/json" -d "{
|
||||||
\"has_projects\": false, \"has_issues\": false,
|
\"has_projects\": false, \"has_issues\": false,
|
||||||
\"has_releases\": false, \"has_actions\": false,
|
\"has_releases\": false, \"has_actions\": false,
|
||||||
\"has_packages\": false, \"has_pull_requests\": false,
|
\"has_packages\": false, \"has_pull_requests\": false,
|
||||||
\"has_wiki\": false }"
|
\"has_wiki\": false }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось изменить свойства репозитория на сервере." && exit 1; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "avatar" ]]; then
|
||||||
echo "Добавление аватарки для репозитория."
|
echo "Добавление аватарки для репозитория."
|
||||||
avatar=$(basenc "../../dispatcher/avatars/website.jpg" --base64 -w0)
|
avatar=$(basenc "../../dispatcher/avatars/$avatar.jpg" --base64 -w0)
|
||||||
curl -i -X POST "https://$domain/api/v1/repos/$owner/$repo/avatar" \
|
curl -f -X POST "https://$domain/api/v1/repos/$owner/$repo/avatar" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Content-Type: application/json" -d "{ \"image\": \"$avatar\" }"
|
-H "Content-Type: application/json" -d "{ \"image\": \"$avatar\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось добавить аватарку для репозитория." && exit 1; }
|
||||||
fi
|
fi
|
||||||
if [[ -z "$1" || "$1" == "local" ]]; then
|
if [[ -z "$1" || "$1" == "local" ]]; then
|
||||||
echo "Пересоздание локального репозитория и отправка данных на сервер."
|
echo "Создание локального репозитория."
|
||||||
rm -rf ".git" # удаление старого репозитория
|
rm -rf ".git" # удаление старого репозитория
|
||||||
git init -b "master"
|
git init -b "master"
|
||||||
git remote add "$domain" "git@$domain:$owner/$repo.git"
|
|
||||||
git add --all
|
git add --all
|
||||||
git commit -m "$(printf '%(%F %T)T' "$(stat . -c'%W')")"
|
git commit -m "$(date -I'seconds' -d"@$(stat . -c'%W')")"
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "push" ]]; then
|
||||||
|
echo "Подключение к удалённому репозиторию и передача данных."
|
||||||
|
git remote add "$domain" "git@$domain:$owner/$repo.git"
|
||||||
git push -u "$domain" "master"
|
git push -u "$domain" "master"
|
||||||
fi
|
fi
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Ожидание 3 секунды." && sleep 3
|
echo "Ожидание 3 секунды." && sleep 3
|
||||||
fi
|
fi
|
||||||
if [[ -z "$1" || "$1" == "testing" ]]; then
|
if [[ -z "$1" || "$1" == "testing" ]]; then
|
||||||
echo "Получение списка коммитов для удалённого репозитория."
|
echo "Получение списка ветвей для удалённого репозитория."
|
||||||
param="stat=false&verification=false&files=false"
|
curl -f -X GET "https://$domain/api/v1/repos/$owner/$repo/branches" \
|
||||||
curl -i -X GET "https://$domain/api/v1/repos/$owner/$repo/commits?$param" \
|
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Accept: application/json"
|
-H "Accept: application/json" 2>/dev/null | grep -v '^null$' &>/dev/null \
|
||||||
|
|| { echo "Не удалось получить список ветвей для репозитория." && exit 1; }
|
||||||
fi
|
fi
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
||||||
|
|
|
@ -1,67 +1,70 @@
|
||||||
#!/bin/false
|
#!/bin/false
|
||||||
if [[ -z "$domain" || -z "$token" || -z "$owner" || -z "$repo" || -z "$description" || -z "$user" ]]; then
|
if [[ -z "$domain" || -z "$token" || -z "$owner" || -z "$repo" || -z "$description" || -z "$user" || -z "$dir" ]]; then
|
||||||
echo "Не указаны обязательные параметры." && exit 1
|
echo "Не указаны обязательные параметры." && exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Создание удалённого репозитория для текущего проекта."
|
|
||||||
fi
|
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
if [[ -z "$1" || "$1" == "delete" ]]; then
|
if [[ -z "$1" || "$1" == "delete" ]]; then
|
||||||
echo "Удаление старого репозитория."
|
echo "Удаление старого репозитория."
|
||||||
curl -i -X DELETE "https://$domain/api/v4/projects/$owner%2F$repo" \
|
curl -f -X DELETE "https://$domain/api/v4/projects/$owner%2F$repo" \
|
||||||
-H "PRIVATE-TOKEN: $token" \
|
-H "PRIVATE-TOKEN: $token" \
|
||||||
-H "Content-Type: application/json" -d "{ \"permanently_remove\": \"true\", \"full_path\": \"$owner/$repo\" }"
|
-H "Content-Type: application/json" -d "{
|
||||||
echo
|
\"permanently_remove\": \"true\", \"full_path\": \"$owner/$repo\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось удалить репозиторий на сервере."; }
|
||||||
fi
|
fi
|
||||||
if [[ -z "$1" || "$1" == "create" ]]; then
|
if [[ -z "$1" || "$1" == "create" ]]; then
|
||||||
echo "Создание нового репозитория пользователя."
|
echo "Создание нового репозитория пользователя."
|
||||||
curl -i -X POST "https://$domain/api/v4/projects" \
|
curl -f -X POST "https://$domain/api/v4/projects" \
|
||||||
-H "PRIVATE-TOKEN: $token" \
|
|
||||||
-H "Content-Type: application/json" -d "{ \"name\": \"$repo\", \"description\": \"$description\" }"
|
|
||||||
echo
|
|
||||||
if [ "$user" != "$owner" ]; then
|
|
||||||
echo "Перемещение репозитория в группу."
|
|
||||||
curl -i -X PUT "https://$domain/api/v4/projects/$user%2F$repo/transfer?namespace=$owner" \
|
|
||||||
-H "PRIVATE-TOKEN: $token"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ -z "$1" || "$1" == "options" ]]; then
|
|
||||||
[ "$wiki" ] && has_wiki="enabled" || has_wiki="disabled"
|
|
||||||
echo "Изменение свойств репозитория / отключение ненужного."
|
|
||||||
curl -i -X PUT "https://$domain/api/v4/projects/$owner%2F$repo" \
|
|
||||||
-H "PRIVATE-TOKEN: $token" \
|
-H "PRIVATE-TOKEN: $token" \
|
||||||
-H "Content-Type: application/json" -d "{
|
-H "Content-Type: application/json" -d "{
|
||||||
\"emails_disabled\": \"true\", \"issues_access_level\": \"disabled\",
|
\"name\": \"$repo\", \"description\": \"$description\" }" &>/dev/null \
|
||||||
\"merge_requests_access_level\": \"disabled\", \"operations_access_level\": \"disabled\",
|
|| { echo "Не удалось создать репозиторий на сервере."; }
|
||||||
\"builds_access_level\": \"disabled\", \"request_access_enabled\": \"false\",
|
fi
|
||||||
\"keep_latest_artifact\": \"false\", \"ci_forward_deployment_enabled\": \"false\",
|
if [[ -z "$1" || "$1" == "transfer" ]]; then
|
||||||
\"ci_separated_caches\": \"false\", \"ci_allow_fork_pipelines_to_run_in_parent_project\": \"false\",
|
if [ "$user" != "$owner" ]; then
|
||||||
\"jobs_enabled\": \"false\", \"public_builds\": \"false\", \"packages_enabled\": \"false\",
|
echo "Перемещение репозитория в группу."
|
||||||
\"merge_requests_enabled\": \"false\", \"issues_enabled\": \"false\", \"lfs_enabled\": \"false\",
|
curl -f -X PUT "https://$domain/api/v4/projects/$user%2F$repo/transfer?namespace=$owner" \
|
||||||
\"snippets_enabled\": \"false\", \"container_registry_enabled\": \"false\",
|
-H "PRIVATE-TOKEN: $token" &>/dev/null \
|
||||||
\"wiki_access_level\": \"$has_wiki\", \"container_registry_access_level\": \"disabled\",
|
|| { echo "Не удалось переместить репозиторий в группу." && exit 1; }
|
||||||
\"security_and_compliance_access_level\": \"disabled\", \"pages_access_level\": \"disabled\",
|
|
||||||
\"analytics_access_level\": \"disabled\", \"forking_access_level\": \"disabled\",
|
|
||||||
\"releases_access_level\": \"disabled\", \"requirements_access_level\": \"disabled\",
|
|
||||||
\"environments_access_level\": \"disabled\", \"feature_flags_access_level\": \"private\",
|
|
||||||
\"infrastructure_access_level\": \"private\", \"monitor_access_level\": \"disabled\",
|
|
||||||
\"snippets_access_level\": \"disabled\", \"auto_devops_enabled\": \"false\",
|
|
||||||
\"shared_runners_enabled\": \"false\", \"group_runners_enabled\": \"false\" }"
|
|
||||||
echo
|
|
||||||
if [ "$wiki" ]; then
|
|
||||||
echo "Добавление страницы wiki в репозиторий."
|
|
||||||
curl -i -X POST "https://$domain/api/v4/projects/$owner%2F$repo/wikis" \
|
|
||||||
-H "PRIVATE-TOKEN: $token" \
|
|
||||||
-H "Content-Type: application/json" -d "{ \"content\": \"$wiki\", \"title\": \"Home\" }"
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
[ -n "$wiki" ] && has_wiki="enabled" || has_wiki="disabled"
|
||||||
|
if [[ -z "$1" || "$1" == "patch" ]]; then
|
||||||
|
echo "Изменение свойств репозитория / отключение ненужного."
|
||||||
|
curl -f -X PUT "https://$domain/api/v4/projects/$owner%2F$repo" \
|
||||||
|
-H "PRIVATE-TOKEN: $token" \
|
||||||
|
-H "Content-Type: application/json" -d "{
|
||||||
|
\"request_access_enabled\": false, \"issues_enabled\": false, \"lfs_enabled\": false, \"packages_enabled\": false,
|
||||||
|
\"builds_access_level\": \"disabled\", \"forking_access_level\": \"disabled\", \"snippets_access_level\": \"disabled\",
|
||||||
|
\"analytics_access_level\": \"disabled\", \"releases_access_level\": \"disabled\", \"show_default_award_emojis\": false,
|
||||||
|
\"merge_requests_access_level\": \"disabled\", \"wiki_access_level\": \"$has_wiki\", \"container_registry_enabled\": false,
|
||||||
|
\"security_and_compliance_access_level\": \"disabled\", \"warn_about_potentially_unwanted_characters\": false }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось изменить свойства репозитория на сервере." && exit 1; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "wiki" ]] && [[ -n "$wiki" ]]; then
|
||||||
|
echo "Добавление страницы wiki в репозиторий."
|
||||||
|
curl -f -X POST "https://$domain/api/v4/projects/$owner%2F$repo/wikis" \
|
||||||
|
-H "PRIVATE-TOKEN: $token" \
|
||||||
|
-H "Content-Type: application/json" -d "{
|
||||||
|
\"content\": \"$wiki\", \"title\": \"Home\" }" &>/dev/null \
|
||||||
|
|| { echo "Не удалось добавить страницу wiki для репозитория." && exit 1; }
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "avatar" ]]; then
|
||||||
echo "Добавление аватарки для репозитория."
|
echo "Добавление аватарки для репозитория."
|
||||||
[ "$user" != "$owner" ] && picture="website" || picture="$repo"
|
[ "$user" != "$owner" ] && picture="website" || picture="$repo"
|
||||||
curl -i -X PUT "https://$domain/api/v4/projects/$owner%2F$repo" \
|
curl -f -X PUT "https://$domain/api/v4/projects/$owner%2F$repo" \
|
||||||
-H "PRIVATE-TOKEN: $token" \
|
-H "PRIVATE-TOKEN: $token" \
|
||||||
-F "avatar=@../dispatcher/avatars/$picture.jpg"
|
-F "avatar=@../dispatcher/avatars/$picture.jpg" &>/dev/null \
|
||||||
echo
|
|| { echo "Не удалось добавить аватарку для репозитория." && exit 1; }
|
||||||
|
fi
|
||||||
|
#LOCAL#
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Ожидание 3 секунды." && sleep 3
|
||||||
|
fi
|
||||||
|
if [[ -z "$1" || "$1" == "testing" ]]; then
|
||||||
|
echo "Получение списка ветвей для удалённого репозитория."
|
||||||
|
curl -f -X GET "https://$domain/api/v4/projects/$owner%2F$repo/repository/branches" \
|
||||||
|
-H "PRIVATE-TOKEN: $token" 2>/dev/null | grep -v '^\[\]$' &>/dev/null \
|
||||||
|
|| { echo "Не удалось получить список ветвей для репозитория." && exit 1; }
|
||||||
fi
|
fi
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
||||||
|
|
|
@ -1,38 +1,31 @@
|
||||||
#!/bin/false
|
#!/bin/false
|
||||||
if [[ -z "$domain" || -z "$owner" || -z "$repo" || -z "$dir" ]]; then
|
if [[ -z "$1" || "$1" == "local" ]]; then
|
||||||
echo "Не указаны обязательные параметры." && exit 1
|
echo "Создание локального репозитория."
|
||||||
|
rm -rf .git # удаление старого репозитория
|
||||||
|
git init -b master
|
||||||
|
git add .git*
|
||||||
|
git commit -m "Инициализация / $dir"
|
||||||
|
find . -type f | grep -E 'CONTRIBUTING|LICENSE' | xargs git add
|
||||||
|
git commit -m "Открытая лицензия РФ"
|
||||||
|
find . -type f -name '*.md' | grep -E 'TREE|WIKI|README|VIEW' | xargs git add
|
||||||
|
git commit -m "Описание проекта"
|
||||||
|
find . -type f | grep -E '(yml|Gemfile.*|gemspec|robots.txt)$' | xargs git add
|
||||||
|
git commit -m "Настройки"
|
||||||
|
git add \*.sh
|
||||||
|
git commit -m "Скрипты bash"
|
||||||
|
find . -type f | grep -E '(min.css|min.js|woff)$' | xargs git add
|
||||||
|
git commit -m "Сторонние материалы"
|
||||||
|
find . -type f | grep -E '(bmp|gif|ico|jpg|png|svg)$' | xargs git add
|
||||||
|
git commit -m "Картинки"
|
||||||
|
git add --all
|
||||||
|
# преобразование шаблонов "glob" в расширенные выражения "regexp"
|
||||||
|
patterns="$(sed 's|\.|\\.|;s|*|.*|' .gitignore | tr '\n' '|')\.git"
|
||||||
|
# выбор всех файлов в каталоге, кроме списка ".gitignore", сортировка и внесение в репозиторий
|
||||||
|
find . -type f -printf '%P\n' | grep -vE "(^|.+/)($patterns)(/.+|$)" | LC_COLLATE=C sort -r \
|
||||||
|
| xargs -I{} -d'\n' bash -c 'echo "Обработка: {}" && git commit "{}" -m "{}" &>/dev/null'
|
||||||
fi
|
fi
|
||||||
echo "Создание локального репозитория, подключение к удалённому и передача данных."
|
if [[ -z "$1" || "$1" == "push" ]]; then
|
||||||
time_ms="$(date '+%s%3N')"
|
echo "Подключение к удалённому репозиторию и передача данных."
|
||||||
# строка исключений для "find" из списка неотслеживаемых файлов ".gitignore"
|
git remote add "$domain" "git@$domain:$owner/$repo.git"
|
||||||
exclusions="-not -path '*/.git/*' $(sed -E "s|^(.*)$|-not -path '*/\1*'|" .gitignore | tr '\n' ' ')"
|
|
||||||
# перевести размеры файла в человеко-читаемую строку, отбросить нули из дробной части и добавить пробел
|
|
||||||
function BKM { numfmt --to=iec --format="%.2f" --suffix="B" "$1" | sed -r 's|,{,1}0{,2}([BKM])| \1|'; }
|
|
||||||
rm -rf .git
|
|
||||||
git init -b master
|
|
||||||
git remote add "$domain" "git@$domain:$owner/$repo.git"
|
|
||||||
git add .git*
|
|
||||||
git commit -m "Инициализация / $dir"
|
|
||||||
if [ "$domain" == "hub.mos.ru" ]; then
|
|
||||||
echo "Второй пуш, потому что лингвист с первого раза не срабатывает."
|
|
||||||
git push -u "$domain" master
|
git push -u "$domain" master
|
||||||
fi
|
fi
|
||||||
find . -type f | grep -E 'CONTRIBUTING|LICENSE' | xargs git add
|
|
||||||
git commit -m "Открытая лицензия РФ"
|
|
||||||
find . -type f -name '*.md' | grep -E 'TREE|WIKI|README|VIEW' | xargs git add
|
|
||||||
git commit -m "Описание проекта"
|
|
||||||
find . -type f | grep -E '(yml|Gemfile.*|gemspec|robots.txt)$' | xargs git add
|
|
||||||
git commit -m "Настройки"
|
|
||||||
git add \*.sh
|
|
||||||
git commit -m "Скрипты bash"
|
|
||||||
find . -type f | grep -E '(min.css|min.js|woff)$' | xargs git add
|
|
||||||
git commit -m "Сторонние материалы"
|
|
||||||
find . -type f | grep -E '(bmp|gif|ico|jpg|png|svg)$' | xargs git add
|
|
||||||
git commit -m "Картинки"
|
|
||||||
while read -r file size; do
|
|
||||||
echo "Обработка: $file"
|
|
||||||
git add "$file"
|
|
||||||
git commit -m "${file#*/} / $(BKM "$size")"
|
|
||||||
done < <(eval "find . -type f $exclusions -printf '%p %s\n'" | LC_COLLATE=C sort -r)
|
|
||||||
git push -u "$domain" master
|
|
||||||
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo "Образец скрипта для тестирования доступности страниц в вёб-интерфейсе на сервере."
|
|
||||||
domain="git.org.ru" && source info_param.sh
|
|
||||||
# две страницы для тестирования
|
|
||||||
file="DIRECTORY_TREE.md"
|
|
||||||
if [ "$domain" == "hub.mos.ru" ]; then
|
|
||||||
folder="blob" && wiki_home="-/wikis/home"
|
|
||||||
else
|
|
||||||
folder="src/branch" && wiki_home="wiki"
|
|
||||||
fi
|
|
||||||
# подготовка массива строк — адрес страницы и название файла через пробел
|
|
||||||
for repo in {1..6}; do
|
|
||||||
#pages+=("'https://$domain/golovin/$repo/$folder/master/$file' '$file'")
|
|
||||||
pages+=("'https://$domain/pomodoro/$repo/$folder/master/$file' '$file'")
|
|
||||||
pages+=("'https://$domain/pomodoro/$repo/$wiki_home' 'Home'")
|
|
||||||
done
|
|
||||||
for repo in {pomodoro,older-tomato-theme,color-tomato-theme}; do
|
|
||||||
pages+=("'https://$domain/golovin/$repo/$folder/master/$file' '$file'")
|
|
||||||
pages+=("'https://$domain/golovin/$repo/$wiki_home' 'Home'")
|
|
||||||
done
|
|
||||||
# тестирование доступности страниц
|
|
||||||
function testing {
|
|
||||||
# название файла должно находиться в заголовке страницы, иначе сервер должен вернуть ошибку
|
|
||||||
case "$(curl "$1" 2>/dev/null | grep -oP '(?<=<title>).*(?=</title>)' | grep -cF "$2")" in
|
|
||||||
0) color="91" ;; # светло-красный цвет для отсутствующих страниц
|
|
||||||
*) color="0" ;; # обычный цвет для всех остальных страниц
|
|
||||||
esac
|
|
||||||
# текст соответствующего цвета и адрес страницы
|
|
||||||
printf "\e[${color}m%s\e[0m %s\n" "Страница:" "$1"
|
|
||||||
}
|
|
||||||
export -f testing
|
|
||||||
time_ms="$(date '+%s%3N')"
|
|
||||||
# запуск параллельного тестирования строк массива и сортировка результатов
|
|
||||||
printf "testing %s\0" "${pages[@]}" | xargs -n1 -0 -P0 bash -c | sort -r -k2
|
|
||||||
echo "Общее время выполнения: $(($(date '+%s%3N') - time_ms)) мс."
|
|
|
@ -1,50 +1,62 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Параллельное выполнение скриптов и публикация репозиториев для каталогов проектов."
|
echo "Публикация исходного кода из каталогов проектов."
|
||||||
# выполнение скриптов внутри каталога
|
# выполнение скриптов внутри каталога
|
||||||
function orchestrate {
|
function orchestrate {
|
||||||
dir="${1#*:}" && red="\e[91m" && green="\e[92m" && norm="\e[0m"
|
dir="${1#*:}" && red="\e[91m" && green="\e[92m" && yellow="\e[93m" && norm="\e[0m"
|
||||||
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
||||||
num="${1%:*}" && pre="\e[${num}A${dir}: " && aft="\e[K\e[${num}B\r"
|
num="${1%:*}" && pre="\e[${num}A${dir} " && aft="\e[K\e[${num}B\r"
|
||||||
cd "$dir" || return
|
cd "${dir// /}" || { printf "${pre}${red}%s${norm} %s${aft}" "[•••••••••]" "Не найден каталог." && return 1; }
|
||||||
pattern="^HTTP/[1,2].{,2}? [4,5]"
|
for ((ms1 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms1 < 600000; pass = 0)); do
|
||||||
printf "${pre}%s${aft}" "Создание репозитория на сервере."
|
# 1 Создание удалённого репозитория и контроль корректности ответов от сервера
|
||||||
for ((ms1 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms1 < 60000; pass = 0)); do
|
for ((ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 20000; remote = 0)); do
|
||||||
# 1 Создание удалённого репозитория и проверка корректности ответов от сервера
|
[ "$pass" != 0 ] && printf "${pre}%s %s${aft}" "[#••••••••]" "Удаление старого репозитория на сервере."
|
||||||
for ((dot = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 10000; dot++, remote = 0)); do
|
./.repo_publish.sh "delete" &>/dev/null
|
||||||
ellipsis="$(seq -s '.' 0 "$dot" | tr -d '0-9')"
|
printf "${pre}%s %s${aft}" "[##•••••••]" "Создание нового репозитория пользователя."
|
||||||
case "$(./.repo_remote.sh 2>/dev/null | tail -n+10 | grep -cE "$pattern")" in
|
./.repo_publish.sh "create" &>/dev/null
|
||||||
0) remote=1 && break ;; *) printf "${pre}%s${aft}" "Ошибка 400-500 при подключении к серверу${ellipsis}" ;;
|
printf "${pre}%s %s${aft}" "[###••••••]" "Перемещение репозитория в группу."
|
||||||
esac
|
./.repo_publish.sh "transfer" &>/dev/null || continue
|
||||||
|
printf "${pre}%s %s${aft}" "[####•••••]" "Изменение свойств репозитория."
|
||||||
|
./.repo_publish.sh "patch" &>/dev/null || continue
|
||||||
|
printf "${pre}%s %s${aft}" "[#####••••]" "Добавление страницы вики."
|
||||||
|
./.repo_publish.sh "wiki" &>/dev/null || continue
|
||||||
|
printf "${pre}%s %s${aft}" "[######•••]" "Добавление аватарки для репозитория."
|
||||||
|
./.repo_publish.sh "avatar" &>/dev/null || continue
|
||||||
|
remote=1 && break # завершение цикла
|
||||||
done
|
done
|
||||||
case "$remote" in
|
case "$remote" in
|
||||||
1) printf "${pre}%s${aft}" "Создание локального репозитория." ;;
|
1) printf "${pre}%s %s${aft}" "[#######••]" "Создание локального репозитория." ;;
|
||||||
*) printf "${pre}%s${aft}" "Создание на сервере более 10 секунд." && continue ;;
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••••]" "Создание на сервере более 20 секунд." && continue ;;
|
||||||
esac
|
esac
|
||||||
# 2 Создание локального репозитория и отправка данных на сервер
|
# 2 Создание локального репозитория и отправка данных на сервер
|
||||||
./.repo_local.sh &>/dev/null
|
./.repo_publish.sh "local" &>/dev/null
|
||||||
# 3 Проверка доступности данных в вёб-интерфейсе на сервере
|
printf "${pre}%s %s${aft}" "[########•]" "Отправка локальных данных на сервер."
|
||||||
printf "${pre}%s${aft}" "Проверка доступности данных."
|
./.repo_publish.sh "push" &>/dev/null
|
||||||
for ((dot = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 10000; dot++, testing = 0)); do
|
# 3 Проверка корректности получения данных на сервере
|
||||||
ellipsis="$(seq -s '.' 0 "$dot" | tr -d '0-9')"
|
printf "${pre}%s %s${aft}" "[#########]" "Проверка получения данных на сервере."
|
||||||
case "$(./.repo_testing.sh 2>/dev/null | grep -cF "[91m")" in
|
for ((lap = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 20000; lap++, testing = 0)); do
|
||||||
0) testing=1 && break ;; *) printf "${pre}%s${aft}" "Ожидание данных на сервере${ellipsis}" ;;
|
track=9 && shift="$(tr -d '-' <<<$((lap / track % 2 * track - lap % track)))"
|
||||||
esac
|
progressbar="$(printf "[%$((track - shift))s" | sed 's| |•|g')$(printf "%${shift}s]" | sed 's| |#|g')"
|
||||||
|
./.repo_publish.sh "testing" &>/dev/null \
|
||||||
|
|| { printf "${pre}${yellow}%s${norm} %s${aft}" "$progressbar" "Ожидание данных на сервере." && continue; }
|
||||||
|
testing=1 && break # завершение цикла
|
||||||
done
|
done
|
||||||
case "$testing" in
|
case "$testing" in
|
||||||
1) pass=1 && break ;;
|
1) pass=1 && break ;;
|
||||||
*) printf "${pre}%s${aft}" "Проверка данных более 10 секунд." ;;
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••••]" "Проверка данных более 20 секунд." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
case "$pass" in
|
case "$pass" in
|
||||||
1) printf "${pre}${green}%s${norm}${aft}" "Выполнено." ;;
|
1) printf "${pre}${green}%s${norm} %s${aft}" "[#########]" "Выполнено." ;;
|
||||||
*) printf "${pre}${red}%s${norm}${aft}" "Ожидание более 60 секунд." ;;
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••••]" "Ожидание более 10 минут." ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
export -f orchestrate
|
export -f orchestrate
|
||||||
cd ../.. # выход из папки и из репозитория
|
cd ../.. # выход из папки и из репозитория
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
# поиск всех каталогов на одном уровне с текущим, кроме папки ".idea", сортировка и добавление порядковых номеров для строк
|
# поиск всех каталогов на одном уровне с текущим, кроме папки ".idea",
|
||||||
readarray -t folders < <(find . -mindepth 1 -maxdepth 1 -type d -not -name ".idea" -printf '%P\n' | sort -r | grep -n '\S')
|
# сортировка списка, выравнивание по левому краю, добавление номеров строк
|
||||||
|
readarray -t folders < <(find . -mindepth 1 -maxdepth 1 -type d -printf '%P;\n' \
|
||||||
|
| grep -v '.idea' | sort -r | column -t -s ';' -o '' | grep -n '\S')
|
||||||
# смещение курсора вниз на соответствующее количество строк
|
# смещение курсора вниз на соответствующее количество строк
|
||||||
printf '%s\n' "${folders[@]#*:}" | sort
|
printf '%s\n' "${folders[@]#*:}" | sort
|
||||||
# вывод строк массива и параллельный запуск функции для каждого каталога
|
# вывод строк массива и параллельный запуск функции для каждого каталога
|
||||||
|
|
|
@ -1,43 +1,49 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Параллельное выполнение скриптов и развёртывание вёб-сайтов на сервере codeberg."
|
echo "Публикация готовых вёб-сайтов на сервере codeberg."
|
||||||
# выполнение скрипта внутри каталога вёб-сайта
|
# выполнение скрипта внутри каталога вёб-сайта
|
||||||
function pages2 {
|
function pages2 {
|
||||||
dir="pomodoro${1}" && red="\e[91m" && green="\e[92m" && norm="\e[0m"
|
dir="pomodoro${1}" && red="\e[91m" && green="\e[92m" && yellow="\e[93m" && norm="\e[0m"
|
||||||
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
||||||
num="$((7 - ${1}))" && pre="\e[${num}A${dir}: " && aft="\e[K\e[${num}B\r"
|
num="$((7 - ${1}))" && pre="\e[${num}A${dir} " && aft="\e[K\e[${num}B\r"
|
||||||
cd "$dir" || return
|
cd "$dir" || { printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Не найден каталог." && return 1; }
|
||||||
pattern="^HTTP/[1,2].{,2}? [4,5]"
|
for ((ms1 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms1 < 600000; pass = 0)); do
|
||||||
printf "${pre}%s${aft}" "Создание репозитория на сервере."
|
# 1 Создание удалённого репозитория и контроль корректности ответов от сервера
|
||||||
for ((ms1 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms1 < 60000; pass = 0)); do
|
for ((ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 20000; remote = 0)); do
|
||||||
# 1 Создание удалённого репозитория и проверка корректности ответов от сервера
|
[ "$pass" != 0 ] && printf "${pre}%s %s${aft}" "[#••••••]" "Удаление старого репозитория на сервере."
|
||||||
for ((dot = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 10000; dot++, remote = 0)); do
|
./.repo_pages2.sh "delete" &>/dev/null
|
||||||
ellipsis="$(seq -s '.' 0 "$dot" | tr -d '0-9')"
|
printf "${pre}%s %s${aft}" "[##•••••]" "Создание нового репозитория в группе."
|
||||||
case "$(./.repo_pages2.sh "remote" 2>/dev/null | tail -n+10 | grep -cE "$pattern")" in
|
./.repo_pages2.sh "create" &>/dev/null || continue
|
||||||
0) remote=1 && break ;; *) printf "${pre}%s${aft}" "Ошибка 400-500 при подключении к серверу${ellipsis}" ;;
|
printf "${pre}%s %s${aft}" "[###••••]" "Изменение свойств репозитория."
|
||||||
esac
|
./.repo_pages2.sh "patch" &>/dev/null || continue
|
||||||
|
printf "${pre}%s %s${aft}" "[####•••]" "Добавление аватарки для репозитория."
|
||||||
|
./.repo_pages2.sh "avatar" &>/dev/null || continue
|
||||||
|
remote=1 && break # завершение цикла
|
||||||
done
|
done
|
||||||
case "$remote" in
|
case "$remote" in
|
||||||
1) printf "${pre}%s${aft}" "Создание локального репозитория." ;;
|
1) printf "${pre}%s %s${aft}" "[#####••]" "Создание локального репозитория." ;;
|
||||||
*) printf "${pre}%s${aft}" "Создание на сервере более 10 секунд." && continue ;;
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Создание на сервере более 20 секунд." && continue ;;
|
||||||
esac
|
esac
|
||||||
# 2 Создание локального репозитория и отправка данных на сервер
|
# 2 Создание локального репозитория и отправка данных на сервер
|
||||||
./.repo_pages2.sh "local" &>/dev/null
|
./.repo_pages2.sh "local" &>/dev/null
|
||||||
|
printf "${pre}%s %s${aft}" "[######•]" "Отправка локальных данных на сервер."
|
||||||
|
./.repo_pages2.sh "push" &>/dev/null
|
||||||
# 3 Проверка корректности получения данных на сервере
|
# 3 Проверка корректности получения данных на сервере
|
||||||
printf "${pre}%s${aft}" "Проверка доступности данных."
|
printf "${pre}%s %s${aft}" "[#######]" "Проверка получения данных на сервере."
|
||||||
for ((dot = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 10000; dot++, testing = 0)); do
|
for ((lap = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 20000; lap++, testing = 0)); do
|
||||||
ellipsis="$(seq -s '.' 0 "$dot" | tr -d '0-9')"
|
track=7 && shift="$(tr -d '-' <<<$((lap / track % 2 * track - lap % track)))"
|
||||||
case "$(./.repo_pages2.sh "testing" 2>/dev/null | grep -cE "$pattern")" in
|
progressbar="$(printf "[%$((track - shift))s" | sed 's| |•|g')$(printf "%${shift}s]" | sed 's| |#|g')"
|
||||||
0) testing=1 && break ;; *) printf "${pre}%s${aft}" "Ожидание данных на сервере${ellipsis}" ;;
|
./.repo_pages2.sh "testing" &>/dev/null \
|
||||||
esac
|
|| { printf "${pre}${yellow}%s${norm} %s${aft}" "$progressbar" "Ожидание данных на сервере." && continue; }
|
||||||
|
testing=1 && break # завершение цикла
|
||||||
done
|
done
|
||||||
case "$testing" in
|
case "$testing" in
|
||||||
1) pass=1 && break ;;
|
1) pass=1 && break ;;
|
||||||
*) printf "${pre}%s${aft}" "Проверка данных более 10 секунд." ;;
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Проверка данных более 20 секунд." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
case "$pass" in
|
case "$pass" in
|
||||||
1) printf "${pre}${green}%s${norm}${aft}" "Выполнено." ;;
|
1) printf "${pre}${green}%s${norm} %s${aft}" "[#######]" "Выполнено." ;;
|
||||||
*) printf "${pre}${red}%s${norm}${aft}" "Ожидание более 60 секунд." ;;
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Ожидание более 10 минут." ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
export -f pages2
|
export -f pages2
|
||||||
|
@ -45,7 +51,7 @@ cd ../.. # выход из папки и из репозитория
|
||||||
time_ms="$(date '+%s%3N')"
|
time_ms="$(date '+%s%3N')"
|
||||||
# смещение курсора вниз на соответствующее количество строк
|
# смещение курсора вниз на соответствующее количество строк
|
||||||
printf 'pomodoro%s\n' {1..6}
|
printf 'pomodoro%s\n' {1..6}
|
||||||
# обход всех вёб-сайтов и параллельный запуск функции для каждого
|
# вывод номеров вёб-сайтов и параллельный запуск функции для каждого
|
||||||
printf 'pages2 "%s"\0' {1..6} | xargs -n1 -0 -P0 bash -c
|
printf 'pages2 "%s"\0' {1..6} | xargs -n1 -0 -P0 bash -c
|
||||||
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
||||||
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
||||||
|
|
61
bash_scripts/suite_profile2.sh
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Публикация оглавлений вёб-сайтов на сервере codeberg."
|
||||||
|
# выполнение скрипта внутри каталога вёб-сайта
|
||||||
|
function profile2 {
|
||||||
|
dir="pomodoro" && red="\e[91m" && green="\e[92m" && yellow="\e[93m" && norm="\e[0m"
|
||||||
|
# соответствующая строка для вывода сообщений по ходу выполнения функции
|
||||||
|
case "$1" in "") dir="$dir " && num="6" ;; *) dir="$dir${1}" && num="$((6 - ${1}))" ;; esac
|
||||||
|
pre="\e[${num}A${dir} " && aft="\e[K\e[${num}B\r"
|
||||||
|
cd "${dir// /}" || { printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Не найден каталог." && return 1; }
|
||||||
|
printf "${pre}%s %s${aft}" "[•••••••]" "Пересоздание файлов в каталоге."
|
||||||
|
./.repo_profile2.sh "prepare" &>/dev/null
|
||||||
|
for ((ms1 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms1 < 600000; pass = 0)); do
|
||||||
|
# 1 Создание удалённого репозитория и контроль корректности ответов от сервера
|
||||||
|
for ((ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 20000; remote = 0)); do
|
||||||
|
[ "$pass" != 0 ] && printf "${pre}%s %s${aft}" "[#••••••]" "Удаление старого репозитория на сервере."
|
||||||
|
./.repo_profile2.sh "delete" &>/dev/null
|
||||||
|
printf "${pre}%s %s${aft}" "[##•••••]" "Создание нового репозитория в группе."
|
||||||
|
./.repo_profile2.sh "create" &>/dev/null || continue
|
||||||
|
printf "${pre}%s %s${aft}" "[###••••]" "Изменение свойств репозитория."
|
||||||
|
./.repo_profile2.sh "patch" &>/dev/null || continue
|
||||||
|
printf "${pre}%s %s${aft}" "[####•••]" "Добавление аватарки для репозитория."
|
||||||
|
./.repo_profile2.sh "avatar" &>/dev/null || continue
|
||||||
|
remote=1 && break # завершение цикла
|
||||||
|
done
|
||||||
|
case "$remote" in
|
||||||
|
1) printf "${pre}%s %s${aft}" "[#####••]" "Создание локального репозитория." ;;
|
||||||
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Создание на сервере более 20 секунд." && continue ;;
|
||||||
|
esac
|
||||||
|
# 2 Создание локального репозитория и отправка данных на сервер
|
||||||
|
./.repo_profile2.sh "local" &>/dev/null
|
||||||
|
printf "${pre}%s %s${aft}" "[######•]" "Отправка локальных данных на сервер."
|
||||||
|
./.repo_profile2.sh "push" &>/dev/null
|
||||||
|
# 3 Проверка корректности получения данных на сервере
|
||||||
|
printf "${pre}%s %s${aft}" "[#######]" "Проверка получения данных на сервере."
|
||||||
|
for ((lap = 1, ms2 = "$(date '+%s%3N')"; $(date '+%s%3N') - ms2 < 20000; lap++, testing = 0)); do
|
||||||
|
track=7 && shift="$(tr -d '-' <<<$((lap / track % 2 * track - lap % track)))"
|
||||||
|
progressbar="$(printf "[%$((track - shift))s" | sed 's| |•|g')$(printf "%${shift}s]" | sed 's| |#|g')"
|
||||||
|
./.repo_profile2.sh "testing" &>/dev/null \
|
||||||
|
|| { printf "${pre}${yellow}%s${norm} %s${aft}" "$progressbar" "Ожидание данных на сервере." && continue; }
|
||||||
|
testing=1 && break # завершение цикла
|
||||||
|
done
|
||||||
|
case "$testing" in
|
||||||
|
1) pass=1 && break ;;
|
||||||
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Проверка данных более 20 секунд." ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
case "$pass" in
|
||||||
|
1) printf "${pre}${green}%s${norm} %s${aft}" "[#######]" "Выполнено." ;;
|
||||||
|
*) printf "${pre}${red}%s${norm} %s${aft}" "[•••••••]" "Ожидание более 10 минут." ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
export -f profile2
|
||||||
|
cd ../.. # выход из папки и из репозитория
|
||||||
|
time_ms="$(date '+%s%3N')"
|
||||||
|
# смещение курсора вниз на соответствующее количество строк
|
||||||
|
printf 'pomodoro%s\n' "" {1..5}
|
||||||
|
# вывод номеров вёб-сайтов и параллельный запуск функции для каждого
|
||||||
|
printf 'profile2 "%s"\0' "" {1..5} | xargs -n1 -0 -P0 bash -c
|
||||||
|
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
||||||
|
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
||||||
|
ms="$((tms % 1000))" && printf 'Общее время выполнения: %02d:%02d.%03d мс.\n' "$min" "$sec" "$ms"
|
27
bash_scripts/suite_testing.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Тестирование доступности страниц в вёб-интерфейсе на сервере."
|
||||||
|
domain="git.org.ru" && source info_param.sh
|
||||||
|
file="DIRECTORY_TREE.md" # две тестовые страницы для каждого проекта
|
||||||
|
[ "$domain" == "hub.mos.ru" ] && folder="blob" || folder="src/branch"
|
||||||
|
[ "$domain" == "hub.mos.ru" ] && wiki_home="-/wikis/home" || wiki_home="wiki"
|
||||||
|
# подготовка массива строк — адрес страницы и название файла через пробел
|
||||||
|
for repo in {1..6} {dispatcher,pomodoro,older-tomato-theme,color-tomato-theme}; do
|
||||||
|
case "$repo" in [1-6]) owner="pomodoro" ;; *) owner="golovin" ;; esac
|
||||||
|
pages+=("'https://$domain/$owner/$repo/$folder/master/$file' '$file'")
|
||||||
|
pages+=("'https://$domain/$owner/$repo/$wiki_home' 'Home'")
|
||||||
|
done
|
||||||
|
# тестирование доступности страниц
|
||||||
|
function testing {
|
||||||
|
# название файла должно быть в заголовке страницы, иначе конвейер должен вернуть ошибку,
|
||||||
|
# обычный цвет для существующих страниц, светло-красный цвет для несуществующих страниц
|
||||||
|
curl -f "$1" 2>/dev/null | grep -q "<title>.*$2.*</title>" && color="0" || color="91"
|
||||||
|
# текст соответствующего цвета и адрес страницы
|
||||||
|
printf "\e[${color}m%s\e[0m %s\n" "Страница:" "$1"
|
||||||
|
}
|
||||||
|
export -f testing
|
||||||
|
time_ms="$(date '+%s%3N')"
|
||||||
|
# вывод строк массива, параллельный запуск функции и сортировка результатов
|
||||||
|
printf "testing %s\0" "${pages[@]}" | xargs -n1 -0 -P0 bash -c | sort -k2
|
||||||
|
# замер продолжительности выполнения в миллисекундах, пересчёт в минуты, секунды и миллисекунды
|
||||||
|
tms="$(($(date '+%s%3N') - time_ms))" && min="$((tms / 1000 / 60))" && sec="$((tms / 1000 % 60))"
|
||||||
|
ms="$((tms % 1000))" && printf 'Общее время выполнения: %02d:%02d.%03d мс.\n' "$min" "$sec" "$ms"
|
|
@ -1,17 +1,22 @@
|
||||||
|  |
|
| Вывод в консоль |
|
||||||
|:------------------------------------------------|
|
|:-------------------------------------------------------------|
|
||||||
| archive_cleanup.png |
|
| [archive_backup.sh](../bash_scripts/archive_backup.sh) |
|
||||||
|  |
|
|  |
|
||||||
| archive_packaging.gif |
|
| [archive_cleanup.sh](../bash_scripts/archive_cleanup.sh) |
|
||||||
|  |
|
|  |
|
||||||
| info_references.png |
|
| [archive_packaging.sh](../bash_scripts/archive_packaging.sh) |
|
||||||
|  |
|
|  |
|
||||||
| info_tree_license.png |
|
| [info_references.sh](../bash_scripts/info_references.sh) |
|
||||||
|  |
|
|  |
|
||||||
| repo_compose.png |
|
| [info_tree_license.sh](../bash_scripts/info_tree_license.sh) |
|
||||||
|  |
|
|  |
|
||||||
| repo_testing.smpl.png |
|
| [repo_compose.sh](../bash_scripts/repo_compose.sh) |
|
||||||
|  |
|
|  |
|
||||||
| suite_orchestrate.gif |
|
| [suite_orchestrate.sh](../bash_scripts/suite_orchestrate.sh) |
|
||||||
|  |
|
|  |
|
||||||
| suite_pages2.gif |
|
| [suite_pages2.sh](../bash_scripts/suite_pages2.sh) |
|
||||||
|
|  |
|
||||||
|
| [suite_profile2.sh](../bash_scripts/suite_profile2.sh) |
|
||||||
|
|  |
|
||||||
|
| [suite_testing.sh](../bash_scripts/suite_testing.sh) |
|
||||||
|
|  |
|
||||||
|
|
BIN
print_screen/archive_backup.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 113 KiB |
Before Width: | Height: | Size: 488 KiB After Width: | Height: | Size: 293 KiB |
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 110 KiB |
BIN
print_screen/suite_profile2.gif
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
print_screen/suite_testing.png
Normal file
After Width: | Height: | Size: 3.9 KiB |