mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-07-01 05:26:07 +00:00
WIP
This commit is contained in:
parent
960840895e
commit
72d6eebab8
@ -29,8 +29,8 @@
|
||||
.path = "../pg.zig",
|
||||
},
|
||||
.httpz = .{
|
||||
.url = "https://github.com/karlseguin/http.zig/archive/46753ab508a86d0eb510510fc2ed6940a1ebf20a.tar.gz",
|
||||
.hash = "12207dbe64a04fb960156cbc990153cb3637a08e3fe23077c7199621b5c6377f5d20",
|
||||
.url = "https://github.com/karlseguin/http.zig/archive/a691d731047e9a5a79d71ac594cb8f5fad1d0705.tar.gz",
|
||||
.hash = "122072c92285c8c44055eb45058b834d1e7ecd46a5704d58a207103c39fb5922b8f5",
|
||||
},
|
||||
.smtp_client = .{
|
||||
.url = "https://github.com/karlseguin/smtp_client.zig/archive/5163c66cc42cdd93176a6b1cad45f3db3a291a6a.tar.gz",
|
||||
|
@ -87,8 +87,10 @@ pub fn run(
|
||||
|
||||
_ = cwd.createFile("src/routes.zig", .{}) catch {};
|
||||
var exe_path = try util.locateExecutable(allocator, cwd, .{});
|
||||
const stat = try std.fs.cwd().statFile(exe_path.?);
|
||||
var mtime = stat.mtime;
|
||||
var mtime = if (exe_path) |path| blk: {
|
||||
const stat = try std.fs.cwd().statFile(path);
|
||||
break :blk stat.mtime;
|
||||
} else 0;
|
||||
|
||||
util.runCommandInDir(
|
||||
allocator,
|
||||
|
14
cli/util.zig
14
cli/util.zig
@ -189,16 +189,16 @@ pub fn runCommandInDir(allocator: std.mem.Allocator, argv: []const []const u8, d
|
||||
}
|
||||
child.cwd = cwd_path;
|
||||
|
||||
var stdout = std.ArrayList(u8).init(allocator);
|
||||
var stderr = std.ArrayList(u8).init(allocator);
|
||||
var stdout = try std.ArrayListUnmanaged(u8).initCapacity(allocator, 0);
|
||||
var stderr = try std.ArrayListUnmanaged(u8).initCapacity(allocator, 0);
|
||||
errdefer {
|
||||
stdout.deinit();
|
||||
stderr.deinit();
|
||||
stdout.deinit(allocator);
|
||||
stderr.deinit(allocator);
|
||||
}
|
||||
|
||||
try child.spawn();
|
||||
switch (options.output) {
|
||||
.capture => try child.collectOutput(&stdout, &stderr, 50 * 1024),
|
||||
.capture => try child.collectOutput(allocator, &stdout, &stderr, 50 * 1024),
|
||||
.stream => {},
|
||||
}
|
||||
|
||||
@ -206,8 +206,8 @@ pub fn runCommandInDir(allocator: std.mem.Allocator, argv: []const []const u8, d
|
||||
|
||||
const result = std.process.Child.RunResult{
|
||||
.term = try child.wait(),
|
||||
.stdout = try stdout.toOwnedSlice(),
|
||||
.stderr = try stderr.toOwnedSlice(),
|
||||
.stdout = try stdout.toOwnedSlice(allocator),
|
||||
.stderr = try stderr.toOwnedSlice(allocator),
|
||||
};
|
||||
defer allocator.free(result.stdout);
|
||||
defer allocator.free(result.stderr);
|
||||
|
@ -6,6 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="/prism.css" />
|
||||
<meta http-equiv="refresh" content="1" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -12,7 +12,6 @@ pub fn index(request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
||||
try root.put("imported_number", importedFunction(100, 200, 300));
|
||||
|
||||
try request.response.headers.append("x-example-header", "example header value");
|
||||
try root.put("foobar", "LESS");
|
||||
try request.server.logger.INFO("data", .{});
|
||||
|
||||
return request.render(.ok);
|
||||
|
@ -1,29 +1,9 @@
|
||||
<div class="text-center pt-10 m-auto">
|
||||
<h1>HELLO</h1>
|
||||
<h1>HI THERE</h1>
|
||||
<h1>BOOP</h1>
|
||||
<h1>BLAP</h1>
|
||||
<h1>BLAPPPPP</h1>
|
||||
<h1>CAHCHACA</h1>
|
||||
<h1>YAY</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>SPEED</h1>
|
||||
<h1>NO</h1>
|
||||
|
||||
{{$.foobar}}
|
||||
<div><img class="p-3 mx-auto" src="/jetzig.png" /></div>
|
||||
|
||||
<!-- Renders `src/app/views/root/_quotes.zmpl`: -->
|
||||
<div>
|
||||
@partial root/quotes(message: .message)
|
||||
@partial root/quotes(message: $.message)
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user