Skip to content

Commit

Permalink
Migrate from Crayon to Chalk since project was renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
KKirsten authored and Przemyslaw-Wosko committed Mar 17, 2020
1 parent 668b0d0 commit da2c438
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 46 deletions.
18 changes: 9 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
}
},
{
"package": "Commander",
"repositoryURL": "https://github.com/kylef/Commander",
"package": "Chalk",
"repositoryURL": "https://github.com/luoxiu/Chalk",
"state": {
"branch": null,
"revision": "4b6133c3071d521489a80c38fb92d7983f19d438",
"version": "0.9.1"
"revision": "a705a6ddbb338d8f350b3903c3eae7fd41140168",
"version": "0.0.4"
}
},
{
"package": "Crayon",
"repositoryURL": "https://github.com/jianstm/Crayon",
"package": "Commander",
"repositoryURL": "https://github.com/kylef/Commander",
"state": {
"branch": null,
"revision": "05930604feec1ac77b4633a17a722d428d5be2cc",
"version": "0.0.3"
"revision": "4b6133c3071d521489a80c38fb92d7983f19d438",
"version": "0.9.1"
}
},
{
Expand All @@ -39,7 +39,7 @@
},
{
"package": "Rainbow",
"repositoryURL": "https://github.com/jianstm/Rainbow",
"repositoryURL": "https://github.com/luoxiu/Rainbow",
"state": {
"branch": null,
"revision": "177c6ebae4389c0363ea1bf62a7257151d53acbc",
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/JohnSundell/ShellOut.git", from: "2.0.0"),
.package(url: "https://github.com/tuist/xcodeproj.git", from: "7.1.0"),
.package(url: "https://github.com/jianstm/Crayon", from: "0.0.3"),
.package(url: "https://github.com/luoxiu/Chalk", from: "0.0.4"),
.package(url: "https://github.com/kylef/Commander", from: "0.8.0"),
.package(url: "https://github.com/kylef/PathKit", from: "1.0.0"),
.package(url: "https://github.com/jpsim/Yams.git", from: "2.0.0"),
Expand All @@ -34,7 +34,7 @@ let package = Package(
name: "SwiftyMockyCLICore",
dependencies: [
"ShellOut",
"Crayon",
"Chalk",
"XcodeProj",
"PathKit",
"Yams",
Expand All @@ -57,7 +57,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/JohnSundell/ShellOut.git", from: "2.0.0"),
.package(url: "https://github.com/jianstm/Crayon", from: "0.0.3"),
.package(url: "https://github.com/luoxiu/Chalk", from: "0.0.4"),
.package(url: "https://github.com/kylef/Commander", from: "0.8.0"),
.package(url: "https://github.com/kylef/PathKit", from: "1.0.0"),
.package(url: "https://github.com/jpsim/Yams.git", from: "2.0.0"),
Expand All @@ -76,7 +76,7 @@ let package = Package(
name: "SwiftyMockyCLICore",
dependencies: [
"ShellOut",
"Crayon",
"Chalk",
"PathKit",
"Yams",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ShellOut
import PathKit
import Commander
import Yams
import Crayon

public protocol GenerationCommand: AutoMockable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Yams
import PathKit
import Commander
import XcodeProj
import Crayon

// MARK: - Migration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Yams
import PathKit
import Commander
import XcodeProj
import Crayon
import Chalk

// MARK: - Project Setup

Expand Down Expand Up @@ -47,7 +47,7 @@ public class ProjectSetupController {
.forEach {
let exists = $1.mockName != nil
let prefix = "\(exists ? "":"☑️ ") \($0 + 1))"
let infix = "\(crayon.bold.on($1.name))"
let infix = "\(ck.bold.on($1.name))"
let suffix = exists ? " - already defined in \'\($1.mockName!)\'" : ""
Message.just("\(prefix) \(infix) \(suffix)")
}
Expand Down Expand Up @@ -119,19 +119,19 @@ public class ProjectSetupController {
Message.actionHeader("\(target.name) - adding Mock configuration...")
}

Message.infoPoint("Targets set to: \(crayon.bold.on(target.name))")
Message.infoPoint("Targets set to: \(ck.bold.on(target.name))")

let output = "./" + defaultOutput(for: target).string
Message.infoPoint("Default output set to: \(crayon.bold.on(output))")
Message.infoPoint("Default output set to: \(ck.bold.on(output))")

let sources = "./" + defaultSources(for: target).string
Message.infoPoint("Default sources directory: \(crayon.bold.on(sources))")
Message.infoPoint("Default sources directory: \(ck.bold.on(sources))")

let testable = defaultTestable(for: target)
Message.infoPoint("Default testable module: \(crayon.bold.on(testable.joined(separator: ",")))")
Message.infoPoint("Default testable module: \(ck.bold.on(testable.joined(separator: ",")))")

let imports = defaultImports(for: target)
Message.infoPoint("Default testable module: \(crayon.bold.on(imports.joined(separator: ",")))")
Message.infoPoint("Default testable module: \(ck.bold.on(imports.joined(separator: ",")))")

guard force || !mockfile.isSetup(target: target) else {
throw MockyError.overrideWarning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import Crayon
import Chalk

// MARK: - Setup policy

Expand Down Expand Up @@ -32,9 +32,9 @@ enum AddingOption: RawRepresentable, SelectableOption {
var title: String {
switch self {
case .only(let value):
return crayon.underline.on("\(value)") + ""
return ck.underline.on("\(value)") + ""
default:
return crayon.underline.on("\(rawValue.first!)".uppercased()) + "\(rawValue.dropFirst())"
return ck.underline.on("\(rawValue.first!)".uppercased()) + "\(rawValue.dropFirst())"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import Crayon
import Chalk

public enum BoolOption: RawRepresentable, SelectableOption {
public typealias RawValue = String
Expand All @@ -14,7 +14,7 @@ public enum BoolOption: RawRepresentable, SelectableOption {
}
}
public var title: String {
return crayon.underline.on("\(rawValue.first!)".uppercased()) + "\(rawValue.dropFirst())"
return ck.underline.on("\(rawValue.first!)".uppercased()) + "\(rawValue.dropFirst())"
}

public init?(rawValue: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import Crayon
import Chalk
import PathKit

public struct ProjectPathOption: RawRepresentable, SelectableOption {
Expand All @@ -10,7 +10,7 @@ public struct ProjectPathOption: RawRepresentable, SelectableOption {
public var rawValue: String
public var title: String {
if rawValue == ProjectPathOption.projects.first?.string {
let formatted = crayon.underline.on("\(Path(rawValue).lastComponentWithoutExtension)")
let formatted = ck.underline.on("\(Path(rawValue).lastComponentWithoutExtension)")
return "\(formatted)"
}
return Path(rawValue).lastComponentWithoutExtension
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Crayon

public protocol SelectableOption: RawRepresentable {
var title: String { get }
Expand Down
32 changes: 16 additions & 16 deletions Sources/SwiftyMockyCLICore/Utils/Message.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import Crayon
import Chalk

public enum Message {
public static var indentString = " "
Expand Down Expand Up @@ -40,45 +40,45 @@ public enum Message {
public static func header(_ message: String) {
empty()
count += 1
let styled = crayon.bold.on("\(count). \(message)")
let styled = ck.bold.on("\(count). \(message)")
just("\(styled)")
}

public static func subheader(_ message: String) {
let styled = crayon.bold.on(message)
let styled = ck.bold.on(message)
just("\(styled)")
}

public static func actionHeader(_ message: String) {
let styled = crayon.bold.bg(.darkGreen).whiteBright.on(message)
let styled = ck.bold.bg(.darkGreen).whiteBright.on(message)
just("\(styled)")
}

public static func infoPoint(_ message: String) {
let styled = crayon.bold.on(" -> \(message)")
let styled = ck.bold.on(" -> \(message)")
just("\(styled)")
}

public static func success(_ message: String) {
just("\(crayon.greenBright.on(message))")
just("\(ck.greenBright.on(message))")
}

public static func ok(_ message: String) {
let styled = crayon.greenBright.on(" + \(message)")
let styled = ck.greenBright.on(" + \(message)")
just("\(styled)")
}

public static func nok(_ message: String) {
let styled = crayon.red.on(" - \(message)")
let styled = ck.red.on(" - \(message)")
just("\(styled)")
}

public static func failure(_ message: String) {
just("\(crayon.bold.red.on(message))")
just("\(ck.bold.red.on(message))")
}

public static func warning(_ message: String) {
just("⚠️ \(crayon.bold.yellow.on(message))")
just("⚠️ \(ck.bold.yellow.on(message))")
}

public static func resolutions(_ messages: String..., title: String = "Possible solutions:") {
Expand All @@ -87,25 +87,25 @@ public enum Message {

public static func resolutions(array messages: [String], title: String = "Possible solutions:") {
indent()
just("\(crayon.underline.gray.on(title))")
just("\(ck.underline.gray.on(title))")
messages.forEach {
let styled = crayon.gray.on(" - \($0)")
let styled = ck.gray.on(" - \($0)")
just("\(styled)")
}
unindent()
}

public static func hint(_ message: String) {
just("\(crayon.underline.gray.on(message))")
just("\(ck.underline.gray.on(message))")
}

// MARK: - Misc

public static func swiftyMockyLabel(_ message: String) {
let bar = String(repeating: "", count: message.count + 2)
print(crayon.bold.on("\(bar)"))
print(crayon.bold.on("\(message)"))
print(crayon.bold.on("\(bar)"))
print(ck.bold.on("\(bar)"))
print(ck.bold.on("\(message)"))
print(ck.bold.on("\(bar)"))
print("")
}
}

0 comments on commit da2c438

Please sign in to comment.