diff --git a/bootstrap.sh b/bootstrap.sh index 740bf98..ac26811 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -34,6 +34,16 @@ cd $PROJECT_NAME_WITH_PREFIX rm -rf $PROJECT_NAME rm -rf $(ls) +# create git if not exists +if [ ! -d .git ]; then + git init + git remote add origin ${GIT_URL} + git fetch + git checkout -t origin/master +else + echo "Git exists..." +fi + # source code project folder echo "Create sources folders..." mkdir -p $PROJECT_NAME @@ -82,8 +92,10 @@ generate "{project_name: $PROJECT_NAME, deployment_target: $DEPLOYMENT_TARGET, p echo "Generate xcodeproj file..." xcodegen --spec project.yml -# generate code lint folders -generate "{project_name: $PROJECT_NAME" $TEMPLATES/build_phases/code_lint_folders.mustache build_phases/code_lint_folders.xcfilelist +# conifgure build_phases folder +cp -r $CURRENT_DIR/sources/build_phases ./build_phases + +generate "{project_name: $PROJECT_NAME}" $TEMPLATES/build_phases/code_lint_folders.mustache build_phases/code_lint_folders.xcfilelist # creating .gitkeep in each folder to enforce git stash this folder for folder in `cat $CURRENT_DIR/foldernames.txt`; do @@ -99,9 +111,14 @@ cp $TEMPLATES/gitignore .gitignore cp $TEMPLATES/gitattributes .gitattributes # configure git hooks +cp -r $CURRENT_DIR/sources/.githooks .githooks + generate "{project_name: $PROJECT_NAME}" $TEMPLATES/githooks/post-merge.mustache .githooks/post-merge generate "{project_name: $PROJECT_NAME}" $TEMPLATES/githooks/pre-commit.mustache .githooks/pre-commit +chmod +x .githooks/post-merge +chmod +x .githooks/pre-commit + git config --local core.hooksPath .githooks # configure fastlane diff --git a/sources/Gemfile.lock b/sources/Gemfile.lock deleted file mode 100644 index c9e6429..0000000 --- a/sources/Gemfile.lock +++ /dev/null @@ -1,268 +0,0 @@ -GIT - remote: https://github.com/strongself/Generamba.git - revision: d0930d3bd2589a34e06bf6f9c5016dc3ffe7678a - specs: - generamba (1.5.0) - cocoapods-core (>= 1.4.0, < 2.0.0) - git (= 1.2.9.1) - liquid (= 4.0.0) - terminal-table (= 1.4.5) - thor (= 0.19.1) - xcodeproj (>= 1.5.0, < 2.0.0) - -GEM - remote: https://rubygems.org/ - specs: - CFPropertyList (3.0.2) - activesupport (4.2.11.3) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - algoliasearch (1.27.3) - httpclient (~> 2.8, >= 2.8.3) - json (>= 1.5.1) - atomos (0.1.3) - aws-eventstream (1.1.0) - aws-partitions (1.356.0) - aws-sdk-core (3.104.3) - aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) - aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.36.0) - aws-sdk-core (~> 3, >= 3.99.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.78.0) - aws-sdk-core (~> 3, >= 3.104.3) - aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.2) - aws-eventstream (~> 1, >= 1.0.2) - babosa (1.0.3) - badge (0.12.0) - curb (~> 0.9) - fastimage (>= 1.6) - fastlane (>= 2.0) - mini_magick (>= 4.9.4, < 5.0.0) - claide (1.0.3) - cocoapods (1.9.3) - activesupport (>= 4.0.2, < 5) - claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.9.3) - cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.2.2, < 2.0) - cocoapods-plugins (>= 1.0.0, < 2.0) - cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.4.0, < 2.0) - cocoapods-try (>= 1.1.0, < 2.0) - colored2 (~> 3.1) - escape (~> 0.0.4) - fourflusher (>= 2.3.0, < 3.0) - gh_inspector (~> 1.0) - molinillo (~> 0.6.6) - nap (~> 1.0) - ruby-macho (~> 1.4) - xcodeproj (>= 1.14.0, < 2.0) - cocoapods-core (1.9.3) - activesupport (>= 4.0.2, < 6) - algoliasearch (~> 1.0) - concurrent-ruby (~> 1.1) - fuzzy_match (~> 2.0.4) - nap (~> 1.0) - netrc (~> 0.11) - typhoeus (~> 1.0) - cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.4.0) - cocoapods-plugins (1.0.0) - nap - cocoapods-search (1.0.0) - cocoapods-stats (1.1.0) - cocoapods-trunk (1.5.0) - nap (>= 0.8, < 2.0) - netrc (~> 0.11) - cocoapods-try (1.2.0) - colored (1.2) - colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) - concurrent-ruby (1.1.7) - curb (0.9.10) - declarative (0.0.20) - declarative-option (0.1.0) - digest-crc (0.6.1) - rake (~> 13.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - dotenv (2.7.6) - emoji_regex (3.0.0) - escape (0.0.4) - ethon (0.12.0) - ffi (>= 1.3.0) - excon (0.76.0) - faraday (1.0.1) - multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) - http-cookie (~> 1.0.0) - faraday_middleware (1.0.0) - faraday (~> 1.0) - fastimage (2.2.0) - fastlane (2.156.1) - CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) - aws-sdk-s3 (~> 1.0) - babosa (>= 1.0.3, < 2.0.0) - bundler (>= 1.12.0, < 3.0.0) - colored - commander-fastlane (>= 4.4.6, < 5.0.0) - dotenv (>= 2.1.1, < 3.0.0) - emoji_regex (>= 0.1, < 4.0) - excon (>= 0.71.0, < 1.0.0) - faraday (~> 1.0) - faraday-cookie_jar (~> 0.0.6) - faraday_middleware (~> 1.0) - fastimage (>= 2.1.0, < 3.0.0) - gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.37.0, < 0.39.0) - google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) - json (< 3.0.0) - jwt (>= 2.1.0, < 3) - mini_magick (>= 4.9.4, < 5.0.0) - multipart-post (~> 2.0.0) - plist (>= 3.1.0, < 4.0.0) - rubyzip (>= 2.0.0, < 3.0.0) - security (= 0.1.3) - simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) - terminal-notifier (>= 2.0.0, < 3.0.0) - terminal-table (>= 1.4.5, < 2.0.0) - tty-screen (>= 0.6.3, < 1.0.0) - tty-spinner (>= 0.8.0, < 1.0.0) - word_wrap (~> 1.0.0) - xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-badge (1.4.0) - badge (~> 0.12.0) - fastlane-plugin-firebase_app_distribution (0.1.4) - ffi (1.13.1) - fourflusher (2.3.1) - fuzzy_match (2.0.4) - gh_inspector (1.1.3) - git (1.2.9.1) - google-api-client (0.38.0) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.9) - httpclient (>= 2.8.1, < 3.0) - mini_mime (~> 1.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - signet (~> 0.12) - google-cloud-core (1.5.0) - google-cloud-env (~> 1.0) - google-cloud-errors (~> 1.0) - google-cloud-env (1.3.3) - faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.0.1) - google-cloud-storage (1.27.0) - addressable (~> 2.5) - digest-crc (~> 0.4) - google-api-client (~> 0.33) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) - mini_mime (~> 1.0) - googleauth (0.13.1) - faraday (>= 0.17.3, < 2.0) - jwt (>= 1.4, < 3.0) - memoist (~> 0.16) - multi_json (~> 1.11) - os (>= 0.9, < 2.0) - signet (~> 0.14) - highline (1.7.10) - http-cookie (1.0.3) - domain_name (~> 0.5) - httpclient (2.8.3) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - jmespath (1.4.0) - json (2.3.1) - jwt (2.2.2) - liquid (4.0.0) - memoist (0.16.2) - mini_magick (4.10.1) - mini_mime (1.0.2) - minitest (5.14.1) - molinillo (0.6.6) - multi_json (1.15.0) - multipart-post (2.0.0) - nanaimo (0.3.0) - nap (1.1.0) - naturally (2.2.0) - netrc (0.11.0) - os (1.1.1) - plist (3.5.0) - public_suffix (4.0.5) - rake (13.0.1) - representable (3.0.4) - declarative (< 0.1.0) - declarative-option (< 0.2.0) - uber (< 0.2.0) - retriable (3.1.2) - rouge (2.0.7) - ruby-macho (1.4.0) - rubyzip (2.3.0) - security (0.1.3) - signet (0.14.0) - addressable (~> 2.3) - faraday (>= 0.17.3, < 2.0) - jwt (>= 1.5, < 3.0) - multi_json (~> 1.10) - simctl (1.6.8) - CFPropertyList - naturally - slack-notifier (2.3.2) - terminal-notifier (2.0.0) - terminal-table (1.4.5) - thor (0.19.1) - thread_safe (0.3.6) - tty-cursor (0.7.1) - tty-screen (0.8.1) - tty-spinner (0.9.3) - tty-cursor (~> 0.7) - typhoeus (1.4.0) - ethon (>= 0.9.0) - tzinfo (1.2.7) - thread_safe (~> 0.1) - uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.7) - word_wrap (1.0.0) - xcodeproj (1.18.0) - CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.3) - claide (>= 1.0.2, < 2.0) - colored2 (~> 3.1) - nanaimo (~> 0.3.0) - xcpretty (0.3.0) - rouge (~> 2.0.7) - xcpretty-travis-formatter (1.0.0) - xcpretty (~> 0.2, >= 0.0.7) - -PLATFORMS - ruby - -DEPENDENCIES - cocoapods - fastlane - fastlane-plugin-badge - fastlane-plugin-firebase_app_distribution - generamba! - -BUNDLED WITH - 2.1.4 diff --git a/sources/build_phases/check_pods_manifest.sh b/sources/build_phases/check_pods_manifest.sh new file mode 100755 index 0000000..3833e8c --- /dev/null +++ b/sources/build_phases/check_pods_manifest.sh @@ -0,0 +1,8 @@ +diff "${SRCROOT}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null +if [ $? != 0 ] ; then + # print error to STDERR + echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2 + exit 1 +fi +# This output is used by Xcode 'outputs' to avoid re-running this script phase. +echo "SUCCESS" > "${SCRIPT_OUTPUT_FILE_0}" \ No newline at end of file diff --git a/templates/Podfile.mustache b/templates/Podfile.mustache index 6a4cd21..5855b00 100755 --- a/templates/Podfile.mustache +++ b/templates/Podfile.mustache @@ -1,5 +1,5 @@ -source 'https://github.com/CocoaPods/Specs' -source 'https://github.com/TouchInstinct/Podspecs.git' +source 'https://cdn.cocoapods.org/' +source 'https://github.com/TouchInstinct/Podspecs' platform :ios, '{{deployment_target}}' @@ -22,7 +22,7 @@ target '{{project_name}}' do pod 'Firebase/Analytics' # for Firebase/Performance # Rx - pod 'RxKeyboard', '0.9.0' + pod 'RxKeyboard', '1.0.0' # Security pod 'KeychainAccess' @@ -36,9 +36,25 @@ target '{{project_name}}' do # UI pod 'TableKit' - pod 'StatefulViewController' end +# fixes Xcode 12 warnings: +# "The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99." +# see https://github.com/CocoaPods/CocoaPods/issues/9884 + +min_supported_deployment_target = Version.new(9.0) # as of Xcode 12 + +post_install do |pi| + pi.pods_project.targets.each do |target| + target.build_configurations.each do |config| + build_config_version = Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']) + max_deployment_target = [build_config_version, min_supported_deployment_target].max + + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = max_deployment_target.to_s + end + end +end + # If you have slow HDD ENV['COCOAPODS_DISABLE_STATS'] = "true" diff --git a/templates/project.mustache b/templates/project.mustache index 148116e..2afe451 100644 --- a/templates/project.mustache +++ b/templates/project.mustache @@ -74,46 +74,54 @@ targets: - path: {{project_name}}/Views buildPhase: sources - aggregateTargets: - CodeGen: - buildScripts: - - name: Localization - script: readonly PRODUCT_NAME="Resources" | +aggregateTargets: + CodeGen: + buildScripts: + - name: Localization + script: | + readonly PRODUCT_NAME="Resources" . build-scripts/xcode/build_phases/localization.sh - inputFiles: - - $(SRCROOT)/common/strings/default_common_strings_ru.json + inputFiles: + - $(SRCROOT)/common/strings/default_common_strings_ru.json - - name: API Generator - script: . build-scripts/xcode/build_phases/api_generator.sh 1.4.0-alpha3 Resources/Generated + - name: API Generator + script: . build-scripts/xcode/build_phases/api_generator.sh 1.4.0-alpha3 {{project_name}}/Generated - - name: License List - script: readonly PODS_ROOT="${SRCROOT}/Pods" | + - name: License List + script: | + readonly PODS_ROOT="${SRCROOT}/Pods" ${PODS_ROOT}/LicensePlist/license-plist --output-path Resources/LicenseList --prefix Licenses --suppress-opening-directory - CodeLint: - buildScripts: - - name: Check Pods Manifest.lock - script: "" - inputFiles: - - ${SRCROOT}/Podfile.lock - - ${PODS_ROOT}/Manifest.lock - outputFiles: - - $(DERIVED_FILE_DIR)/Pods-Ubrd-checkManifestLockResult.txt + CodeLint: + buildScripts: + - name: Check Pods Manifest.lock + script: | + readonly PODS_ROOT=${SRCROOT}/Pods + . $(SRCROOT)/build_phases/check_pods_manifest.sh + inputFiles: + - ${SRCROOT}/Podfile.lock + - ${PODS_ROOT}/Manifest.lock + outputFiles: + - $(DERIVED_FILE_DIR)/Pods-Ubrd-checkManifestLockResult.txt - - name: Swiftlint - script: readonly PODS_ROOT=${SRCROOT}/Pods | - readonly SCRIPT_DIR=${SRCROOT}/build-scripts/xcode/build_phases | + - name: Swiftlint + script: | + readonly PODS_ROOT=${SRCROOT}/Pods + readonly SCRIPT_DIR=${SRCROOT}/build-scripts/xcode/build_phases . ${SCRIPT_DIR}/swiftlint.sh - outputFileLists: - - $(SRCROOT)/build_phases/code_lint_folders.xcfilelist + inputFileLists: + - $(SRCROOT)/build_phases/code_lint_folders.xcfilelist + basedOnDependencyAnalysis: false - - name: CopyPaste Detection - script: readonly SCRIPT_DIR=${SRCROOT}/build-scripts/xcode/build_phases | + - name: CopyPaste Detection + script: | + readonly SCRIPT_DIR=${SRCROOT}/build-scripts/xcode/build_phases . build-scripts/xcode/build_phases/copy_paste_detection.sh Localization Generated Pods - inputFileLists: - - $(SRCROOT)/build_phases/code_lint_folders.xcfilelist + inputFileLists: + - $(SRCROOT)/build_phases/code_lint_folders.xcfilelist + basedOnDependencyAnalysis: false - UnusedDetection: - buildScripts: - - name: UnusedCode Detection - script: . build-scripts/xcode/build_phases/unused.sh + UnusedDetection: + buildScripts: + - name: UnusedCode Detection + script: . build-scripts/xcode/build_phases/unused.sh