mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
Make everything else work on Linux
This commit is contained in:
parent
6a0db8febe
commit
b28b52d75d
5 changed files with 8 additions and 3 deletions
|
|
@ -72,7 +72,11 @@ final class JSONFeedWriter {
|
||||||
)
|
)
|
||||||
let encoder = JSONEncoder()
|
let encoder = JSONEncoder()
|
||||||
encoder.dateEncodingStrategy = .iso8601
|
encoder.dateEncodingStrategy = .iso8601
|
||||||
|
#if os(Linux)
|
||||||
|
encoder.outputFormatting = [.prettyPrinted]
|
||||||
|
#else
|
||||||
encoder.outputFormatting = [.prettyPrinted, .withoutEscapingSlashes]
|
encoder.outputFormatting = [.prettyPrinted, .withoutEscapingSlashes]
|
||||||
|
#endif
|
||||||
let feedJSON = try encoder.encode(feed)
|
let feedJSON = try encoder.encode(feed)
|
||||||
let feedURL = targetURL.appendingPathComponent(jsonFeed.path)
|
let feedURL = targetURL.appendingPathComponent(jsonFeed.path)
|
||||||
try feedJSON.write(to: feedURL, options: [.atomic])
|
try feedJSON.write(to: feedURL, options: [.atomic])
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ final class PostRepo {
|
||||||
return try fileManager.contentsOfDirectory(atPath: directory.path).flatMap { (filename: String) -> [URL] in
|
return try fileManager.contentsOfDirectory(atPath: directory.path).flatMap { (filename: String) -> [URL] in
|
||||||
let fileURL = directory.appendingPathComponent(filename)
|
let fileURL = directory.appendingPathComponent(filename)
|
||||||
var isDir: ObjCBool = false
|
var isDir: ObjCBool = false
|
||||||
fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
|
_ = fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
|
||||||
if isDir.boolValue {
|
if isDir.boolValue {
|
||||||
return try enumerateMarkdownFiles(directory: fileURL)
|
return try enumerateMarkdownFiles(directory: fileURL)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public final class SiteGenerator {
|
||||||
// Recurse into subdirectories, updating the target directory as well.
|
// Recurse into subdirectories, updating the target directory as well.
|
||||||
let fileURL = URL(fileURLWithPath: path).appendingPathComponent(filename)
|
let fileURL = URL(fileURLWithPath: path).appendingPathComponent(filename)
|
||||||
var isDir: ObjCBool = false
|
var isDir: ObjCBool = false
|
||||||
fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
|
_ = fileManager.fileExists(atPath: fileURL.path, isDirectory: &isDir)
|
||||||
guard !isDir.boolValue else {
|
guard !isDir.boolValue else {
|
||||||
try renderPath(fileURL.path, to: targetURL.appendingPathComponent(filename))
|
try renderPath(fileURL.path, to: targetURL.appendingPathComponent(filename))
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ $(uname) = "Linux" ]]; then
|
if [[ $(uname) = "Linux" ]]; then
|
||||||
build_platform_dir="x86_64-unknown-linux"
|
build_platform_dir="x86_64-unknown-linux"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Sami Samhuri on 2019-12-01.
|
// Created by Sami Samhuri on 2019-12-01.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Darwin
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import samhuri_net
|
import samhuri_net
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue