Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2018.10.03 #37

Merged
merged 16 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 14 additions & 2 deletions Sources/Ether/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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<Config, String?>] = [
"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
]

Expand Down
5 changes: 5 additions & 0 deletions Sources/Ether/New.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
5 changes: 3 additions & 2 deletions Sources/Ether/Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}

Expand Down
3 changes: 3 additions & 0 deletions Sources/Ether/Update.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Ether/Version/VersionLatest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Ether/Version/VersionSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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