diff --git a/xcode/bootstrap/Brewfile b/xcode/bootstrap/Brewfile new file mode 100644 index 0000000..396ea43 --- /dev/null +++ b/xcode/bootstrap/Brewfile @@ -0,0 +1,14 @@ +# Working environment +brew "rbenv" # ruby + bundler +brew "gettext" + +# Code, configs and project generation +brew "php" +brew "python" +brew "xcodegen" + +# code quality +brew "pmd" + +# CI badge +# brew "imagemagick" \ No newline at end of file diff --git a/xcode/bootstrap/Gemfile b/xcode/bootstrap/Gemfile new file mode 100644 index 0000000..8f79a29 --- /dev/null +++ b/xcode/bootstrap/Gemfile @@ -0,0 +1,9 @@ +source "https://rubygems.org" + +gem "cocoapods" +gem "fastlane" +gem 'mustache' # for config generator +gem 'xcode-install' + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) \ No newline at end of file diff --git a/xcode/bootstrap/Makefile b/xcode/bootstrap/Makefile new file mode 100644 index 0000000..26477bc --- /dev/null +++ b/xcode/bootstrap/Makefile @@ -0,0 +1,86 @@ +GREEN := $(shell tput -Txterm setaf 2) +YELLOW := $(shell tput -Txterm setaf 3) +WHITE := $(shell tput -Txterm setaf 7) +RESET := $(shell tput -Txterm sgr0) + +RUBY_VERSION="2.7.6" + +open_project=(open *.xcworkspace) +install_dev_certs=(bundle exec fastlane SyncCodeSigning type:development readonly:true) +install_pods=(bundle exec pod install || bundle exec pod install --repo-update) + +TARGET_MAX_CHAR_NUM=20 +## Show help +help: + @echo '' + @echo 'Использование:' + @echo ' ${YELLOW}make${RESET} ${GREEN}${RESET}' + @echo '' + @echo 'Команды:' + @awk '/^[a-zA-Z\-\_0-9]+:/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + if (helpMessage) { \ + helpCommand = substr($$1, 0, index($$1, ":")-1); \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ + } \ + } \ + { lastLine = $$0 }' $(MAKEFILE_LIST) + +## Инициализирует проект и устанавливает системные утилиты +init: + brew bundle + + eval "$(rbenv init -)" + + rbenv install -s ${RUBY_VERSION} + rbenv global ${RUBY_VERSION} + + if ! gem spec bundler > /dev/null 2>&1; then\ + echo "bundler gem is not installed!";\ + -sudo gem install bundler;\ + fi + + bundle install + + xcodegen generate + + $(call install_pods) + + bundle exec fastlane install_plugins + + $(call install_dev_certs) + + $(call open_project) + + git config --local core.hooksPath .githooks + +## Устанавливает поды +pod: + $(call install_pods) + +## Устанавливает сертификат и профили для запуска на девайсе +dev_certs: + $(call install_dev_certs) + +## Открывает папку для ручного редактирования сертификатов и профайлов +update_certs: + bundle exec fastlane ManuallyUpdateCodeSignin + +## Поднимает версию приложения (параметр "X.Y.Z") +bumpAppVersion: + ifeq ($(version),undefined) + @echo "Version parameter is missing (ex: x.y.z)" $(target) + else + bundle exec fastlane run increment_version_number version_number:$(version) + endif + +## Позволяет быстро открыть workspace проекта +start: + $(call open_project) + +## Очищает содержимое папки DerivedData +clean: + rm -rf ~/Library/Developer/Xcode/DerivedData/* + + diff --git a/xcode/bootstrap/setup.command b/xcode/bootstrap/setup.command new file mode 100755 index 0000000..0ae8983 --- /dev/null +++ b/xcode/bootstrap/setup.command @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PROJECT_DIR="${DIR}/../../../" + +make init -C ${PROJECT_DIR} \ No newline at end of file