diff --git a/CHANGELOG.md b/CHANGELOG.md index 9341e83..286fa2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.7] - 2020-10-13 +### Changed +- Исключил Generated папку из списка форматирования pre-commit хуков +- Хуки теперь хранятся в папке hooks проекта + ## [1.2.6] - 2020-10-12 ### Added - Добавил кэширование клонированных зависимостей SPM для Bitrise CI diff --git a/{{ cookiecutter.name }}/Makefile b/{{ cookiecutter.name }}/Makefile index cf9673a..fc32516 100644 --- a/{{ cookiecutter.name }}/Makefile +++ b/{{ cookiecutter.name }}/Makefile @@ -53,10 +53,8 @@ endif ## hook: Install git pre-commit hook hook: - curl "https://gist.githubusercontent.com/alphatroya/884aef2590d3c873d4f0d447d6a95a3c/raw/8a2682772cf9a7625b680771cf9ad9106c6cf00e/pre-commit" > .git/hooks/pre-commit + ln -sf ../../hooks/pre-commit .git/hooks/pre-commit chmod +x .git/hooks/pre-commit - echo "\nmint run xcodegen" >> .git/hooks/pre-commit - echo "git add {{ cookiecutter.name }}.xcodeproj" >> .git/hooks/pre-commit ## clean: Clean up project files clean: diff --git a/{{ cookiecutter.name }}/README.md b/{{ cookiecutter.name }}/README.md index aa119a6..985957a 100644 --- a/{{ cookiecutter.name }}/README.md +++ b/{{ cookiecutter.name }}/README.md @@ -21,7 +21,7 @@ Also, some secret environment parameters need to be set: The project was generated using the [cookiecutter tool](https://github.com/audreyr/cookiecutter) and [this](https://github.com/alphatroya/swift-project-template) swift template. -Template version: 1.2.6 +Template version: 1.2.7 ## AppStore credentials diff --git a/{{ cookiecutter.name }}/hooks/pre-commit b/{{ cookiecutter.name }}/hooks/pre-commit new file mode 100755 index 0000000..c0edb3d --- /dev/null +++ b/{{ cookiecutter.name }}/hooks/pre-commit @@ -0,0 +1,11 @@ +#!/bin/bash +git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do + if [[ $line == *"/Generated"* ]]; then + echo "IGNORING GENERATED FILE: " "$line"; + else + mint run swiftformat swiftformat "${line}"; + git add "$line"; + fi +done +mint run xcodegen +git add {{ cookiecutter.name }}.xcodeproj