Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenTiigi committed Sep 26, 2019
2 parents c6f3558 + 6216f68 commit 3038111
Show file tree
Hide file tree
Showing 47 changed files with 5,507 additions and 3,340 deletions.
4 changes: 3 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ excluded: # paths to ignore during linting. Takes precedence over `included`.

disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
- type_name
- type_name

function_body_length: 50
36 changes: 18 additions & 18 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/tadija/AEXML",
"state": {
"branch": null,
"revision": "54bb8ea6fb693dd3f92a89e5fcc19e199fdeedd0",
"version": "4.3.3"
"revision": "e4d517844dd03dac557e35d77a8e9ab438de91a6",
"version": "4.4.0"
}
},
{
Expand All @@ -33,8 +33,17 @@
"repositoryURL": "https://github.com/kylef/PathKit",
"state": {
"branch": null,
"revision": "e2f5be30e4c8f531c9c1e8765aa7b71c0a45d7a0",
"version": "0.9.2"
"revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511",
"version": "1.0.0"
}
},
{
"package": "Shell",
"repositoryURL": "https://github.com/tuist/Shell",
"state": {
"branch": null,
"revision": "d38121f89401db902b0d0bfc30b987e2c84c254e",
"version": "2.0.3"
}
},
{
Expand All @@ -51,26 +60,17 @@
"repositoryURL": "https://github.com/jakeheis/SwiftCLI.git",
"state": {
"branch": null,
"revision": "5318c37d3cacc8780f50b87a8840a6774320ebdf",
"version": "5.2.2"
}
},
{
"package": "SwiftShell",
"repositoryURL": "https://github.com/kareman/SwiftShell",
"state": {
"branch": null,
"revision": "beebe43c986d89ea5359ac3adcb42dac94e5e08a",
"version": "4.1.2"
"revision": "ba2268e67c07b9f9cfbc0801385e6238b36255eb",
"version": "5.3.2"
}
},
{
"package": "xcodeproj",
"package": "XcodeProj",
"repositoryURL": "https://github.com/tuist/xcodeproj.git",
"state": {
"branch": null,
"revision": "065f348754b6155b8037dc43876a8f2ee354b95d",
"version": "6.7.0"
"revision": "b951777f42e9acbfb8f19da623b43aaa604422f9",
"version": "7.0.0"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ let package = Package(
],
dependencies: [
// xcodeproj Dependency
.package(url: "https://github.com/tuist/xcodeproj.git", .exact("6.7.0")),
.package(url: "https://github.com/tuist/xcodeproj.git", .exact("7.0.0")),
// SwiftCLI Dependency
.package(url: "https://github.com/jakeheis/SwiftCLI.git", .exact("5.2.2")),
.package(url: "https://github.com/jakeheis/SwiftCLI.git", .exact("5.3.2")),
// Motor Dependency
.package(url: "https://github.com/flintbox/Motor.git", .exact("0.1.2"))
],
Expand All @@ -30,7 +30,7 @@ let package = Package(
.target(
name: "SwiftKit",
dependencies: [
"xcodeproj"
"XcodeProj"
]
),
// SwiftKitCLI Target
Expand Down
83 changes: 47 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<p align="center">
<a href="https://developer.apple.com/swift/">
<img src="https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat" alt="Swift 5.0">
<img src="https://img.shields.io/badge/Swift-5.1-orange.svg?style=flat" alt="Swift 5.1">
</a>
<a href="https://travis-ci.com/SvenTiigi/SwiftKit">
<img src="https://travis-ci.com/SvenTiigi/SwiftKit.svg?branch=master" alt="Build Status">
Expand Down Expand Up @@ -48,7 +48,7 @@ SwiftKit is inspired by <a href="https://github.com/JohnSundell/SwiftPlate">Swif
- [x] Fastlane already integrated for `tests` and `release`
- [x] `Jazzy` to generate documentation
- [x] `SwiftLint` Build-Phase integrated
- [x] `CI-Service` configuration templates included (Travis, GitLab, Azure Pipelines)
- [x] `CI-Service` configuration templates included (GitHub, Travis, GitLab, Azure Pipelines)
- [x] Automatically checks if the Kit name is already taken on `CocoaPods`
- [x] GitHub issue templates for `Bug reports` and `Feature requests`

Expand Down Expand Up @@ -164,7 +164,7 @@ $ fastlane ios compatibilityTests

#### release-lane

The `release` lane will allow you to automatically release a new version of your Kit for `Carthage`/`GitHub` and `CocoaPods`.
The `release` lane will allow you to automatically release a new version of your Kit.

```bash
$ fastlane ios release version:1.1.0
Expand All @@ -183,19 +183,55 @@ The lane verifies various aspects of your Kit.

> ☝️ Please ensure you have registered your machine with [`pod trunk register`](https://guides.cocoapods.org/making/getting-setup-with-trunk.html) in order to successfully push the Podspec to CocoaPods
<img style="float: right" align="right" width="100" src="https://raw.githubusercontent.com/SvenTiigi/SwiftKit/gh-pages/readMeAssets/markdown-logo.png" alt="Markdown Logo">

### ReadMe

A [`README.md`](https://github.com/SvenTiigi/SwiftKit/blob/master/Template/README.md) template will be automatically created inside your Kit. It contains default sections like `Example`, `Installation` and `Usage`. Please feel free to update the ReadMe to your needs.
<img style="float: right;" align="right" src="https://raw.githubusercontent.com/SvenTiigi/SwiftKit/gh-pages/readMeAssets/TemplateReadMe.png" width="30%" alt="Template ReadMe">

<p align="center">
<kbd><img src="https://raw.githubusercontent.com/SvenTiigi/SwiftKit/gh-pages/readMeAssets/TemplateReadMe.png" alt="Template ReadMe"></kbd>
</p>
A [`README.md`](https://github.com/SvenTiigi/SwiftKit/blob/master/Template/README.md) template file will be automatically created inside your Kit.

The README comes along with typical sections like:

<br/>

* Project description
* Example
* Installation
* Usage
* Contributing
* License

<br/>

Please feel free to update the ReadMe to your needs 👍

## Environment-Configuration

You can place a JSON environment configuration file in your home directory `~/.swiftkit-env.json` to provide default values for:

| Key | Description |
| ----------- | ----------- |
| `authorName` | The author name |
| `authorEmail` | The author email address |
| `organizationName` | The organization name |
| `organizationIdentifier` | The organization identifier |

SwiftKit will use those values and skip the corresponding CLI questions when running `swiftkit new`.

```json
{
"authorName": "Sven Tiigi",
"authorEmail": "[email protected]",
"organizationName": "Sven Tiigi",
"organizationIdentifier": "de.tiigi"
}
```
> Path: `~/.swiftkit-env.json`
The environment config values will only be used if no argument for the corresponding value is present.

## Arguments

SwiftKit supports arguments when launched. Following arguments are supported:
Beside using the CLI inputs SwiftKit supports arguments when launched. The following arguments are supported:

| Long parameter | Short parameter | Description
| ----------- | ----------- | -------------- |
Expand All @@ -205,7 +241,7 @@ SwiftKit supports arguments when launched. Following arguments are supported:
| `--name` | `-n` | Your name 👨‍💻 |
| `--email` | `-e` | Your email address 📫 |
| `--url` | `-u` | The repository url 🌎 |
| `--ci-service` | `-c` | The CI-Service 🛠 <br/> `1 = Travis CI - macOS only` <br/> `2 = Travis CI - macOS & Linux` <br/> `3 = GitLab CI` <br/> `4 = Azure Pipelines` |
| `--ci-service` | `-c` | The CI-Service 🛠 <br/> `1 = Travis CI - macOS only` <br/> `2 = Travis CI - macOS & Linux` <br/> `3 = GitLab CI` <br/> `4 = Azure Pipelines` <br/> `5 = GitHub CI` |
| `--organization` | `-o` | The name of your organization 🏢 |
| `--organization-identifier` | `-i` | The organization identifier 🖋 |
| `--repository` | `-r` | The SwiftKit template repository url 🌎 |
Expand Down Expand Up @@ -233,31 +269,6 @@ swiftkit new \
--open
```

## Environment-Configuration

You can place a JSON environment configuration file in your home directory `~/.swiftkit-env.json` to provide default values for:

| Key | Description |
| ----------- | ----------- |
| `authorName` | The author name |
| `authorEmail` | The author email address |
| `organizationName` | The organization name |
| `organizationIdentifier` | The organization identifier |

SwiftKit will use those values and skip the corresponding console question when running `swiftkit new`.

```json
{
"authorName": "Sven Tiigi",
"authorEmail": "[email protected]",
"organizationName": "Sven Tiigi",
"organizationIdentifier": "de.tiigi"
}
```
> Path: `~/.swiftkit-env.json`
The environment config values will only be used if no argument for the corresponding value is present.

## Featured on

* [Swift Weekly](http://digest.swiftweekly.com/issues/swift-weekly-issue-157-175911)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
// MARK: - DispatchQueueExecutableCocoaPodsService

/// The DispatchQueueExecutableCocoaPodsService
class DispatchQueueExecutableCocoaPodsService {
final class DispatchQueueExecutableCocoaPodsService {

// MARK: Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import Foundation
/// The ExecutableGitService
struct ExecutableGitService {

/// The SwiftKit URL
let swiftKitURL: String

/// The Executable
let executable: Executable

Expand All @@ -21,6 +24,14 @@ struct ExecutableGitService {

extension ExecutableGitService: GitService {

/// Initialize Git Repository
///
/// - Parameter repositoryPath: The repository path
/// - Throws: If initialization fails
func initialize(in repositoryPath: String) throws {
try self.executable.execute("cd \(repositoryPath) && git init")
}

/// Retrieve value for GitConfigKey
///
/// - Parameter key: The GitConfigKey
Expand Down Expand Up @@ -68,4 +79,34 @@ extension ExecutableGitService: GitService {
try self.executable.execute("git clone -b \(branch.name) \(url) '\(path)' -q")
}

/// Add Remote Origin URL
///
/// - Parameters:
/// - url: The origin URL
/// - repositoryPath: The repository path
/// - Throws: If adding failed
func addRemote(origin url: String, in repositoryPath: String) throws {
try self.executable.execute("cd \(repositoryPath) && git remote add origin \(repositoryPath)")
}

/// Stage all File in repository path
///
/// - Parameter repositoryPath: The repository path
/// - Throws: If staging fails
func stageAll(in repositoryPath: String) throws {
try self.executable.execute("cd \(repositoryPath) && git add .")
}

/// Commit with message
///
/// - Parameters:
/// - message: The commit message
/// - repositoryPath: The repository path
/// - Throws: If staging or committing fails
func commit(message: String, in repositoryPath: String) throws {
try self.executable.execute(
"cd \(repositoryPath) && git commit -m \"\(message)\" -m \"\(self.swiftKitURL)\""
)
}

}
28 changes: 28 additions & 0 deletions Sources/SwiftKit/InternalServices/GitService/GitService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import Foundation
/// The GitService
protocol GitService {

/// Initialize Git Repository
///
/// - Parameter repositoryPath: The repository path
/// - Throws: If initialization fails
func initialize(in repositoryPath: String) throws

/// Retrieve value for GitConfigKey
///
/// - Parameter key: The GitConfigKey
Expand Down Expand Up @@ -39,4 +45,26 @@ protocol GitService {
/// - Throws: If cloning fails
func clone(from url: String, to path: String, branch: GitBranch) throws

/// Add Remote Origin URL
///
/// - Parameters:
/// - url: The origin URL
/// - repositoryPath: The repository path
/// - Throws: If adding failed
func addRemote(origin url: String, in repositoryPath: String) throws

/// Stage all File in repository path
///
/// - Parameter repositoryPath: The repository path
/// - Throws: If staging fails
func stageAll(in repositoryPath: String) throws

/// Commit with message
///
/// - Parameters:
/// - message: The commit message
/// - repositoryPath: The repository path
/// - Throws: If staging or committing fails
func commit(message: String, in repositoryPath: String) throws

}
Loading

0 comments on commit 3038111

Please sign in to comment.