diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dbf212..76e6e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [2018.10.03] + +### Added +- `new-commit` configuration for auto committing when a new project is generated. +- `update-commit` configuration for auto committing when a project's packages are updated. +- `version-latest-commit` configuration for auto committing when a project's dependencies are all updated to their latest versions. +- `version-set-commit` configuration for auto committing when a project's dependency's version is updated. + +### Fixed +- JSON key used to get license info during package search + ## [2018.09.08] ### Added diff --git a/Sources/Ether/Configuration.swift b/Sources/Ether/Configuration.swift index 4bd4320..b54f42a 100644 --- a/Sources/Ether/Configuration.swift +++ b/Sources/Ether/Configuration.swift @@ -32,9 +32,13 @@ public class Configuration: Command { CommandArgument.argument(name: "key", help: [ "The configuration JSON key to set", "Valid keys are:", - "- access-token: The GitHub access token to use for interacting the the GraphQL API. You can create on at https://github.com/settings/token", + "- access-token: The GitHub access token to use for interacting the the GraphQL API. You can create one at https://github.com/settings/token", "- install-commit: The commit message to use on package install. Use '&0' as package name placeholder", - "- remove-commit: The commit message to use on when a package is removed. Use '&0' as package name placeholder", + "- remove-commit: The commit message to use when a package is removed. Use '&0' as package name placeholder", + "- new-commit: The commit message to use when a new project is generated. Use '&0' as the project name placeholder", + "- update-commit: The commit message to use when a project's packages are updated", + "- version-latest-commit: The commit message to use when you update a project's dependencies to their latest versions", + "- version-set-commit: The commit message to use when you set a project's dependency to a specific version. Use '&0' as the package name and '&1' as the package's new version placeholders", "- signed-commits: If set to a truthy value (true, yes, y, 1), auto-commits will pass in the '-S' flag" ]), CommandArgument.argument(name: "value", help: ["The new value for the key passed in. If no value is passed in, the key will be removed from the config"]) @@ -112,12 +116,20 @@ public struct Config: Codable, Reflectable { public var accessToken: String? public var installCommit: String? public var removeCommit: String? + public var newCommit: String? + public var updateCommit: String? + public var latestVersionCommit: String? + public var versionSetCommit: String? public var signedCommits: String? static let properties: [String: WritableKeyPath] = [ "access-token": \.accessToken, "install-commit": \.installCommit, "remove-commit": \.removeCommit, + "new-commit": \.newCommit, + "update-commit": \.updateCommit, + "version-latest-commit": \.latestVersionCommit, + "version-set-commit": \.versionSetCommit, "signed-commits": \.signedCommits ] diff --git a/Sources/Ether/New.swift b/Sources/Ether/New.swift index c258686..a5e4557 100644 --- a/Sources/Ether/New.swift +++ b/Sources/Ether/New.swift @@ -51,6 +51,11 @@ public final class New: Command { } newProject.succeed() + + let config = try Configuration.get() + let name = try context.argument("name") + try config.commit(with: config.newCommit, on: context, replacements: [name]) + return context.container.future() } diff --git a/Sources/Ether/Search.swift b/Sources/Ether/Search.swift index 8ffc49d..6d4da6b 100644 --- a/Sources/Ether/Search.swift +++ b/Sources/Ether/Search.swift @@ -70,7 +70,7 @@ public final class Search: Command { struct PackageDescription: Codable { let nameWithOwner: String let description: String? - let license: String? + let licenseInfo: String? let stargazers: Int? func print(on context: CommandContext) { @@ -81,7 +81,8 @@ struct PackageDescription: Codable { context.console.info(self.nameWithOwner) } - if let license = self.license { + if let licenseInfo = self.licenseInfo { + let license = licenseInfo == "NOASSERTION" ? "Unknown" : licenseInfo context.console.print("License: " + license) } diff --git a/Sources/Ether/Update.swift b/Sources/Ether/Update.swift index bf5b3c0..2f5b653 100644 --- a/Sources/Ether/Update.swift +++ b/Sources/Ether/Update.swift @@ -54,6 +54,9 @@ public final class Update: Command { updating.succeed() + let config = try Configuration.get() + try config.commit(with: config.updateCommit, on: context, replacements: []) + if context.options["xcode"] != nil { let xcode = context.console.loadingBar(title: "Generating Xcode Project") _ = xcode.start(on: context.container) diff --git a/Sources/Ether/Version/VersionLatest.swift b/Sources/Ether/Version/VersionLatest.swift index 0c761bf..cbc6823 100644 --- a/Sources/Ether/Version/VersionLatest.swift +++ b/Sources/Ether/Version/VersionLatest.swift @@ -78,6 +78,9 @@ public final class VersionLatest: Command { _ = try Process.execute("swift", "package", "update") updating.succeed() + let config = try Configuration.get() + try config.commit(with: config.latestVersionCommit, on: context, replacements: []) + if let _ = context.options["xcode"] { let xcodeBar = context.console.loadingBar(title: "Generating Xcode Project") _ = xcodeBar.start(on: context.container) diff --git a/Sources/Ether/Version/VersionSet.swift b/Sources/Ether/Version/VersionSet.swift index b846420..eef2c65 100644 --- a/Sources/Ether/Version/VersionSet.swift +++ b/Sources/Ether/Version/VersionSet.swift @@ -64,6 +64,9 @@ public final class VersionSet: Command { _ = try Process.execute("swift", "package", "update") updating.succeed() + let config = try Configuration.get() + try config.commit(with: config.versionSetCommit, on: context, replacements: [package, version]) + if let _ = context.options["xcode"] { let xcodeBar = context.console.loadingBar(title: "Generating Xcode Project") _ = xcodeBar.start(on: context.container) diff --git a/publish.sh b/publish.sh index 2b9db7d..90de0ea 100644 --- a/publish.sh +++ b/publish.sh @@ -66,8 +66,9 @@ git add . git commit -S -m "Updated Ether version to $TAG" git push origin master cd ../ - rm -rf homebrew-tap + +cd Ether/ rm -rf macOS-sierra.tar.gz rm -rf $PACKAGE_NAME rm install