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

Rename GitHubAuthorization class #64

Merged
merged 1 commit into from
Aug 6, 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
6 changes: 3 additions & 3 deletions Sources/LicensePlistCore/GitHubClient/GitHubRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import Himotoki

protocol GitHubRequest: Request {}

class GitHubAuthorizatoin {
class GitHubAuthorization {
private init() {}
static let shared = GitHubAuthorizatoin()
static let shared = GitHubAuthorization()
var token: String?
}

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
Expand Down
2 changes: 1 addition & 1 deletion Sources/LicensePlistCore/LicensePlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Tests/LicensePlistTests/TestUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down