Skip to content

Commit

Permalink
almost finished
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-apprentice committed Apr 28, 2024
1 parent 0d8322b commit 0356260
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ route ?= ./lib
run: build execute

clean:
rm mkdocs.yml ci.yml
rm mkdocs.yml documentation.yml
rm -rf docs

build: $(route)/$(out_file).zig
Expand Down
31 changes: 17 additions & 14 deletions lib/my-docs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const docs_files: [2][]const u8 = [2][]const u8{
"index.md",
};
const mkdocs_yaml: *const [10:0]u8 = "mkdocs.yml";
const pipeline_yaml: *const [6:0]u8 = "documentation.yml";
const pipeline_yaml: *const [17:0]u8 = "documentation.yml";
const logo = [_][]const u8{
\\ ███▄ ▄███▓▓██ ██▓ ▓█████▄ ▒█████ ▄████▄ ██████
\\ ▓██▒▀█▀ ██▒ ▒██ ██▒ ▒██▀ ██▌▒██▒ ██▒▒██▀ ▀█ ▒██ ▒
Expand All @@ -20,8 +20,11 @@ const logo = [_][]const u8{
\\ ░ ░ ░ ░ ░ ░ ░ ░ ░
\\ ░ ░ ░ ░
};
const default_content = [_][]const u8{
\\
};
const mkdocs_conent = [_][]const u8{
\\ site_name: Ciber Inteligencia
\\ site_name: sample project
\\ theme:
\\ name: material
};
Expand Down Expand Up @@ -75,17 +78,12 @@ fn makeDir(cwd: fs.Dir) !void {
std.debug.print("Created folder: {s}\n", .{folderName});
}

fn writeContent(file: fs.File, content: []const u8) !void {
for (content) |line| {
try file.writeAll(line);
std.debug.print("{s}\n", .{line});
}
}

fn createFile(cwd: fs.Dir, fileName: []const u8, content: [1][]const u8) !void {
const file = try cwd.createFile(fileName, .{});
defer file.close();
try writeContent(file, content);
for (content) |line| {
try file.writeAll(line);
}
std.debug.print("Created file: {s}\n", .{fileName});
}

Expand All @@ -94,23 +92,27 @@ fn about(image: [1][]const u8) !void {
std.debug.print("{s}\n", .{line});
}
std.debug.print("{s}", .{"Made by jd-apprentice\n"});
try printLine();
std.debug.print("{s}", .{"REQUIREMENTS: \n"});
std.debug.print("{s}", .{"1. Have a custom domain\n"});
try printLine();
}

//--------- App ---------//
pub fn main() !void {
try about(logo);

const cwd = fs.cwd();
try createFile(cwd, mkdocs_yaml, &mkdocs_conent);
try createFile(cwd, pipeline_yaml, &pipeline_content);
try createFile(cwd, mkdocs_yaml, mkdocs_conent);
try createFile(cwd, pipeline_yaml, pipeline_content);

try makeDir(cwd);
var newDir: fs.Dir = try cwd.openDir("docs", .{});
defer newDir.close();
try newDir.setAsCwd();

for (&docs_files) |file| {
try createFile(cwd, file);
try createFile(cwd, file, default_content);
std.debug.print("Created file: {s}\n", .{file});
}

Expand All @@ -119,8 +121,9 @@ pub fn main() !void {
std.debug.print("Done! Now is time to: ", .{});
try printLine();

std.debug.print("1. Create a CNAME in your DNS resolver with <> \n", .{});
std.debug.print("1. Create a CNAME in your DNS manager with your custom domain \n", .{});
std.debug.print("2. Add the custom domain to GitHub Pages \n", .{});
std.debug.print("3. Update the CNAME file inside the docs folder with your custom domain \n", .{});
try printLine();
std.debug.print("You can create .md files in the docs folder and push to the repository\n", .{});
}

0 comments on commit 0356260

Please sign in to comment.