2023-08-31
This commit is contained in:
parent
0cd5672195
commit
9be39efc35
15 changed files with 365 additions and 250 deletions
32
README.en.md
32
README.en.md
|
@ -20,14 +20,25 @@ intentionally and, secondly, not all of them — are mistakes.
|
|||
1. [Three-dimensional graphics in JavaScript](https://pomodoro1.mircloud.ru/en/).
|
||||
2. [Cartesian product, combinatorics](https://pomodoro2.mircloud.ru/en/).
|
||||
3. [Matrix multiplication and rotations](https://pomodoro3.mircloud.ru/en/).
|
||||
4. [Poetry, humor](https://pomodoro4.mircloud.ru/en/).
|
||||
4. [Psychology, poetry and humor without translation](https://pomodoro4.mircloud.ru/).
|
||||
5. [Drawing pictures with text](https://pomodoro5.mircloud.ru/en/).
|
||||
|
||||
### Design
|
||||
|
||||
Two design themes for Jekyll in the Liquid template language: «Color tomato» was written earlier using
|
||||
AngularJS and Material, this was the design of the previous version of my blog, then an «Older tomato»
|
||||
— lightweight single-color variant was written using only HTML and CSS, the appearance resembles the
|
||||
default design theme on GitHub Pages. Both tomatoes supplement each other and are similar to each other,
|
||||
so they can be used together on the same site.
|
||||
|
||||
- [Color tomato](https://hub.mos.ru/golovin/color-tomato-theme/blob/master/README.en.md) — color selection during the build.
|
||||
- [Older tomato](https://hub.mos.ru/golovin/older-tomato-theme/blob/master/README.en.md) — lightweight decoration theme.
|
||||
|
||||
### Process
|
||||
|
||||
The creative process continues continuously, especially when there is no work. Fully mature
|
||||
thoughts become separate projects, and immature ones go as parts of this project. It is
|
||||
difficult for some thoughts to mature, so they remain incomplete.
|
||||
The creative process began in 2016, but even earlier I wrote some things for myself. Activation of
|
||||
creativity occurs, when there is no work. Mature thoughts become separate projects, and immature ones
|
||||
go as parts of this project. Over time, there are more parts, so automation comes in handy here too.
|
||||
|
||||
- [Process management](bash_scripts/README.en.md) — scripts Bash.
|
||||
- [Incomplete publications](draft/README.md) — draft without translation.
|
||||
|
@ -44,17 +55,6 @@ Now the site is generated by Jekyll, the template language is Liquid, syntax hig
|
|||
time, and the content of the pages is in Markdown format. Process management is performed by Bash scripts.
|
||||
The thought does not leave me, that I made a *senseless swap* — in general, nothing has changed.
|
||||
|
||||
### Design
|
||||
|
||||
Two design themes for Jekyll in the Liquid template language: «Color tomato» was written earlier using
|
||||
AngularJS and Material, this was the design of the previous version of my blog, then an «Older tomato»
|
||||
— lightweight single-color variant was written using only HTML and CSS, the appearance resembles the
|
||||
default design theme on GitHub Pages. Both tomatoes supplement each other and are similar to each other,
|
||||
so they can be used together on the same site.
|
||||
|
||||
- [Color tomato](https://hub.mos.ru/golovin.gg/color-tomato-theme/blob/master/README.en.md) — color selection during the build.
|
||||
- [Older tomato](https://hub.mos.ru/golovin.gg/older-tomato-theme/blob/master/README.en.md) — lightweight decoration theme.
|
||||
|
||||
### License
|
||||
|
||||
Previously, I attached the MIT license to my projects on the Internet, but when the open license
|
||||
|
@ -72,4 +72,4 @@ provided free of charge, but without any guarantees, and the author of the progr
|
|||
|
||||
---
|
||||
|
||||
© Golovin G.G., Code with comments, translation from Russian, 2021-2023
|
||||
© Golovin G.G., Code with comments, translation from Russian, 2021-2023
|
||||
|
|
40
README.md
40
README.md
|
@ -16,17 +16,28 @@
|
|||
полезно для профессионального роста. Потому что, во-первых, не все ошибки допущены намеренно и, во-вторых, не все
|
||||
они — есть ошибки.
|
||||
|
||||
1. [Трёхмерная графика на JavaScript](https://pomodoro1.mircloud.ru/).
|
||||
2. [Декартово произведение, комбинаторика](https://pomodoro2.mircloud.ru/).
|
||||
3. [Умножение матриц и повороты](https://pomodoro3.mircloud.ru/).
|
||||
4. [Поэзия, юмор](https://pomodoro4.mircloud.ru/).
|
||||
5. [Рисуем картинки текстом](https://pomodoro5.mircloud.ru/).
|
||||
1. [Трёхмерная графика на JavaScript](https://pomodoro1.mircloud.ru).
|
||||
2. [Декартово произведение, комбинаторика](https://pomodoro2.mircloud.ru).
|
||||
3. [Умножение матриц и повороты](https://pomodoro3.mircloud.ru).
|
||||
4. [Психология, поэзия и юмор](https://pomodoro4.mircloud.ru).
|
||||
5. [Рисуем картинки текстом](https://pomodoro5.mircloud.ru).
|
||||
|
||||
### Оформление
|
||||
|
||||
Две темы оформления для Jekyll на языке шаблонов Liquid: «Цветной помидор» был написан раньше с
|
||||
использованием AngularJS и Material, таким было оформление предыдущей версии моего блога, затем
|
||||
был написан «Старый помидор» — облегчённый одноцветный вариант с использованием только HTML и CSS,
|
||||
внешний вид напоминает тему оформления по умолчанию на GitHub Pages. Оба помидора дополняют друг
|
||||
друга и похожи друг на друга, поэтому их можно использовать вместе на одном сайте.
|
||||
|
||||
- [Цветной помидор](https://hub.mos.ru/golovin/color-tomato-theme/blob/master/README.md) — выбор цвета во время сборки.
|
||||
- [Старый помидор](https://hub.mos.ru/golovin/older-tomato-theme/blob/master/README.md) — легковесная тема оформления.
|
||||
|
||||
### Процесс
|
||||
|
||||
Творческий процесс продолжается непрерывно, особенно, когда работы нет. Полностью созревшие мысли
|
||||
становятся отдельными проектами, а несозревшие идут как части этого проекта. Некоторым мыслям
|
||||
сложно созреть, поэтому они остаются незавершёнными.
|
||||
Творческий процесс начался в 2016 году, но и раньше какие-то вещи я писал для себя. Активизация творчества
|
||||
наступает, когда работы нет. Созревшие мысли становятся отдельными проектами, а несозревшие идут как части
|
||||
этого проекта. Со временем частей становится больше, поэтому автоматизация пригождается и здесь тоже.
|
||||
|
||||
- [Управление процессами](bash_scripts/README.md) — скрипты Bash.
|
||||
- [Незавершённые публикации](draft/README.md) — черновик.
|
||||
|
@ -42,17 +53,6 @@
|
|||
сборки, а содержание страниц в формате Markdown. Управление процессами выполняют скрипты Bash.
|
||||
Меня не покидает мысль, что я *поменял шило на мыло* — в целом ничего не изменилось.
|
||||
|
||||
### Оформление
|
||||
|
||||
Две темы оформления для Jekyll на языке шаблонов Liquid: «Цветной помидор» был написан раньше с
|
||||
использованием AngularJS и Material, таким было оформление предыдущей версии моего блога, затем
|
||||
был написан «Старый помидор» — облегчённый одноцветный вариант с использованием только HTML и CSS,
|
||||
внешний вид напоминает тему оформления по умолчанию на GitHub Pages. Оба помидора дополняют друг
|
||||
друга и похожи друг на друга, поэтому их можно использовать вместе на одном сайте.
|
||||
|
||||
- [Цветной помидор](https://hub.mos.ru/golovin.gg/color-tomato-theme/blob/master/README.md) — выбор цвета во время сборки.
|
||||
- [Старый помидор](https://hub.mos.ru/golovin.gg/older-tomato-theme/blob/master/README.md) — легковесная тема оформления.
|
||||
|
||||
### Лицензия
|
||||
|
||||
Раньше к своим проектам в интернете прикладывал лицензию MIT, но когда появилась открытая лицензия РФ
|
||||
|
@ -68,4 +68,4 @@
|
|||
|
||||
---
|
||||
|
||||
© Головин Г.Г., Код с комментариями, 2021-2023
|
||||
© Головин Г.Г., Код с комментариями, 2021-2023
|
||||
|
|
7
WIKI.md
7
WIKI.md
|
@ -22,7 +22,8 @@
|
|||
- [Поворот матрицы на 180 градусов](https://pomodoro3.mircloud.ru/ru/2021/12/16/matrix-rotation-180-degrees.html) — 16.12.2021.
|
||||
- [Поворот матрицы на 90 градусов](https://pomodoro3.mircloud.ru/ru/2021/12/12/matrix-rotation-90-degrees.html) — 12.12.2021.
|
||||
- [Оптимизация умножения матриц](https://pomodoro3.mircloud.ru/ru/2021/12/09/optimizing-matrix-multiplication.html) — 09.12.2021.
|
||||
4. Поэзия, юмор.
|
||||
4. Психология, поэзия и юмор.
|
||||
- Алгоритм поиска работы мечты — 31.12.2023.
|
||||
- [Поэзия начала 20 века](https://pomodoro4.mircloud.ru/ru/2022/01/07/poetry-early-20th-century.html) — 07.01.2022.
|
||||
- [История про лес, название утеряно](https://pomodoro4.mircloud.ru/ru/2022/01/05/forest-story-title-lost.html) — 05.01.2022.
|
||||
5. Рисуем картинки текстом.
|
||||
|
@ -58,9 +59,7 @@
|
|||
- [Matrix rotation 180 degrees](https://pomodoro3.mircloud.ru/en/2021/12/17/matrix-rotation-180-degrees.html) — 17.12.2021.
|
||||
- [Matrix rotation 90 degrees](https://pomodoro3.mircloud.ru/en/2021/12/13/matrix-rotation-90-degrees.html) — 13.12.2021.
|
||||
- [Optimizing matrix multiplication](https://pomodoro3.mircloud.ru/en/2021/12/10/optimizing-matrix-multiplication.html) — 10.12.2021.
|
||||
4. Poetry, humor.
|
||||
- [Poetry early 20th century](https://pomodoro4.mircloud.ru/en/2022/01/08/poetry-early-20th-century.html) — 08.01.2022.
|
||||
- [Forest story, title lost](https://pomodoro4.mircloud.ru/en/2022/01/06/forest-story-title-lost.html) — 06.01.2022.
|
||||
4. Psychology, poetry and humor without translation.
|
||||
5. Drawing pictures with text.
|
||||
- [Directory tree with links](https://pomodoro5.mircloud.ru/en/2023/08/04/directory-tree.html) — 04.08.2023.
|
||||
- [Password generator](https://pomodoro5.mircloud.ru/en/2023/06/20/password-generator.html) — 20.06.2023.
|
||||
|
|
|
@ -2,35 +2,40 @@
|
|||
|
||||
Creating an archive, switching the domain, composing scripts and creating repositories for publishing.
|
||||
|
||||
| Bash scripts | Actions performed |
|
||||
|:---------------------------------------------|:--------------------------------------------------------------------------------------------|
|
||||
| [**archive_backup.sh**](archive_backup.sh) | Creating a common archive for the directories of projects on the current date. |
|
||||
| [archive_packages.sh](archive_packages.sh) | Building websites, creating and copying archives for deployment. |
|
||||
| [**info_param.sh**](info_param.sh) | Parameter for other scripts. Switching the domain of the remote repository. |
|
||||
| [info_references.sh](info_references.sh) | Updating the domain of a remote repository in cross-references in descriptions. |
|
||||
| [info_tree_license.sh](info_tree_license.sh) | Building a directory tree for each project and copying license files. |
|
||||
| [**repo_compose.sh**](repo_compose.sh) | Composing scripts with parameters and copying them to the directories of projects. |
|
||||
| [repo_gitea.tmpl.sh](repo_gitea.tmpl.sh) | Script template without parameters to create a remote repository gitea. |
|
||||
| [repo_gitlab.tmpl.sh](repo_gitlab.tmpl.sh) | Script template without parameters to create a remote repository gitlab. |
|
||||
| [repo_local.tmpl.sh](repo_local.tmpl.sh) | Script template without parameters to create a local repository. |
|
||||
| [**repo_update.sh**](repo_update.sh) | Parallel execution of scripts and creation of repositories for the directories of projects. |
|
||||
| № | Bash scripts | Actions performed |
|
||||
|---|:---------------------------------------------|:--------------------------------------------------------------------------------------------|
|
||||
| 1 | [**archive_backup.sh**](archive_backup.sh) | Creating a common archive for the directories of projects on the current date. |
|
||||
| | [archive_packages.sh](archive_packages.sh) | Building websites, creating and copying archives for deployment. |
|
||||
| 2 | [**info_param.sh**](info_param.sh) | Parameter for other scripts. Switching the domain of the remote repository. |
|
||||
| | [info_references.sh](info_references.sh) | Updating the domain of a remote repository in cross-references in descriptions. |
|
||||
| | [info_tree_license.sh](info_tree_license.sh) | Building a directory tree for each project and copying license files. |
|
||||
| 3 | [**repo_compose.sh**](repo_compose.sh) | Composing scripts with parameters and copying them to the directories of projects. |
|
||||
| | [repo_gitea.tmpl.sh](repo_gitea.tmpl.sh) | Script template without parameters to create a remote repository gitea. |
|
||||
| | [repo_gitlab.tmpl.sh](repo_gitlab.tmpl.sh) | Script template without parameters to create a remote repository gitlab. |
|
||||
| | [repo_local.tmpl.sh](repo_local.tmpl.sh) | Script template without parameters to create a local repository. |
|
||||
| 4 | [**repo_update.sh**](repo_update.sh) | Parallel execution of scripts and creation of repositories for the directories of projects. |
|
||||
|
||||
## Directories of projects
|
||||
|
||||
Single-level directory structure — local projects are located on the same level.
|
||||
On the server, repositories with websites are moved to a separate group, and the
|
||||
rest of the repositories remain with the user. The directory structure for
|
||||
[git.org.ru](https://git.org.ru/golovin.gg) and
|
||||
[hub.mos.ru](https://hub.mos.ru/golovin.gg).
|
||||
Local project directories are located on the same level. On the server,
|
||||
repositories with websites are moved to a separate group, and the rest
|
||||
of the repositories remain with the user. The directory structure for
|
||||
[gitea.com](https://gitea.com/golovin) and
|
||||
[hub.mos.ru](https://hub.mos.ru/golovin).
|
||||
|
||||
<pre>
|
||||
<a href='https://hub.mos.ru/golovin.gg'>.</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin.gg/color-tomato-theme'>color-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin.gg/older-tomato-theme'>older-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin.gg/pomodoro'>pomodoro</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/1'>pomodoro1</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/2'>pomodoro2</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/3'>pomodoro3</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/4'>pomodoro4</a>
|
||||
└─ <a href='https://hub.mos.ru/pomodoro/5'>pomodoro5</a>
|
||||
<a href='https://hub.mos.ru/golovin/blob/master/DIRECTORY_TREE.md'>.</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin/color-tomato-theme/blob/master/DIRECTORY_TREE.md'>color-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin/older-tomato-theme/blob/master/DIRECTORY_TREE.md'>older-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin/pomodoro/blob/master/DIRECTORY_TREE.md'>pomodoro</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/1/blob/master/DIRECTORY_TREE.md'>pomodoro1</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/2/blob/master/DIRECTORY_TREE.md'>pomodoro2</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/3/blob/master/DIRECTORY_TREE.md'>pomodoro3</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/4/blob/master/DIRECTORY_TREE.md'>pomodoro4</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/5/blob/master/DIRECTORY_TREE.md'>pomodoro5</a>
|
||||
└─ <a href='https://hub.mos.ru/pomodoro/6/blob/master/DIRECTORY_TREE.md'>pomodoro6</a>
|
||||
</pre>
|
||||
|
||||
---
|
||||
|
||||
© Golovin G.G., Code with comments, translation from Russian, 2021-2023
|
||||
|
|
|
@ -2,35 +2,40 @@
|
|||
|
||||
Создание архива, переключение домена, составление скриптов и создание репозиториев для публикации.
|
||||
|
||||
| Скрипты Bash | Выполняемые действия |
|
||||
|:---------------------------------------------|:---------------------------------------------------------------------------------|
|
||||
| [**archive_backup.sh**](archive_backup.sh) | Создание общего архива для каталогов проектов на текущую дату. |
|
||||
| [archive_packages.sh](archive_packages.sh) | Сборка вёб-сайтов, создание и копирование архивов для развёртывания. |
|
||||
| [**info_param.sh**](info_param.sh) | Параметр для других скриптов. Переключение домена удалённого репозитория. |
|
||||
| [info_references.sh](info_references.sh) | Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях. |
|
||||
| [info_tree_license.sh](info_tree_license.sh) | Построение дерева каталогов для каждого проекта и копирование файлов лицензии. |
|
||||
| [**repo_compose.sh**](repo_compose.sh) | Составление скриптов с параметрами и копирование их в каталоги проектов. |
|
||||
| [repo_gitea.tmpl.sh](repo_gitea.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория gitea. |
|
||||
| [repo_gitlab.tmpl.sh](repo_gitlab.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория gitlab. |
|
||||
| [repo_local.tmpl.sh](repo_local.tmpl.sh) | Шаблон скрипта без параметров для создания локального репозитория. |
|
||||
| [**repo_update.sh**](repo_update.sh) | Параллельное выполнение скриптов и создание репозиториев для каталогов проектов. |
|
||||
| № | Скрипты Bash | Выполняемые действия |
|
||||
|---|:---------------------------------------------|:---------------------------------------------------------------------------------|
|
||||
| 1 | [**archive_backup.sh**](archive_backup.sh) | Создание общего архива для каталогов проектов на текущую дату. |
|
||||
| | [archive_packages.sh](archive_packages.sh) | Сборка вёб-сайтов, создание и копирование архивов для развёртывания. |
|
||||
| 2 | [**info_param.sh**](info_param.sh) | Параметр для других скриптов. Переключение домена удалённого репозитория. |
|
||||
| | [info_references.sh](info_references.sh) | Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях. |
|
||||
| | [info_tree_license.sh](info_tree_license.sh) | Построение дерева каталогов для каждого проекта и копирование файлов лицензии. |
|
||||
| 3 | [**repo_compose.sh**](repo_compose.sh) | Составление скриптов с параметрами и копирование их в каталоги проектов. |
|
||||
| | [repo_gitea.tmpl.sh](repo_gitea.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория gitea. |
|
||||
| | [repo_gitlab.tmpl.sh](repo_gitlab.tmpl.sh) | Шаблон скрипта без параметров для создания удалённого репозитория gitlab. |
|
||||
| | [repo_local.tmpl.sh](repo_local.tmpl.sh) | Шаблон скрипта без параметров для создания локального репозитория. |
|
||||
| 4 | [**repo_update.sh**](repo_update.sh) | Параллельное выполнение скриптов и создание репозиториев для каталогов проектов. |
|
||||
|
||||
## Каталоги проектов
|
||||
|
||||
Одноуровневая структура каталогов — локальные проекты расположены на одном
|
||||
уровне. На сервере репозитории с вёб-сайтами переходят в отдельную группу,
|
||||
а остальные репозитории остаются у пользователя. Структура каталогов для
|
||||
[git.org.ru](https://git.org.ru/golovin.gg) и
|
||||
[hub.mos.ru](https://hub.mos.ru/golovin.gg).
|
||||
Локальные каталоги проектов расположены на одном уровне. На сервере
|
||||
репозитории с вёб-сайтами переходят в отдельную группу, а остальные
|
||||
репозитории остаются у пользователя. Структура каталогов для
|
||||
[gitea.com](https://gitea.com/golovin) и
|
||||
[hub.mos.ru](https://hub.mos.ru/golovin).
|
||||
|
||||
<pre>
|
||||
<a href='https://hub.mos.ru/golovin.gg'>.</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin.gg/color-tomato-theme'>color-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin.gg/older-tomato-theme'>older-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin.gg/pomodoro'>pomodoro</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/1'>pomodoro1</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/2'>pomodoro2</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/3'>pomodoro3</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/4'>pomodoro4</a>
|
||||
└─ <a href='https://hub.mos.ru/pomodoro/5'>pomodoro5</a>
|
||||
<a href='https://hub.mos.ru/golovin/blob/master/DIRECTORY_TREE.md'>.</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin/color-tomato-theme/blob/master/DIRECTORY_TREE.md'>color-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin/older-tomato-theme/blob/master/DIRECTORY_TREE.md'>older-tomato-theme</a>
|
||||
├─ <a href='https://hub.mos.ru/golovin/pomodoro/blob/master/DIRECTORY_TREE.md'>pomodoro</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/1/blob/master/DIRECTORY_TREE.md'>pomodoro1</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/2/blob/master/DIRECTORY_TREE.md'>pomodoro2</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/3/blob/master/DIRECTORY_TREE.md'>pomodoro3</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/4/blob/master/DIRECTORY_TREE.md'>pomodoro4</a>
|
||||
├─ <a href='https://hub.mos.ru/pomodoro/5/blob/master/DIRECTORY_TREE.md'>pomodoro5</a>
|
||||
└─ <a href='https://hub.mos.ru/pomodoro/6/blob/master/DIRECTORY_TREE.md'>pomodoro6</a>
|
||||
</pre>
|
||||
|
||||
---
|
||||
|
||||
© Головин Г.Г., Код с комментариями, 2021-2023
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
echo "Сборка вёб-сайтов, создание и копирование архивов для развёртывания."
|
||||
cd ..
|
||||
milliseconds=$(date '+%s%3N')
|
||||
for ((i = 1; i <= 5; i++)); do
|
||||
currentTimeMillis=$(date '+%s%3N')
|
||||
for ((i = 1; i <= 6; i++)); do
|
||||
echo "Обработка: pomodoro$i"
|
||||
cd "../pomodoro$i" || continue
|
||||
./build.sh
|
||||
./package.sh
|
||||
cp -v "pomodoro$i.zip" ..
|
||||
done
|
||||
echo "Общее время выполнения: $(("$(date '+%s%3N')" - "$milliseconds")) мс."
|
||||
echo "Общее время выполнения: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#remote="git.org.ru"
|
||||
#remote="gitea.com"
|
||||
remote="hub.mos.ru"
|
||||
echo "Переключение домена удалённого репозитория: $remote"
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
#!/bin/bash
|
||||
echo "Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях."
|
||||
remote="git.org.ru" && source info_param.sh
|
||||
cd ../..
|
||||
find . -type f -name 'README*.md' -o -name '*.gemspec' | sort -r | while read -r file; do
|
||||
remote="gitea.com" && source info_param.sh
|
||||
cd ../.. # выходим из папки и из репозитория
|
||||
# обходим все репозитории, расположенные на одном уровне с текущим
|
||||
find . -type f -name 'README*.md' | sort -r | while read -r file; do
|
||||
echo "$remote => $file"
|
||||
# заменяем gitea.com => hub.mos.ru => иначе наоборот
|
||||
if [ "$remote" == "hub.mos.ru" ]; then
|
||||
sed -i 's/git\.org\.ru/hub\.mos\.ru/g' "$file"
|
||||
sed -i 's/GIT\.ORG\.RU/HUB\.MOS\.RU/g' "$file"
|
||||
sed -i 's/gitea\.com/hub\.mos\.ru/g' "$file"
|
||||
sed -i 's/GITEA/HUB\.MOS\.RU/g' "$file"
|
||||
sed -i 's/src\/branch/blob/g' "$file"
|
||||
else
|
||||
sed -i 's/hub\.mos\.ru/git\.org\.ru/g' "$file"
|
||||
sed -i 's/HUB\.MOS\.RU/GIT\.ORG\.RU/g' "$file"
|
||||
sed -i 's/hub\.mos\.ru/gitea\.com/g' "$file"
|
||||
sed -i 's/HUB\.MOS\.RU/GITEA/g' "$file"
|
||||
sed -i 's/blob/src\/branch/g' "$file"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -1,26 +1,33 @@
|
|||
#!/bin/bash
|
||||
echo "Построение дерева каталогов для каждого проекта и копирование файлов лицензии."
|
||||
# отсортированный список файлов и каталогов
|
||||
function list_directory_contents {
|
||||
# сначала заглавные буквы, потом строчные, сначала каталоги, потом файлы
|
||||
eval "LC_COLLATE=C ls -A --group-directories-first $exclusions $1"
|
||||
}
|
||||
# дерево каталогов со ссылками
|
||||
function directory_tree {
|
||||
# аргументы
|
||||
local path="$1"
|
||||
local head="$2"
|
||||
local tail="$3"
|
||||
# префикс для текущего элемента
|
||||
if [ "one" == "$4" ]; then
|
||||
echo -n "/"
|
||||
else
|
||||
echo -ne "\n$head"
|
||||
fi
|
||||
# текущий элемент дерева
|
||||
echo -n "<a href='${path#*/}'>${path##*/}</a>"
|
||||
# рекурсивные вызовы для подкаталогов
|
||||
if [ -d "$path" ]; then
|
||||
local list
|
||||
local list # массив файлов и каталогов
|
||||
readarray -t list <<<"$(list_directory_contents "$path")"
|
||||
local len=${#list[@]}
|
||||
local i
|
||||
local len=${#list[@]} # размер массива
|
||||
local i # счётчик
|
||||
for ((i = 0; i < len; i++)); do
|
||||
if [ -z "${list[$i]}" ]; then
|
||||
continue
|
||||
continue # пропустить пустой каталог
|
||||
elif ((len == 1)); then
|
||||
directory_tree "$path/${list[$i]}" "$tail" "$tail" "one"
|
||||
elif ((i < len - 1)); then
|
||||
|
@ -31,19 +38,24 @@ function directory_tree {
|
|||
done
|
||||
fi
|
||||
}
|
||||
cd ..
|
||||
basedir=$(pwd)
|
||||
milliseconds=$(date '+%s%3N')
|
||||
cd .. # выходим из папки в корень репозитория
|
||||
basedir=$(pwd) # текущий репозиторий
|
||||
currentTimeMillis=$(date '+%s%3N')
|
||||
# обходим все репозитории, расположенные на одном уровне с текущим
|
||||
find .. -mindepth 1 -maxdepth 1 -type d | sort -r | while read -r dir; do
|
||||
echo "Обработка: $dir"
|
||||
# заходим в каталог, иначе пропускаем итерацию
|
||||
cd "$dir" || continue
|
||||
# строка исключений для 'ls' из списка '.gitignore' — неотслеживаемые файлы
|
||||
exclusions="-I \".git\" $(sed 's/^/ -I "/;s/$/"/' .gitignore | tr -d '\n')"
|
||||
# помещаем дерево в контейнер, добавляем заголовок и выводим в файл
|
||||
{
|
||||
echo "## Дерево каталогов"
|
||||
echo -ne "\n<pre>"
|
||||
directory_tree .
|
||||
echo -e "\n</pre>"
|
||||
} >DIRECTORY_TREE.md
|
||||
# копирование файлов из этого репозитория во все остальные
|
||||
if [ "${dir##*/}" != "${basedir##*/}" ]; then
|
||||
rm CONTRIBUTING.md
|
||||
rm ./*LICENSE*
|
||||
|
@ -51,4 +63,4 @@ find .. -mindepth 1 -maxdepth 1 -type d | sort -r | while read -r dir; do
|
|||
cp "$basedir"/*LICENSE* .
|
||||
fi
|
||||
done
|
||||
echo "Время выполнения: $(("$(date '+%s%3N')" - "$milliseconds")) мс."
|
||||
echo "Время выполнения: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|
||||
|
|
|
@ -1,58 +1,77 @@
|
|||
#!/bin/bash
|
||||
echo "Составление скриптов с параметрами и копирование их в каталоги проектов."
|
||||
remote="git.org.ru" && source info_param.sh
|
||||
remote="gitea.com" && source info_param.sh
|
||||
basedir=$(pwd)
|
||||
cd ../..
|
||||
cd ../.. # выходим из папки и из репозитория
|
||||
# обходим все репозитории, расположенные на одном уровне с текущим
|
||||
find . -mindepth 1 -maxdepth 1 -type d | sort -r | while read -r dir; do
|
||||
echo "Обработка: $dir"
|
||||
# добавляем исключение в список '.gitignore', если ещё не добавлено
|
||||
if [ ! -f "$dir"/.gitignore ] || [ "$(grep -cx "\.repo_\*" "$dir"/.gitignore)" == 0 ]; then
|
||||
echo ".repo_*" >>"$dir"/.gitignore
|
||||
echo "Обновлён файл .gitignore"
|
||||
fi
|
||||
owner="golovin.gg"
|
||||
# параметры для шаблонов
|
||||
owner="golovin"
|
||||
repo=${dir##*/}
|
||||
description=""
|
||||
type="usr"
|
||||
wiki=""
|
||||
# оглавления по страницам сайтов
|
||||
if [ -f "$dir"/WIKI.md ]; then
|
||||
if [ "$remote" == "hub.mos.ru" ]; then
|
||||
wiki=$(uni2ascii -a U -qpsn "$dir"/WIKI.md)
|
||||
else
|
||||
wiki=$(basenc "$dir"/WIKI.md --base64)
|
||||
wiki=$(basenc "$dir"/WIKI.md --base64 -w0)
|
||||
fi
|
||||
fi
|
||||
# краткие описания для репозиториев
|
||||
if [[ "$dir" =~ "pomodoro" ]]; then
|
||||
if [[ "$dir" =~ [[:digit:]] ]]; then
|
||||
owner="pomodoro"
|
||||
repo=${dir//[^[:digit:]]/}
|
||||
type="org"
|
||||
description="Вёб-сайт: https://${owner}${repo}.mircloud.ru"
|
||||
if [[ "$dir" =~ "1" ]]; then
|
||||
description="Трёхмерная графика на JavaScript"
|
||||
elif [[ "$dir" =~ "2" ]]; then
|
||||
description="Декартово произведение, комбинаторика"
|
||||
elif [[ "$dir" =~ "3" ]]; then
|
||||
description="Умножение матриц и повороты"
|
||||
elif [[ "$dir" =~ "4" ]]; then
|
||||
description="Психология, поэзия и юмор"
|
||||
elif [[ "$dir" =~ "5" ]]; then
|
||||
description="Рисуем картинки текстом"
|
||||
elif [[ "$dir" =~ "6" ]]; then
|
||||
description="Пустой"
|
||||
fi
|
||||
description+=" — https://$owner$repo.mircloud.ru"
|
||||
else
|
||||
description="Описание / Управление процессами / Незавершённые публикации / Аватарки для репозиториев"
|
||||
description="Серия статических вёб-сайтов / Описание и оглавление"
|
||||
fi
|
||||
elif [[ "$dir" =~ "color-tomato" ]]; then
|
||||
description="Цветной помидор / Тема оформления Jekyll"
|
||||
elif [[ "$dir" =~ "older-tomato" ]]; then
|
||||
description="Старый помидор / Тема оформления Jekyll"
|
||||
fi
|
||||
# скрипт для создания удалённого репозитория
|
||||
{
|
||||
echo "#!/bin/bash"
|
||||
if [ "$remote" == "hub.mos.ru" ]; then
|
||||
echo "user=\"golovin.gg\""
|
||||
fi
|
||||
echo "remote=\"$remote\""
|
||||
echo "user=\"golovin\""
|
||||
echo "owner=\"$owner\""
|
||||
echo "repo=\"$repo\""
|
||||
echo "description=\"$description\""
|
||||
echo "type=\"$type\""
|
||||
echo "wiki=\"$wiki\""
|
||||
if [ "$remote" == "hub.mos.ru" ]; then
|
||||
echo "token=\"$(cat "$basedir/.token_hub_mos_ru")\""
|
||||
echo "token=\"$(cat "$basedir/.token_gitlab")\""
|
||||
cat "$basedir/repo_gitlab.tmpl.sh"
|
||||
else
|
||||
echo "token=\"$(cat "$basedir/.token_git_org_ru")\""
|
||||
echo "token=\"$(cat "$basedir/.token_gitea")\""
|
||||
cat "$basedir/repo_gitea.tmpl.sh"
|
||||
fi
|
||||
} >"$dir"/.repo_remote.sh && chmod +x "$dir"/.repo_remote.sh
|
||||
# скрипт для создания локального репозитория
|
||||
{
|
||||
echo "#!/bin/bash"
|
||||
echo "remote=\"$remote\""
|
||||
|
|
|
@ -1,46 +1,78 @@
|
|||
if [ -z "$token" ] || [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$description" ] || [ -z "$type" ]; then
|
||||
if [ -z "$remote" ] || [ -z "$token" ] || [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$description" ] || [ -z "$user" ] || [ -z "$type" ]; then
|
||||
echo "Не указаны обязательные параметры." && exit 2
|
||||
fi
|
||||
echo "Создание удалённого репозитория для текущего каталога."
|
||||
seconds=3
|
||||
milliseconds=$(date '+%s%3N')
|
||||
echo "Удаление старого репозитория."
|
||||
curl -X DELETE "https://git.org.ru/api/v1/repos/$owner/$repo" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token $token" -i
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
if [ "$type" == "org" ]; then
|
||||
echo "Создание нового репозитория организации."
|
||||
curl -X POST "https://git.org.ru/api/v1/orgs/$owner/repos" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Content-Type: application/json" -d "{ \"name\": \"$repo\", \"description\": \"$description\"}" -i
|
||||
else
|
||||
echo "Создание нового репозитория пользователя."
|
||||
curl -X POST "https://git.org.ru/api/v1/user/repos" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Content-Type: application/json" -d "{ \"name\": \"$repo\", \"description\": \"$description\"}" -i
|
||||
if [ -z "$1" ]; then
|
||||
echo "Создание удалённого репозитория для текущего каталога."
|
||||
fi
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
if [ "$wiki" ]; then
|
||||
echo "Добавление страницы wiki в репозиторий."
|
||||
curl -X POST "https://git.org.ru/api/v1/repos/$owner/$repo/wiki/new" \
|
||||
-H "accept: application/json" \
|
||||
seconds=5
|
||||
currentTimeMillis=$(date '+%s%3N')
|
||||
if [ -z "$1" ] || [ "$1" == "delete" ]; then
|
||||
echo "Удаление старого репозитория."
|
||||
curl -X DELETE "https://$remote/api/v1/repos/$owner/$repo" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Content-Type: application/json" -d "{ \"content_base64\": \"$wiki\", \"title\": \"Home\"}" -i
|
||||
-H "Accept: application/json" -i
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
has_wiki=true
|
||||
else
|
||||
has_wiki=false
|
||||
if [ "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "Изменение свойств репозитория / отключение ненужного."
|
||||
curl -X PATCH "https://git.org.ru/api/v1/repos/$owner/$repo" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Content-Type: application/json" -d \
|
||||
"{ \"has_wiki\": $has_wiki, \"has_issues\": false, \"has_projects\": false, \"has_pull_requests\": false}" -i
|
||||
echo "Время создания удалённого репозитория: $(("$(date '+%s%3N')" - "$milliseconds")) мс."
|
||||
if [ -z "$1" ] || [ "$1" == "create" ]; then
|
||||
echo "Создание нового репозитория пользователя."
|
||||
curl -X POST "https://$remote/api/v1/user/repos" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" -d "{ \"name\": \"$repo\", \"description\": \"$description\" }" -i
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
if [ "$type" == "org" ]; then
|
||||
echo "Перемещение репозитория в группу."
|
||||
curl -X POST "https://$remote/api/v1/repos/$user/$repo/transfer" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" -d "{ \"new_owner\": \"$owner\" }" -i
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
fi
|
||||
if [ "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ -z "$1" ] || [ "$1" == "options" ]; then
|
||||
if [ "$wiki" ]; then
|
||||
echo "Добавление страницы wiki в репозиторий."
|
||||
curl -X POST "https://$remote/api/v1/repos/$owner/$repo/wiki/new" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" -d "{ \"content_base64\": \"$wiki\", \"title\": \"Home\" }" -i
|
||||
has_wiki=true
|
||||
else
|
||||
has_wiki=false
|
||||
fi
|
||||
echo "Изменение свойств репозитория / отключение ненужного."
|
||||
curl -X PATCH "https://$remote/api/v1/repos/$owner/$repo" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" -d "{
|
||||
\"has_actions\": false,
|
||||
\"has_issues\": false,
|
||||
\"has_packages\": false,
|
||||
\"has_projects\": false,
|
||||
\"has_pull_requests\": false,
|
||||
\"has_releases\": false,
|
||||
\"has_wiki\": $has_wiki }" -i
|
||||
echo "Добавление аватарки для репозитория."
|
||||
picture=$repo
|
||||
if [ "$type" == "org" ]; then
|
||||
picture="pomodoro-website"
|
||||
fi
|
||||
avatar=$(basenc "../pomodoro/pictures/$picture.jpg" --base64 -w0)
|
||||
curl -X POST "https://$remote/api/v1/repos/$owner/$repo/avatar" \
|
||||
-H "Authorization: token $token" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" -d "{ \"image\": \"$avatar\" }" -i
|
||||
if [ "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "Время создания удалённого репозитория: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|
||||
|
|
|
@ -1,91 +1,104 @@
|
|||
if [ -z "$token" ] || [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$description" ] || [ -z "$user" ] || [ -z "$type" ]; then
|
||||
if [ -z "$remote" ] || [ -z "$token" ] || [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$description" ] || [ -z "$user" ] || [ -z "$type" ]; then
|
||||
echo "Не указаны обязательные параметры." && exit 2
|
||||
fi
|
||||
echo "Создание удалённого репозитория для текущего каталога."
|
||||
seconds=15
|
||||
milliseconds=$(date '+%s%3N')
|
||||
echo "Удаление старого репозитория."
|
||||
curl -i -X DELETE "https://hub.mos.ru/api/v4/projects/$owner%2F$repo" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{\"permanently_remove\": \"true\", \"full_path\": \"$owner/$repo\"}"
|
||||
echo
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
echo "Создание нового репозитория пользователя."
|
||||
curl -i -X POST "https://hub.mos.ru/api/v4/projects" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{\"name\": \"$repo\", \"description\": \"$description\"}"
|
||||
echo
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
if [ "$type" == "org" ]; then
|
||||
echo "Перемещение репозитория в группу."
|
||||
curl -i -X PUT "https://hub.mos.ru/api/v4/projects/$user%2F$repo/transfer?namespace=$owner" \
|
||||
-H "PRIVATE-TOKEN: $token"
|
||||
echo
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
if [ -z "$1" ]; then
|
||||
echo "Создание удалённого репозитория для текущего каталога."
|
||||
fi
|
||||
if [ "$wiki" ]; then
|
||||
echo "Добавление страницы wiki в репозиторий."
|
||||
curl -i -X POST "https://hub.mos.ru/api/v4/projects/$owner%2F$repo/wikis" \
|
||||
seconds=7
|
||||
currentTimeMillis=$(date '+%s%3N')
|
||||
if [ -z "$1" ] || [ "$1" == "delete" ]; then
|
||||
echo "Удаление старого репозитория."
|
||||
curl -i -X DELETE "https://$remote/api/v4/projects/$owner%2F$repo" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{ \"content\": \"$wiki\", \"title\": \"Home\"}"
|
||||
has_wiki="enabled"
|
||||
-H "Content-Type: application/json" -d "{\"permanently_remove\": \"true\", \"full_path\": \"$owner/$repo\"}"
|
||||
echo
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
else
|
||||
has_wiki="disabled"
|
||||
if [ "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "Изменение свойств репозитория / отключение ненужного."
|
||||
curl -i -X PUT "https://hub.mos.ru/api/v4/projects/$owner%2F$repo" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{
|
||||
\"emails_disabled\": \"true\",
|
||||
\"issues_access_level\": \"disabled\",
|
||||
\"merge_requests_access_level\": \"disabled\",
|
||||
\"operations_access_level\": \"disabled\",
|
||||
\"builds_access_level\": \"disabled\",
|
||||
\"request_access_enabled\": \"false\",
|
||||
\"keep_latest_artifact\": \"false\",
|
||||
\"ci_forward_deployment_enabled\": \"false\",
|
||||
\"ci_separated_caches\": \"false\",
|
||||
\"ci_allow_fork_pipelines_to_run_in_parent_project\": \"false\",
|
||||
\"jobs_enabled\": \"false\",
|
||||
\"public_builds\": \"false\",
|
||||
\"packages_enabled\": \"false\",
|
||||
\"merge_requests_enabled\": \"false\",
|
||||
\"issues_enabled\": \"false\",
|
||||
\"lfs_enabled\": \"false\",
|
||||
\"snippets_enabled\": \"false\",
|
||||
\"container_registry_enabled\": \"false\",
|
||||
\"wiki_access_level\": \"$has_wiki\",
|
||||
\"container_registry_access_level\": \"disabled\",
|
||||
\"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
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
echo "Добавление аватарки для репозитория."
|
||||
picture=$repo
|
||||
if [ "$type" == "org" ]; then
|
||||
picture="pomodoro-website"
|
||||
if [ -z "$1" ] || [ "$1" == "create" ]; then
|
||||
echo "Создание нового репозитория пользователя."
|
||||
curl -i -X POST "https://$remote/api/v4/projects" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{\"name\": \"$repo\", \"description\": \"$description\"}"
|
||||
echo
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
if [ "$type" == "org" ]; then
|
||||
echo "Перемещение репозитория в группу."
|
||||
curl -i -X PUT "https://$remote/api/v4/projects/$user%2F$repo/transfer?namespace=$owner" \
|
||||
-H "PRIVATE-TOKEN: $token"
|
||||
echo
|
||||
echo "Ожидание $seconds с."
|
||||
sleep $seconds
|
||||
fi
|
||||
if [ "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
curl -i -X PUT "https://hub.mos.ru/api/v4/projects/$owner%2F$repo" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-F "avatar=@../pomodoro/pictures/$picture.jpg"
|
||||
echo
|
||||
echo "Время создания удалённого репозитория: $(("$(date '+%s%3N')" - "$milliseconds")) мс."
|
||||
if [ -z "$1" ] || [ "$1" == "options" ]; then
|
||||
if [ "$wiki" ]; then
|
||||
echo "Добавление страницы wiki в репозиторий."
|
||||
curl -i -X POST "https://$remote/api/v4/projects/$owner%2F$repo/wikis" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{\"content\": \"$wiki\", \"title\": \"Home\"}"
|
||||
echo
|
||||
has_wiki="enabled"
|
||||
else
|
||||
has_wiki="disabled"
|
||||
fi
|
||||
echo "Изменение свойств репозитория / отключение ненужного."
|
||||
curl -i -X PUT "https://$remote/api/v4/projects/$owner%2F$repo" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-H "Content-Type: application/json" -d "{
|
||||
\"emails_disabled\": \"true\",
|
||||
\"issues_access_level\": \"disabled\",
|
||||
\"merge_requests_access_level\": \"disabled\",
|
||||
\"operations_access_level\": \"disabled\",
|
||||
\"builds_access_level\": \"disabled\",
|
||||
\"request_access_enabled\": \"false\",
|
||||
\"keep_latest_artifact\": \"false\",
|
||||
\"ci_forward_deployment_enabled\": \"false\",
|
||||
\"ci_separated_caches\": \"false\",
|
||||
\"ci_allow_fork_pipelines_to_run_in_parent_project\": \"false\",
|
||||
\"jobs_enabled\": \"false\",
|
||||
\"public_builds\": \"false\",
|
||||
\"packages_enabled\": \"false\",
|
||||
\"merge_requests_enabled\": \"false\",
|
||||
\"issues_enabled\": \"false\",
|
||||
\"lfs_enabled\": \"false\",
|
||||
\"snippets_enabled\": \"false\",
|
||||
\"container_registry_enabled\": \"false\",
|
||||
\"wiki_access_level\": \"$has_wiki\",
|
||||
\"container_registry_access_level\": \"disabled\",
|
||||
\"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
|
||||
echo "Добавление аватарки для репозитория."
|
||||
picture=$repo
|
||||
if [ "$type" == "org" ]; then
|
||||
picture="pomodoro-website"
|
||||
fi
|
||||
curl -i -X PUT "https://$remote/api/v4/projects/$owner%2F$repo" \
|
||||
-H "PRIVATE-TOKEN: $token" \
|
||||
-F "avatar=@../pomodoro/pictures/$picture.jpg"
|
||||
echo
|
||||
if [ "$1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "Время создания удалённого репозитория: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|
||||
|
|
|
@ -3,7 +3,7 @@ if [ -z "$remote" ] || [ -z "$owner" ] || [ -z "$repo" ] || [ -z "$folder" ]; th
|
|||
fi
|
||||
echo "Создание локального репозитория, подключение к удалённому и передача данных."
|
||||
seconds=3
|
||||
milliseconds=$(date '+%s%3N')
|
||||
currentTimeMillis=$(date '+%s%3N')
|
||||
rm -rf .git
|
||||
git init -b master
|
||||
git remote add "$remote" "git@$remote:$owner/$repo.git"
|
||||
|
@ -22,6 +22,13 @@ git add DIRECTORY_TREE.md
|
|||
git add WIKI.md
|
||||
git add \*README*
|
||||
git commit -m "Описание проекта"
|
||||
git add \*.yml
|
||||
git add \*Gemfile*
|
||||
git add \*install.sh
|
||||
git add \*.gemspec
|
||||
git add \*counters_*
|
||||
git add \*robots.txt
|
||||
git commit -m "Настройки"
|
||||
git add \*.sh
|
||||
git commit -m "Скрипты bash"
|
||||
git add \*.min.css
|
||||
|
@ -35,10 +42,10 @@ git add \*.jpg
|
|||
git add \*.png
|
||||
git add \*.svg
|
||||
git commit -m "Картинки"
|
||||
find . -type f -not -regex '.*\.\(gem\|zip\|lock\)\|.*/\(\.\|_site\).*' | sort -r | while read -r file; do
|
||||
find . -type f -not -path "*/.*" -not -path "./_site*" | sort -r | while read -r file; do
|
||||
echo "Обработка: $file"
|
||||
git add "$file"
|
||||
git commit -m "${file#*/}"
|
||||
done
|
||||
git push -u "$remote" master
|
||||
echo "Время создания локального репозитория: $(("$(date '+%s%3N')" - "$milliseconds")) мс."
|
||||
echo "Время создания локального репозитория: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
#!/bin/bash
|
||||
echo "Параллельное выполнение скриптов и создание репозиториев для каталогов проектов."
|
||||
cd ..
|
||||
milliseconds=$(date '+%s%3N')
|
||||
## --
|
||||
# Для всех репозиториев, на одном уровне с текущим, формируем скрипт в одну строчку и
|
||||
# выполняем эти скрипты в параллельном режиме. Скрипт в одну строчку — это выполнение
|
||||
# заранее подготовленных других скриптов для локальных и удалённых репозиториев.
|
||||
# Формируем скрипты несколько раз с разными параметрами и параллельностью: создание
|
||||
# удалённых репозиториев — 5 потоков, все остальные действия без ограничений.
|
||||
# --
|
||||
cd .. # выходим из папки в корень репозитория
|
||||
currentTimeMillis=$(date '+%s%3N')
|
||||
# удаление репозиториев на сервере
|
||||
find .. -mindepth 1 -maxdepth 1 -type d -printf \
|
||||
'cd %h/%f && ./.repo_remote.sh >.repo_remote.log && ./.repo_local.sh >.repo_local.log\0' | xargs -L1 -0 -P0 bash -c
|
||||
echo "Общее время выполнения: $(("$(date '+%s%3N')" - "$milliseconds")) мс."
|
||||
'cd %h/%f && ./.repo_remote.sh "delete" >.repo_remote.log\0' | xargs -L1 -0 -P0 bash -c
|
||||
# создание репозиториев на сервере для каталогов с сайтами
|
||||
find .. -mindepth 1 -maxdepth 1 -type d -regex ".*[1-6]" -printf \
|
||||
'cd %h/%f && ./.repo_remote.sh "create" >>.repo_remote.log\0' | xargs -L1 -0 -P5 bash -c
|
||||
# создание репозиториев на сервере для остальных каталогов
|
||||
find .. -mindepth 1 -maxdepth 1 -type d -regex ".*[^1-6]" -printf \
|
||||
'cd %h/%f && ./.repo_remote.sh "create" >>.repo_remote.log\0' | xargs -L1 -0 -P5 bash -c
|
||||
# создание локальных репозиториев и отправка данных на сервер,
|
||||
# параллельно изменение настроек удалённых репозиториев
|
||||
find .. -mindepth 1 -maxdepth 1 -type d -printf \
|
||||
'cd %h/%f && ./.repo_local.sh >.repo_local.log\0
|
||||
cd %h/%f && ./.repo_remote.sh "options" >>.repo_remote.log\0' | xargs -L1 -0 -P0 bash -c
|
||||
echo "Общее время выполнения: $(("$(date '+%s%3N')" - "$currentTimeMillis")) мс."
|
||||
|
|
|
@ -283,3 +283,5 @@ class Test2 {
|
|||
</details>
|
||||
|
||||
---
|
||||
|
||||
© Головин Г.Г., Код с комментариями, 2021-2023
|
||||
|
|
Loading…
Add table
Reference in a new issue