From ef83e50faeb9ec13f1d3e99904937d2f1c1ccb9b Mon Sep 17 00:00:00 2001 From: jpmartha Date: Sun, 6 Aug 2017 12:14:00 +0900 Subject: [PATCH] Rename GitHubAuthorization class --- Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift | 6 +++--- Sources/LicensePlistCore/LicensePlist.swift | 2 +- Tests/LicensePlistTests/TestUtil.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift b/Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift index 96d39777..9cf2ef68 100644 --- a/Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift +++ b/Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift @@ -4,9 +4,9 @@ import Himotoki protocol GitHubRequest: Request {} -class GitHubAuthorizatoin { +class GitHubAuthorization { private init() {} - static let shared = GitHubAuthorizatoin() + static let shared = GitHubAuthorization() var token: String? } @@ -14,7 +14,7 @@ extension GitHubRequest { var baseURL: URL { return URL(string: "https://api.github.com/")! } var headerFields: [String : String] { var header = ["Accept": "application/vnd.github.drax-preview+json"] - if let token = GitHubAuthorizatoin.shared.token { + if let token = GitHubAuthorization.shared.token { header["Authorization"] = "Token \(token)" } return header diff --git a/Sources/LicensePlistCore/LicensePlist.swift b/Sources/LicensePlistCore/LicensePlist.swift index 8b0731ae..80f4b9fd 100644 --- a/Sources/LicensePlistCore/LicensePlist.swift +++ b/Sources/LicensePlistCore/LicensePlist.swift @@ -7,7 +7,7 @@ public final class LicensePlist { public func process(options: Options) { Log.info("Start") - GitHubAuthorizatoin.shared.token = options.gitHubToken + GitHubAuthorization.shared.token = options.gitHubToken var info = PlistInfo(options: options) info.loadCocoaPodsLicense(acknowledgements: readPodsAcknowledgements(path: options.podsPath)) info.loadGitHubLibraries(cartfile: readCartfile(path: options.cartfilePath)) diff --git a/Tests/LicensePlistTests/TestUtil.swift b/Tests/LicensePlistTests/TestUtil.swift index ebc87f9d..851a8321 100644 --- a/Tests/LicensePlistTests/TestUtil.swift +++ b/Tests/LicensePlistTests/TestUtil.swift @@ -7,7 +7,7 @@ class TestUtil { // Specify your `github_token.txt` location let url = URL(fileURLWithPath: "/Users/mono/Git/Private/LicensePlist/Tests/LicensePlistTests/Resources/github_token.txt") do { - GitHubAuthorizatoin.shared.token = try String(contentsOf: url, + GitHubAuthorization.shared.token = try String(contentsOf: url, encoding: String.Encoding.utf8) } catch { Log.warning("\(url) not found. You can execute without github_token, but API limit will exceed sometimes.")