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

Refactor #76

Merged
merged 5 commits into from
Oct 5, 2017
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
8 changes: 4 additions & 4 deletions Package.pins
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@
"package": "HeliumLogger",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/HeliumLogger.git",
"version": "1.7.0"
"version": "1.7.1"
},
{
"package": "Himotoki",
"reason": null,
"repositoryURL": "https://github.com/ikesyo/Himotoki.git",
"version": "3.0.1"
"version": "3.1.0"
},
{
"package": "LoggerAPI",
"reason": null,
"repositoryURL": "https://github.com/IBM-Swift/LoggerAPI.git",
"version": "1.7.0"
"version": "1.7.1"
},
{
"package": "Result",
"reason": null,
"repositoryURL": "https://github.com/antitypical/Result.git",
"version": "3.2.1"
"version": "3.2.4"
},
{
"package": "Spectre",
Expand Down
2 changes: 1 addition & 1 deletion Sources/LicensePlistCore/Consts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public struct Consts {
public static let prefix = "com.mono0926.LicensePlist"
public static let outputPath = "\(prefix).Output"
public static let configPath = "license_plist.yml"
public static let version = "1.4.5"
public static let version = "1.7.0"
public static let encoding = String.Encoding.utf8
}
2 changes: 1 addition & 1 deletion Sources/LicensePlistCore/Entity/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct Config {
owner: owner,
version: dictionary["version"]?.string)
}.flatMap { $0 } ?? []
self = Config(githubs: githubsVersion + gitHubList, manuals: manualList, excludes: excludes, renames: renames)
self = Config(githubs: githubsVersion + gitHubList, manuals: manualList, excludes: excludes, renames: renames)
}

init(githubs: [GitHub], manuals: [Manual], excludes: [String], renames: [String: String]) {
Expand Down
4 changes: 0 additions & 4 deletions Sources/LicensePlistCore/Entity/Manual.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,12 @@ extension Manual {
switch valuePair.key.string ?? "" {
case "source":
source = valuePair.value.string ?? ""
break
case "name":
name = valuePair.value.string ?? ""
break
case "version":
version = valuePair.value.string ?? ""
break
case "body":
body = valuePair.value.string ?? ""
break
default:
Log.warning("Tried to parse an unknown YAML key")
}
Expand Down
7 changes: 6 additions & 1 deletion Sources/LicensePlistCore/Entity/ManualLicense.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ public struct ManualLicense: License, Equatable {

extension ManualLicense: CustomStringConvertible {
public var description: String {
return "name: \(library.name), nameSpecified: \(library.nameSpecified ?? ""), version: \(library.version ?? "")\nbody: \(String(body.characters.prefix(20)))…"
return [["name: \(library.name)",
"nameSpecified: \(library.nameSpecified ?? "")",
"version: \(library.version ?? "")"]
.joined(separator: ", "),
"body: \(String(body.characters.prefix(20)))…"]
.joined(separator: "\n")
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GitHubAuthorization {

extension GitHubRequest {
var baseURL: URL { return URL(string: "https://api.github.com/")! }
var headerFields: [String : String] {
var headerFields: [String: String] {
var header = ["Accept": "application/vnd.github.drax-preview+json"]
if let token = GitHubAuthorization.shared.token {
header["Authorization"] = "Token \(token)"
Expand Down
7 changes: 5 additions & 2 deletions Tests/LicensePlistTests/Entity/ConfigTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class ConfigTests: XCTestCase {
XCTAssertEqual(Config(yaml: URL(string: path)!.lp.download().resultSync().value!),
Config(githubs: [GitHub(name: "LicensePlist", nameSpecified: "License Plist", owner: "mono0926", version: "1.2.0"),
GitHub(name: "NativePopup", nameSpecified: nil, owner: "mono0926", version: nil)],
manuals: [Manual(name: "WebRTC", source: "https://webrtc.googlesource.com/src", nameSpecified: "Web RTC", version: "M61")],
manuals: [Manual(name: "WebRTC",
source: "https://webrtc.googlesource.com/src",
nameSpecified: "Web RTC",
version: "M61")],
excludes: ["RxSwift", "ios-license-generator", "/^Core.*$/"],
renames: ["LicensePlist": "License Plist", "WebRTC": "Web RTC"]))
}
Expand Down Expand Up @@ -43,7 +46,7 @@ class ConfigTests: XCTestCase {
}

func testApply_githubs() {
let github1 = GitHub(name: "github1", nameSpecified: nil, owner: "g1", version: nil)
let github1 = GitHub(name: "github1", nameSpecified: nil, owner: "g1", version: nil)
let config = Config(githubs: [github1], manuals: [], excludes: ["lib2"], renames: [:])
let shouldBeIncluded = GitHub(name: "lib1", nameSpecified: nil, owner: "o1", version: nil)
let result = config.apply(githubs: [shouldBeIncluded, GitHub(name: "lib2", nameSpecified: nil, owner: "o2", version: nil)])
Expand Down
2 changes: 1 addition & 1 deletion Tests/LicensePlistTests/Entity/PlistInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class PlistInfoTests: XCTestCase {
target.compareWithLatestSummary()

XCTAssertEqual(target.summary,
"add-version-numbers: false\n\nLicensePlist Version: 1.4.5")
"add-version-numbers: false\n\nLicensePlist Version: 1.7.0")
XCTAssertNotNil(target.summaryPath)
}

Expand Down