diff --git a/Surf MVP Trainee Application.xctemplate/.gitkeep b/Surf MVP Trainee Application.xctemplate/.gitkeep new file mode 100644 index 0000000..18fa3f8 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/.gitkeep @@ -0,0 +1 @@ +Please leave this file in place, it is here to provide folder structure in version control. \ No newline at end of file diff --git a/Surf MVP Trainee Application.xctemplate/.swiftlint.yml b/Surf MVP Trainee Application.xctemplate/.swiftlint.yml new file mode 100644 index 0000000..a9998ec --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/.swiftlint.yml @@ -0,0 +1,134 @@ +whitelist_rules: + - attributes + - class_delegate_protocol + - closing_brace + - closure_end_indentation + - closure_parameter_position + - closure_spacing + - collection_alignment + - colon + - comma + - conditional_returns_on_newline + - control_statement + - convenience_type + - custom_rules + - cyclomatic_complexity + - discouraged_optional_boolean + - duplicate_imports + - empty_count + - empty_parameters + - empty_parentheses_with_trailing_closure + - empty_string + - explicit_init + - file_length + - first_where + - force_cast + - force_try + - force_unwrapping + - function_parameter_count + - implicit_getter + - implicitly_unwrapped_optional + - inert_defer + - large_tuple + - last_where + - leading_whitespace + - legacy_cggeometry_functions + - legacy_constant + - legacy_constructor + - legacy_hashing + - legacy_nsgeometry_functions + - line_length + - literal_expression_end_indentation + - mark + - multiline_arguments + - multiline_literal_brackets + - notification_center_detachment + - opening_brace + - operator_usage_whitespace + - redundant_discardable_let + - redundant_optional_initialization + - redundant_nil_coalescing + - redundant_void_return + - return_arrow_whitespace + - shorthand_operator + - statement_position + - syntactic_sugar + - todo + - toggle_bool + - trailing_comma + - trailing_newline + - trailing_semicolon + - trailing_whitespace + - unused_import + - unused_optional_binding + - unused_setter_value + - vertical_whitespace + - void_return + - weak_delegate + +disabled_rules: # rule identifiers to exclude from running + +opt_in_rules: # some rules are only opt-in + +excluded: # paths to ignore during linting. Takes precedence over `included`. + - fastlane + - Pods + - .bundle + +custom_rules: + image_name_initialization: # Disable UIImage init from name + included: ".*.swift" + name: "Image initialization" + regex: 'UIImage\(named:[^)]+\)' + message: "Use UIImage(assetName: ) instead" + severity: error + + realm_in_ui: + included: "Screens/.*.swift|Flows/.*.swift|User Stories/.*.swift" + name: "Realm can be used only in services" + regex: "Realm" + message: "Realm can be used only in serivces" + severity: error + + disclosure_of_view_details: + included: ".*ViewOutput.swift|.*ViewInput.swift" + name: "Details opening in View protocols" + regex: "cell|Cell|button|Button|Table|tableView" + message: "The disclosure of details the implementation should be avoided" + severity: error + + view_protocol_error: + included: ".*ViewOutput.swift|.*ViewInput.swift" + name: "Property in view protocol" + regex: " var " + message: "View protocol should contains only methods" + severity: error + + open_iboutlets: + included: ".*.swift" + name: "IBOutlet opening" + regex: "@IBOutlet ?(weak){0,1} var" + message: "IBOutlet should be private or fileprivate" + severity: error + + open_ibaction: + included: ".*.swift" + name: "IBAction opening" + regex: "@IBAction func" + message: "IBAction should be private or fileprivate" + severity: error + + mark_newlines: + included: ".*.swift" + name: "MARK newlines surrounding" + regex: '(([}{)\w \t]+\n{1}[ \t]*)(\/\/ MARK: - [\w ]*))|((\/\/ MARK: - [\w ]*)(\n{1}[ \t]*\w+))' + message: "Every MARK should be surrounded with 1 newline before and 1 after it" + severity: warning + +line_length: 120 + +file_length: + warning: 500 + error: 1200 + +reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit) diff --git a/Surf MVP Trainee Application.xctemplate/BaseParamsService.swift b/Surf MVP Trainee Application.xctemplate/BaseParamsService.swift new file mode 100644 index 0000000..17c0eaa --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/BaseParamsService.swift @@ -0,0 +1,116 @@ +// +// BaseParamsService.swift +// TestProject +// +// Created by Vladislav Krupenko on 16.03.2020. +// Copyright © 2020 Fixique. All rights reserved. +// + +import Foundation + +enum BaseParamsService { + + // MARK: - Keys + + private enum Keys { + static let token = "token" + static let bundleId = "bundleId" + static let debug = "debug" + static let version = "version" + static let build = "build" + static let imageSize = "imageSize" + static let timeZone = "timeZone" + static let sig = "sig" + } + + // MARK: - Properties + + static var baseURL: URL? { + // TODO: Необходимо заменить на метод, который будет получать версию приложения + let currentVersion = "1.2.3" + return URL(string: "\(ServiceConstants.baseUrl)/v\(currentVersion)") + } + + // MARK: - Internal Properties + + static func getBaseParameters(parameters: [String: Any]) -> [String: Any] { + // TODO: Заменить на получение токена из другого сервиса + let token = "" + + var extensionParameters = getExtensionParameters() + parameters.forEach { (k, v) in extensionParameters[k] = v} + + let keys = Array(extensionParameters.keys) + let sortedKeys = keys.sorted { $0.caseInsensitiveCompare($1) == ComparisonResult.orderedAscending } + let objects = sortedKeys.map { extensionParameters[$0] } + + var sortedParamsString = "" + for i in 0.. [String: Any] { + // TODO: Необходимо заменить на методы, которые будут возвращать значения из проекта + // Стоит спросить у ментора, какие текущие версии и билды поддерживаются сервером + // Также необходимо написать метод получения размера картинки + let version = "1.2.3" + let build = "123" + let imageSize = "1" + + let extensionParamters: [String: Any] = [ + // TODO: Необходимо получать токен от сервера, сохранять и получать его, если его нет, то стринга пустая + Keys.token: "", + Keys.bundleId: ServiceConstants.bundleId, + Keys.debug: "true", + Keys.version: version, + Keys.build: build, + Keys.imageSize: imageSize, + Keys.timeZone: getCurrentTimeZone() + ] + + return extensionParamters + } + + static func getCurrentTimeZone() -> String { + let timeZoneOffset = Double(NSTimeZone.system.secondsFromGMT()) / 3600.0 + var timeZoneString = String(format: "%ld", Int64(timeZoneOffset)) + + if timeZoneOffset > 0 { + timeZoneString = String(format: "+%ld", Int64(timeZoneOffset)) + } else if timeZoneOffset < 0 { + timeZoneString = String(format: "%ld", Int64(timeZoneOffset)) + } + + return timeZoneString + } + +} diff --git a/Surf MVP Trainee Application.xctemplate/Colors.swift b/Surf MVP Trainee Application.xctemplate/Colors.swift new file mode 100644 index 0000000..dedb7f9 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Colors.swift @@ -0,0 +1,6 @@ +// +// ___COPYRIGHT___ +// + +enum Colors { +} diff --git a/Surf MVP Trainee Application.xctemplate/Fonts.swift b/Surf MVP Trainee Application.xctemplate/Fonts.swift new file mode 100644 index 0000000..e69de29 diff --git a/Surf MVP Trainee Application.xctemplate/Gemfile b/Surf MVP Trainee Application.xctemplate/Gemfile new file mode 100644 index 0000000..7afde9e --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Gemfile @@ -0,0 +1,17 @@ +source "https://rubygems.org" + +# Ensure github repositories are fetched using HTTPS +git_source(:github) do |repo_name| + repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") + puts(repo_name) + "https://github.com/#{repo_name}.git" +end if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('2') + +gem "fastlane", "~> 2.137.0" +gem 'cocoapods', "1.7.3" +gem 'synx', "~> 0.2.1" +gem 'xcpretty', "0.3.0" +gem 'generamba', github: 'surfstudio/Generamba', branch: 'develop', :ref => '91957270f4bc0092305ce6dbf016be5259720d33' + +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/Surf MVP Trainee Application.xctemplate/Localizable.strings b/Surf MVP Trainee Application.xctemplate/Localizable.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Localizable.strings @@ -0,0 +1 @@ + diff --git a/Surf MVP Trainee Application.xctemplate/Main.storyboard b/Surf MVP Trainee Application.xctemplate/Main.storyboard new file mode 100644 index 0000000..3cb9d68 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Surf MVP Trainee Application.xctemplate/Makefile b/Surf MVP Trainee Application.xctemplate/Makefile new file mode 100644 index 0000000..39affda --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Makefile @@ -0,0 +1,97 @@ +init: + # Install bundler if not installed + if ! gem spec bundler > /dev/null 2>&1; then\ + echo "bundler gem is not installed! Run gem install bundler to install it";\ + -sudo gem install bundler -v "1.17.3";\ + fi + -bundle install --path .bundle + -bundle exec pod repo update + -bundle exec pod install + -bundle exec generamba template install + + # Install git hooks + mkdir -p .git/hooks + chmod +x commit-msg + ln -s -f ../../commit-msg .git/hooks/commit-msg + +## Used to build target. Usually, it is not called manually, it is necessary for the CI to work. +build: + bundle exec fastlane build clean:true + +## Used to create a new module. Example: make screen modName= +screen: + bundle exec generamba gen $(modName) surf_mvp_module + +## Run tests +test: + bundle exec fastlane tests + +## Convert groups to folders if needed and sort with alphabetic order +synx: + bundle exec synx --exclusion "___PACKAGENAME___/Non-iOS Resources" ___PACKAGENAME___.xcodeproj + +## Allows you to perfrom swiftlint autocorrect command. +format: + ./Pods/SwiftLint/swiftlint autocorrect --config .swiftlint.yml + +## Run SwiftLint check +lint: + ./Pods/SwiftLint/swiftlint lint --config .swiftlint.yml + +## Execute pod install command +pod: + -bundle exec pod install + +## Default configuration for beta command +config ?= debug + +## Create and uploads build to Fabric or AppStoreConnect +## - Parameter config: Configuration for build. +## - Allowed inputs: +## config=debug - sends debug build to Fabric +## config=rc - sends release build to AppStoreConnect +beta: +ifeq ($(config),debug) + bundle exec fastlane beta destination:$(config) +else ifeq ($(config),rc) + bundle exec fastlane release +else + @echo "No suitable command for" $(config) + exit 1; +endif + +## Prepare application for beta release - increment build numbers and set tags. +## Pass skip_push=true if you need to skip push to git +prepare_for_beta: + bundle exec fastlane prepare_for_beta type:debug skip_push:$(skip_push) + +## Prepare application for release - set rc tag. +## Pass include_beta=true if you need to call prepare_for_beta to make test and prod build too +## Pass skip_push=true if you need to skip push to git +prepare_for_release: + bundle exec fastlane prepare_for_release include_beta:$(include_beta) skip_push:$(skip_push) + +# COLORS +GREEN := $(shell tput -Txterm setaf 2) +YELLOW := $(shell tput -Txterm setaf 3) +WHITE := $(shell tput -Txterm setaf 7) +RESET := $(shell tput -Txterm sgr0) + + +TARGET_MAX_CHAR_NUM=20 +## Show help +help: + @echo '' + @echo 'Usage:' + @echo ' ${YELLOW}make${RESET} ${GREEN}${RESET}' + @echo '' + @echo 'Targets:' + @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) diff --git a/Surf MVP Trainee Application.xctemplate/README.md b/Surf MVP Trainee Application.xctemplate/README.md new file mode 100644 index 0000000..e2f3f22 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/README.md @@ -0,0 +1,13 @@ +# ___PACKAGENAME___ +Little description + +## Requirements +* iOS 10.0+ +* Xcode 9.0 + +## Before running +For install all dependencies you should open project folder in **Terminal** and call: `make init` + +## Module generation +Before generation you should open project folder in **Terminal** +* Screen generation: `make screen modName=[SCREEN_NAME]` \ No newline at end of file diff --git a/Surf MVP Trainee Application.xctemplate/Rambafile b/Surf MVP Trainee Application.xctemplate/Rambafile new file mode 100644 index 0000000..49373ec --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Rambafile @@ -0,0 +1,37 @@ +### Headers settings +company: ___ORGANIZATIONNAME___ + +### Xcode project settings +project_name: ___PACKAGENAME___ +xcodeproj_path: ___PACKAGENAME___.xcodeproj + +### Code generation settings section +# The main project target name +project_target: ___PACKAGENAME___ + +# The file path for new modules +project_file_path: ___PACKAGENAME___/User Stories + +# The Xcode group path to new modules +project_group_path: ___PACKAGENAME___/User Stories + +### Tests generation settings section +# The tests target name +test_target: ___PACKAGENAME___Tests + +# The file path for new tests +test_file_path: ___PACKAGENAME___Tests/Tests/User Stories + +# The Xcode group path to new tests +test_group_path: ___PACKAGENAME___Tests/Tests/User Stories + +### Dependencies settings section +podfile_path: Podfile + +### Catalogs +catalogs: +- 'https://github.com/surfstudio/generamba-templates' + +### Templates +templates: +- {name: surf_mvp_module} \ No newline at end of file diff --git a/Surf MVP Trainee Application.xctemplate/ServiceConstants.swift b/Surf MVP Trainee Application.xctemplate/ServiceConstants.swift new file mode 100644 index 0000000..f73dbd2 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/ServiceConstants.swift @@ -0,0 +1,14 @@ +// +// Copyright © 2020 Surf. All rights reserved. +// + +import Foundation + +enum ServiceConstants { + // TODO: Спроси у ментора или ищи в задаче + static let baseUrl = "https://google.com/" + // TODO: Необходимо запросить у ментора id бандла проекта + static let bundleId = "123456" + // TODO: Добавить приватный ключ. Запроси его у ментора + static let privateKey = "123456" +} diff --git a/Surf MVP Trainee Application.xctemplate/String.swift b/Surf MVP Trainee Application.xctemplate/String.swift new file mode 100644 index 0000000..93b2047 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/String.swift @@ -0,0 +1,32 @@ +// +// String.swift +// TestProject +// +// Created by Vladislav Krupenko on 16.03.2020. +// Copyright © 2020 Fixique. All rights reserved. +// + +import Foundation +import CommonCrypto + +// MARK: - MD5 + +extension String { + + func md5() -> String { + + let context = UnsafeMutablePointer.allocate(capacity: 1) + var digest: [UInt8] = Array(repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) + CC_MD5_Init(context) + CC_MD5_Update(context, self, CC_LONG(self.lengthOfBytes(using: String.Encoding.utf8))) + CC_MD5_Final(&digest, context) + context.deallocate() + var hexString = "" + for byte in digest { + hexString += String(format: "%02x", byte) + } + + return hexString + } + +} diff --git a/Surf MVP Trainee Application.xctemplate/Strings.swift b/Surf MVP Trainee Application.xctemplate/Strings.swift new file mode 100644 index 0000000..e69de29 diff --git a/Surf MVP Trainee Application.xctemplate/Support/ModuleTrasitionable.swift b/Surf MVP Trainee Application.xctemplate/Support/ModuleTrasitionable.swift new file mode 100644 index 0000000..5c437ce --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/Support/ModuleTrasitionable.swift @@ -0,0 +1,128 @@ +// +// ___COPYRIGHT___ +// + +import UIKit + +/// Base protocol for all views. If need to do custom transition then should +/// create new protocol, implement current and override desired method. +/// +/// Examples: +/// +/// 1. If screen A can be open from screnn B with custom transition +/// +/// ``` +/// protocol CustomModuleTransitionable: class, ModuleTransitionable { +/// } +/// +/// extension CustomModuleTransitionable { +/// func showModule(_ module: UIViewController) { +/// *do something custom to show B* +/// } +///} +/// ``` +/// +/// 2. If screen A can be open from screen B, C, D in different ways +/// +/// ``` +///protocol CustomModuleTransitionable: class, ModuleTransitionable { +/// func showModuleWithCustomTransitionFromB(_ module: UIViewController) +/// func showModuleWithCustomTransitionFromC(_ module: UIViewController) +/// func showModuleWithCustomTransitionFromD(_ module: UIViewController) +///} +/// +///extension CustomModuleTransitionable { +/// func showModuleWithCustomTransitionFromB(_ module: UIViewController) { +/// *do something custom to show from B* +/// } +/// func showModuleWithCustomTransitionFromC(_ module: UIViewController) { +/// *do something custom to show from С* +/// } +/// func showModuleWithCustomTransitionFromD(_ module: UIViewController) { +/// *do something custom to show from D* +/// } +///} +///``` +protocol ModuleTransitionable: class { + + /// Presents a view controller in a primary context. + /// + /// - Parameter module: Module that should be presented. + func showModule(_ module: UIViewController) + + /// Dismisses the view controller that was presented modally by the view controller. + /// + /// - Parameters: + /// - animated: Pass true to animate the transition. + /// - completion: The block to execute after the view controller is dismissed. + /// This block has no return value and takes no parameters. You may specify nil for this parameter. + func dismissView(animated: Bool, completion: (() -> Void)?) + + /// Presents the module modally. + /// + /// - Parameters: + /// - module: Module that should be presented. + /// - animated: Pass true to animate the transition. + /// - completion: The block to execute after the view controller is presnted. + /// This block has no return value and takes no parameters. You may specify nil for this parameter. + func presentModule(_ module: UIViewController, animated: Bool, completion: (() -> Void)?) + + /// Pops a top module from the navigation stack and updates the display. + /// + /// - Parameter animated: Pass true to animate the transition. + func pop(animated: Bool) + + /// Pops a root module from the navigation stack and updates the display. + /// + /// - Parameter animated: Pass true to animate the transition. + func popToRoot(animated: Bool) + + /// Pushes the module onto the receiver’s stack and updates the display. + /// + /// - Parameters: + /// - module: Module that should be presented. + /// - animated: Pass true to animate the transition. + func push(module: UIViewController, animated: Bool) + + /// Pushes the module onto the receiver’s stack and updates the display. + /// + /// - Parameters: + /// - module: Module that should be presented. + /// - animated: Pass true to animate the transition. + /// - hideTabBar: Pass true to hide a tab bar. + func push(module: UIViewController, animated: Bool, hideTabBar: Bool) + +} + +extension ModuleTransitionable where Self: UIViewController { + + func showModule(_ module: UIViewController) { + self.show(module, sender: nil) + } + + func dismissView(animated: Bool, completion: (() -> Void)?) { + self.dismiss(animated: animated, completion: completion) + } + + func presentModule(_ module: UIViewController, animated: Bool, completion: (() -> Void)?) { + self.present(module, animated: animated, completion: completion) + } + + func pop(animated: Bool) { + self.navigationController?.popViewController(animated: animated) + } + + func popToRoot(animated: Bool) { + self.navigationController?.popToRootViewController(animated: animated) + } + + func push(module: UIViewController, animated: Bool) { + self.navigationController?.pushViewController(module, animated: animated) + } + + func push(module: UIViewController, animated: Bool, hideTabBar: Bool = false) { + module.hidesBottomBarWhenPushed = hideTabBar + push(module: module, animated: animated) + } + +} diff --git a/Surf MVP Trainee Application.xctemplate/TemplateIcon.png b/Surf MVP Trainee Application.xctemplate/TemplateIcon.png new file mode 100644 index 0000000..08417a1 Binary files /dev/null and b/Surf MVP Trainee Application.xctemplate/TemplateIcon.png differ diff --git a/Surf MVP Trainee Application.xctemplate/TemplateIcon@2x.png b/Surf MVP Trainee Application.xctemplate/TemplateIcon@2x.png new file mode 100644 index 0000000..8234d64 Binary files /dev/null and b/Surf MVP Trainee Application.xctemplate/TemplateIcon@2x.png differ diff --git a/Surf MVP Trainee Application.xctemplate/TemplateInfo.plist b/Surf MVP Trainee Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..fd779d7 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,230 @@ + + + + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + Identifier + ru.surfstudio.dt.unit.SurfMVPTraineeApplication + Ancestors + + ru.surfstudio.dt.unit.surfApplicationBase + + Concrete + + Description + + Nodes + + Services/BaseParamsService.swift + User Stories/.gitkeep + Resources/Strings/Localizable.strings + Resources/Constants/ServiceConstants.swift + Resources/Images/Assets.swift + Resources/Fonts/Fonts.swift + Resources/Strings/Strings.swift + Resources/Colors/Colors.swift + ../swiftgen.yml + ../.swiftlint.yml + ../Makefile + ../Gemfile + ../commit-msg + ../Rambafile + ../README.md + Library/Protocols/ModuleTrasitionable.swift + Library/Extensions/String.swift + + Definitions + + Services/BaseParamsService.swift + + Group + + Services + + Path + BaseParamsService.swift + + User Stories/.gitkeep + + Group + User Stories + Path + ../.gitkeep + TargetIndices + + + Resources/Constants/ServiceConstants.swift + + Group + + Resources + Constants + + Path + ServiceConstants.swift + TargetIndices + + + Resources/Strings/Localizable.strings + + Group + + Resources + Strings + + Path + Localizable.strings + TargetIndices + + + Resources/Images/Assets.swift + + Group + + Resources + Images + + Path + Assets.swift + + Resources/Fonts/Fonts.swift + + Group + + Resources + Fonts + + Path + Fonts.swift + + Resources/Strings/Strings.swift + + Group + + Resources + Strings + + Path + Strings.swift + + Resources/Colors/Colors.swift + + Group + + Resources + Colors + + Path + Colors.swift + + ../swiftgen.yml + + Path + swiftgen.yml + Group + Non-iOS Resources + + ../.swiftlint.yml + + Path + .swiftlint.yml + Group + Non-iOS Resources + + ../Makefile + + TargetIndices + + Path + Makefile + Group + Non-iOS Resources + + ../Gemfile + + TargetIndices + + Path + Gemfile + Group + Non-iOS Resources + + ../commit-msg + + TargetIndices + + Path + commit-msg + Group + Non-iOS Resources + + ../Rambafile + + TargetIndices + + Path + Rambafile + Group + Non-iOS Resources + + ../README.md + + TargetIndices + + Path + README.md + Group + Non-iOS Resources + + Library/Protocols/ModuleTrasitionable.swift + + Group + + Library + Protocols + + Path + Support/ModuleTrasitionable.swift + + Library/Extensions/String.swift + + Group + + Library + Extensions + + Path + String.swift + + + Targets + + + BuildPhases + + + Class + ShellScript + Name + Swift Lint + ShellPath + /bin/sh + ShellScript + ${SRCROOT}/Pods/SwiftLint/swiftlint --config "${SRCROOT}/.swiftlint.yml" + + + Class + ShellScript + Name + Swift Gen + ShellPath + /bin/sh + ShellScript + ${SRCROOT}/Pods/SwiftGen/bin/swiftgen + + + + + + diff --git a/Surf MVP Trainee Application.xctemplate/commit-msg b/Surf MVP Trainee Application.xctemplate/commit-msg new file mode 100755 index 0000000..68761c1 --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/commit-msg @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# regex to validate in commit msg +commit_regex='([A-Z]{1,}-[0-9]{1,}\s.+|Merge.*|Version Bump.*)' +error_msg="Aborting commit. Your commit message is missing either a Jira Issue ('PROJ-99') or 'Merge'" + +if ! grep -iqE "$commit_regex" "$1"; then + echo "$error_msg" >&2 + exit 1 +fi \ No newline at end of file diff --git a/Surf MVP Trainee Application.xctemplate/swiftgen.yml b/Surf MVP Trainee Application.xctemplate/swiftgen.yml new file mode 100644 index 0000000..c00d95a --- /dev/null +++ b/Surf MVP Trainee Application.xctemplate/swiftgen.yml @@ -0,0 +1,20 @@ +xcassets: + inputs: + - ___PACKAGENAME___/Resources/Images/Assets.xcassets + outputs: + - templateName: swift4 + output: ___PACKAGENAME___/Resources/Images/Assets.swift + +fonts: + inputs: + - ___PACKAGENAME___/Resources/Fonts/ + outputs: + - templateName: swift4 + output: ___PACKAGENAME___/Resources/Fonts/Fonts.swift + +strings: + inputs: + - ___PACKAGENAME___/Resources/Strings/Localizable.strings + outputs: + - templateName: structured-swift4 + output: ___PACKAGENAME___/Resources/Strings/Strings.swift diff --git a/install.sh b/install.sh index 4e53448..0290400 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/bash -installDirectory=~/Library/Developer/Xcode/Templates/Project\ Templates/ +installDirectory=~/Library/Developer/Xcode/Templates/Project\ Templates/Source baseAppDirectory="${installDirectory}/Surf Base Application.xctemplate" testsDirectory="${installDirectory}/Surf Application Unit Test Base.xctemplate" @@ -9,5 +9,6 @@ cp -R "Surf Base Application.xctemplate" "${installDirectory}" cp -R "Surf MVP Application.xctemplate" "${installDirectory}" cp -R "Surf MVP and Coordinators Application.xctemplate" "${installDirectory}" cp -R "Surf Application Unit Test Base.xctemplate" "${installDirectory}" +cp -R "Surf MVP Trainee Application.xctemplate" "${installDirectory}" echo "Templates installed to ${installDirectory}"