2024-10-31
This commit is contained in:
parent
6fb4dfdbf4
commit
4339539c68
5 changed files with 11 additions and 9 deletions
|
@ -69,7 +69,7 @@ printf '%s\n' "${array[@]}"
|
|||
# текущее время в миллисекундах
|
||||
time_ms="$(date '+%s%3N')"
|
||||
# вывод строк массива и вызов функции для каждой из них в параллельном режиме
|
||||
printf '%s\0' "${array[@]}" | xargs -I{} -n1 -0 -P0 bash -c "{}"
|
||||
printf '%s\0' "${array[@]}" | xargs -L1 -0 -P0 bash -c
|
||||
# время работы в миллисекундах
|
||||
echo "Общее время выполнения: $(("$(date '+%s%3N')" - "$time_ms")) мс."
|
||||
```
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
echo "Создание общего архива для каталогов проектов на текущую дату."
|
||||
cd ../.. # выходим из папки и из репозитория
|
||||
filename="pomodoro-$(date '+%Y-%m-%d').zip"
|
||||
rm -rf "$filename"
|
||||
7z a -tzip "$filename" . -xr!".git" -xr!".idea" -xr!"*.iml" -xr!"*.zip" \
|
||||
-xr!"*.gem" -xr!"*.lock" -xr!"_site*" -xr!".token_*" -xr!".repo_*"
|
||||
# сводная строка исключений для всех проектов из файлов ".gitignore"
|
||||
exclusions="$(find . -maxdepth 2 -type f -name '.gitignore' -exec \
|
||||
sed -E "s|^(.*)$|-xr!'\1'|" {} \; | sort | uniq | tr '\n' ' ')"
|
||||
rm -f "$filename"
|
||||
eval "7z a -tzip '$filename' . -xr!'.git' $exclusions"
|
||||
|
|
|
@ -48,7 +48,7 @@ function tree_license {
|
|||
cp -f ../pomodoro/*LICENSE* .
|
||||
fi
|
||||
# строка исключений для "ls" из списка ".gitignore" — неотслеживаемые файлы
|
||||
exclusions="-I \".git\" $(sed 's/^/ -I "/;s/$/"/' .gitignore | tr -d '\n')"
|
||||
exclusions="-I'.git' $(sed -E "s|^(.*)$|-I'\1'|" .gitignore | tr '\n' ' ')"
|
||||
# помещаем дерево в контейнер, добавляем заголовок и выводим в файл
|
||||
{
|
||||
echo "## Дерево каталогов"
|
||||
|
|
|
@ -5,7 +5,7 @@ export basedir="$PWD" # текущая папка
|
|||
# обновление списка исключений
|
||||
function update_gitignore {
|
||||
# добавляем исключение в список ".gitignore", если оно ещё не добавлено
|
||||
if [ ! -f "$1/.gitignore" ] || [ "$(grep -cx "\.repo_\*" "$1/.gitignore")" == 0 ]; then
|
||||
if [ ! -f "$1/.gitignore" ] || [ "$(grep -cF ".repo_*" "$1/.gitignore")" == 0 ]; then
|
||||
echo ".repo_*" >>"$1/.gitignore"
|
||||
echo "Обновлён файл: $1/.gitignore"
|
||||
fi
|
||||
|
|
|
@ -41,10 +41,10 @@ git add \*.jpg
|
|||
git add \*.png
|
||||
git add \*.svg
|
||||
git commit -m "Картинки"
|
||||
find . -type f -not -path "*/.*" -not -path "./_site*" | LC_COLLATE=C sort -r | while read -r file; do
|
||||
while read -r file size; do
|
||||
echo "Обработка: $file"
|
||||
git add "$file"
|
||||
git commit -m "${file#*/}"
|
||||
done
|
||||
git commit -m "${file#*/} / $(numfmt --to=iec --format="%.2f" --suffix="B" "$size" | sed -E 's|,{,1}0{,2}([BKM])| \1|')"
|
||||
done < <(find . -type f -not -path "*/.*" -not -path "./_site*" -printf '%h/%f %s\n' | LC_COLLATE=C sort -r)
|
||||
git push -u "$domain" master
|
||||
echo "Общее время выполнения: $(("$(date '+%s%3N')" - "$time_ms")) мс."
|
||||
|
|
Loading…
Add table
Reference in a new issue