Skip to content

Commit

Permalink
feat: Bump to version v0.4.0
Browse files Browse the repository at this point in the history
Bump by 3 minor version to be on par with a private version of this template
  • Loading branch information
Alexander Weiß committed Nov 16, 2019
1 parent 95540bf commit 3b7fda5
Show file tree
Hide file tree
Showing 76 changed files with 1,215 additions and 200 deletions.
47 changes: 34 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# iOS-Starter

![version](https://img.shields.io/badge/version-v0.0.1-green)
![version](https://img.shields.io/badge/version-v0.4.0-green)

This is a template project for bootstrapping iOS applications.

> When Xcode 11 is released, this template will convert from CocoaPods to Swift Package Manager
This is a template project for boostrapping iOS applications

## Prequisites

Install [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/index.html) and [XcodeGen](https://github.com/yonaskolb/XcodeGen) in order to create a new project from this template:
Install [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/index.html),[XcodeGen](https://github.com/yonaskolb/XcodeGen) and [Mint](https://github.com/yonaskolb/Mint) in order to create a new project from this template:

```sh
brew install cookiecutter
brew install xcodegen
brew install mint
```

## Steps
## Use it


```sh
cookiecutter https://github.com/alexanderwe/ios-starter.git
````

- Run `cookiecutter https://github.com/alexanderwe/ios-starter.git`
- `cookiecutter` will prompt you for:
- The project name
- Apple Developer Team details
- other details
- other details necessary for the project
- `cookiecutter` will create all necessary files
- `XcodeGen` runs and automatically creates a `.xcodeproj` file
- Afterwards `pod install` will run to download all necessary dependencies
- Afterwards `mint bootstratp` will run to download all necessary build tools
- Finally `Xcode` will launch your new project
- Happy Coding ! 🤓
- All code dependencies are managed with the `Swift Package Manager`
- Happy Coding !

## Included external libraries

Expand All @@ -37,17 +41,34 @@ brew install xcodegen
- Helpers
- [Rswift](https://github.com/mac-cain13/R.swift) - Type safe access to string resources
- [SwiftDate](https://github.com/malcommac/SwiftDate) - Work with Dates is a breeze
- [IQKeyboardManager](https://github.com/hackiftekhar/IQKeyboardManager) - Handle common keyboard issues on iOS
- [IQKeyboardManager](https://github.com/hackiftekhar/IQKeyboardManager) - Handle common keyboard use cases on iOS

## Structure

The structure of the template project tries to follow the idea in [this article](https://theswiftdev.com/2016/07/06/conventions-for-xcode/) from `The.Swift.Dev`

External dependencies are managed via `Swift Package Manager`. Therefore it is mandatory to use **Xcode 11**.

### External build tools

External build tools like `swiftlint` and `R.swift` are managed by `Mint` This is necessary because the `Swift Package Manager` is not handling binaries, and therefore `Mint` is doing this job for us.

## Git Hooks

> There is an issue with `GitKraken` not supporting the `config.hooksPath` option. Therefore every hook is copied from the `.githooks` directory to `.git/hooks`. Before that every file that will be changed inside `.git/hooks` is backed up.

This template comes with a `.githooks` directory. Inside you can find and create hooks which will run in the local `.git` repository.

Available hooks:
### Available hooks:

- commit-msg (run before committing):
- Verifies that the commit message follows the standard [Conventional Commits](https://www.conventionalcommits.org) specification (+ one additional commit type `ci`)
- Verifies that the commit message follows the standard [Conventional Commits](https://www.conventionalcommits.org) specification

## Fastlane

The template uses [fastlane](https://fastlane.tools) for CI/CD. It comes with a nearly empty `Fastfile` which can be modified as you wish.

### Included Actions

* `create_changelog`: Use `git-chglog` and your conventional commits to automatically create a `CHANGELOG.md` in the project directory
* `crowdin`: Use the `crowdin` CLI to upload or download your localisation files
10 changes: 7 additions & 3 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"companyName": "CompanyName",
"bundleIdentifier": "com.example.{{cookiecutter.projectName|lower|replace(' ', '-')}}",
"deploymentTarget": "12.4",
"runCocoaPods": "y",
"runXcodeGen": "y"
}
"runMintBootstrap": "y",
"runXcodeGen": "y",
"gitRepository": "https://github.com/alexanderwe/ios-starter.git",
"_copy_without_render": [
"*.tpl.md"
]
}
18 changes: 13 additions & 5 deletions hooks/post_gen_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@
xcodegen
{%- endif %}

# Install cocoapods dependecies
{%- if cookiecutter.runCocoaPods == 'y' %}
pod install
# Install Mint dependecies
{%- if cookiecutter.runMintBootstrap == 'y' %}
mint bootstrap
{%- endif %}

# If xcodegen has generated a .xcodeproj file we want to open it
{%- if cookiecutter.runXcodeGen == 'y' %}
xed .
{%- endif %}


# Set up git
git init

## Configure git hooks
chmod +x ./.githooks/commit-msg
git config core.hooksPath .githooks

printf 'all done - enjoy 🤓'
## Patch for GitKraken not using hooks configured via `git config core.hooksPath`, see https://stackoverflow.com/questions/51698712/does-git-kraken-support-global-git-hooks
cp ./.git/hooks/commit-msg.sample ./.git/hooks/commit-msg.sample.backup
cp ./.githooks/commit-msg ./.git/hooks/commit-msg
cp ./.githooks/verify_conventional_commit ./.git/hooks/verify_conventional_commit

## Make initial commit
git add .
git commit -m "chore(initial): Initial commit"

printf 'all done - enjoy your new project 🤓'
56 changes: 56 additions & 0 deletions {{cookiecutter.projectDirectory}}/.chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Author.Name}} - ({{ .Hash.Short }}): {{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{else}}**Misc:** {{ end }}{{ .Author.Name}} - ({{ .Hash.Short }}): {{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
30 changes: 30 additions & 0 deletions {{cookiecutter.projectDirectory}}/.chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: {{cookiecutter.gitRepository}}
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
group_by: Type
sort_by: Date
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
4 changes: 2 additions & 2 deletions {{cookiecutter.projectDirectory}}/.githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

# Directory of the hooks
hookDir=$(dirname $0)
hookDir=$(dirname "$0")

# Specify the hooks you want to run during
# the commit-msg process:
$hookDir/verify_conventional_commit "$1"
"$hookDir"/verify_conventional_commit "$1"
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
import re, sys, os

def main():
# example:
# feat(apikey): added the ability to add api key to configuration
# examples:
# feat(login): added the ability to log in, into the application
# feat(login/XXX-123): Login button implementation
# fix(XXX-123): Fix bug in login mechanism
# chore: Add file
try:
pattern = r'(fix|feat|chore|docs|style|refactor|perf|test|ci)(\([\w\-]+\))?:\s.*'
pattern = r'(feat|fix|docs|style|refactor|perf|test|chore|revert)(\(\S+\))?:\s.*'
filename = sys.argv[1]
ss = open(filename, 'r').read()
m = re.match(pattern, ss)
if m == None:
raise Exception("conventional commit validation failed")
except Exception as e:
print(e)
print("Examples: \nfeat(login): added the ability to log in\nfeat(login/XXX-123): Login button implementation\nfix(XXX-123): Fix bug in login mechanism\nchore: Add file")
exit(1)

if __name__ == "__main__":
Expand Down
9 changes: 0 additions & 9 deletions {{cookiecutter.projectDirectory}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ fastlane/test_output

iOSInjectionProject/

### SwiftPackageManager ###
Packages
xcuserdata
*.xcodeproj


### SwiftPM ###


### Xcode ###
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.projectDirectory}}/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ opt_in_rules: # some rules are only opt-in
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- "iOSApplication/Sources/Generated/R.generated.swift"

file_header:
required_pattern: |
Expand Down
3 changes: 3 additions & 0 deletions {{cookiecutter.projectDirectory}}/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org' do
gem 'fastlane', "2.135.0"
end
2 changes: 2 additions & 0 deletions {{cookiecutter.projectDirectory}}/Mintfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
realm/[email protected]
https://github.com/mac-cain13/[email protected]
31 changes: 0 additions & 31 deletions {{cookiecutter.projectDirectory}}/Podfile

This file was deleted.

8 changes: 4 additions & 4 deletions {{cookiecutter.projectDirectory}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Fill the README
- Initially build the project
- Add `R.generated.swift` from `Sources` to the project and untick `Copy items if needed`
- Add `R.generated.swift` from `iOSApplication/Sources/Generated` to the project and untick `Copy items if needed`
- Delete this TODO section. (And enjoy your fresh and clean Project-setup 🙌)

---
Expand All @@ -13,7 +13,7 @@

---

⚡️ Swift: x.x 📱 iOS {{cookiecutter.deploymentTarget}}
⚡️ Swift: 5.1 📱 iOS {{cookiecutter.deploymentTarget}}

---

Expand All @@ -29,6 +29,6 @@ TODO

Where do I find API docs, wireframes, etc.?

## Bitrise
## CI/CD

Is Bitrise CI setup?
Is Bamboo set up ?
27 changes: 27 additions & 0 deletions {{cookiecutter.projectDirectory}}/fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Run tests
lane :tests do
desc "Build and test application"

run_tests(project: "{{cookiecutter.projectName}}.xcodeproj",
devices: ["iPhone 11"],
scheme: "iOSApplicationTests")
end

# Beta deployment to testflight
lane :beta do
desc "Build, test and upload a new build to TestFlight"

rescue => exception
on_error(exception)
end

end

# Release deployment to App Store
lane :release do

end


def on_error(exception)
end
Loading

0 comments on commit 3b7fda5

Please sign in to comment.