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

QA sessions #146

Merged
merged 6 commits into from Mar 26, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/Component/NefRender/Render.swift
Expand Up @@ -96,7 +96,7 @@ public struct Render<A> {

return binding(
|<-env.console.print(information: "\t• Processing page \(info.data?.page.title ?? "content")"),
rendered <- env.nodePrinter(content).provide(info).mapError { _ in .content() },
rendered <- env.nodePrinter(content).provide(info).mapError { e in .content(info: e) },
yield: rendered.get)^.reportStatus(console: env.console)
}
}
Expand Down
6 changes: 3 additions & 3 deletions project/Component/nef/Instances/MacNefPlaygroundSystem.swift
Expand Up @@ -103,7 +103,7 @@ class MacNefPlaygroundSystem: NefPlaygroundSystem {
private func downloadTemplate(into output: URL) -> EnvIO<FileSystem, NefPlaygroundSystemError, URL> {
func downloadZip(into output: URL) -> EnvIO<FileSystem, NefPlaygroundSystemError, URL> {
EnvIO.invoke { _ in
let zip = output.appendingPathComponent("\(BuildConfiguration.templateName).zip")
let zip = output.appendingPathComponent("\(BuildConfiguration.templateVersion).zip")
let result = run("curl", args: ["-LkSs", Template.path, "-o", zip.path])
guard result.exitStatus == 0 else {
throw NefPlaygroundSystemError.template(info: result.stderr)
Expand All @@ -123,7 +123,7 @@ class MacNefPlaygroundSystem: NefPlaygroundSystem {
}

return EnvIO { fileSystem in
let templateName = "nef-\(BuildConfiguration.templateName)"
let templateName = "nef-\(BuildConfiguration.templateVersion)"
let unzipFolder = output.appendingPathComponent(templateName)

let cleamTemplateIO = fileSystem.removeDirectory(unzipFolder.path).handleError { _ in }
Expand Down Expand Up @@ -420,7 +420,7 @@ class MacNefPlaygroundSystem: NefPlaygroundSystem {

// MARK: - Constants
private enum Template {
static let path = "https://github.com/bow-swift/nef/archive/\(BuildConfiguration.templateName).zip"
static let path = "https://github.com/bow-swift/nef/archive/\(BuildConfiguration.templateVersion).zip"
}

private enum Bow {
Expand Down
4 changes: 2 additions & 2 deletions project/Component/nef/Utils/BuildConfiguration.swift
Expand Up @@ -3,6 +3,6 @@
import Foundation

internal enum BuildConfiguration {
static let buildVersion = "0.6.0"
static let templateName = "0.6.0"
static let buildVersion = "0.6.1"
static let templateVersion = "0.6.1"
}
17 changes: 15 additions & 2 deletions project/Core/Models/CoreRenderError.swift
Expand Up @@ -2,8 +2,21 @@

import Foundation

public enum CoreRenderError: Error {
public enum CoreRenderError: Error, Equatable {
case ast
case renderNode
case renderNode(String)
case renderEmpty
}

extension CoreRenderError: CustomStringConvertible {
public var description: String {
switch self {
case .ast:
return "Syntax analysis failed. Review all the begin/end delimiters are correct."
case .renderNode(let node):
return "Could not render node: \n\(node)\n"
case .renderEmpty:
return "Render result was empty. Review the page and nef hidden blocks."
}
}
}
2 changes: 1 addition & 1 deletion project/Core/Render/CoreCarbon.swift
Expand Up @@ -36,7 +36,7 @@ extension Node {
let code = nodes.map { $0.carbon() }.joined()
guard !code.isEmpty else { return IO.raiseError(.renderEmpty)^ }
let configuration = CarbonModel(code: code, style: style)
return downloader.carbon(configuration: configuration).mapError { _ in .renderNode }
return downloader.carbon(configuration: configuration).mapError { _ in .renderNode(code) }

default:
return IO.pure(Image.empty)^
Expand Down
@@ -1,5 +0,0 @@
// nef:begin:hidden
import UIKit

Nef.Playground.needsIndefiniteExecution(true)
// nef:end
@@ -1,5 +0,0 @@
// nef:begin:hidden
import UIKit

Nef.Playground.needsIndefiniteExecution(true)
// nef:end