aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock50
-rw-r--r--Cargo.toml14
-rw-r--r--TODOs.md16
-rw-r--r--src/cli/main.rs4
-rw-r--r--src/lib/lib.rs19
-rw-r--r--src/templates/commit.html (renamed from etc/gistatic/templates/html/commit.tmpl)0
-rw-r--r--src/templates/head.html (renamed from etc/gistatic/templates/html/head.html.tmpl)2
-rw-r--r--src/templates/header.html (renamed from etc/gistatic/templates/html/header.html.tmpl)0
-rw-r--r--src/templates/log.html (renamed from etc/gistatic/templates/html/log.html.tmpl)0
10 files changed, 102 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 87174b6..81df051 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/public/
+/target/
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..77103a3
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,50 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "gistatic"
+version = "0.1.0"
+dependencies = [
+ "mustache",
+]
+
+[[package]]
+name = "log"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
+dependencies = [
+ "log 0.4.14",
+]
+
+[[package]]
+name = "log"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "mustache"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5"
+dependencies = [
+ "log 0.3.9",
+ "serde",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.126"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..bc5875a
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "gistatic"
+version = "0.1.0"
+edition = "2018"
+
+[lib]
+path = "src/lib/lib.rs"
+
+[[bin]]
+name = "gistatic"
+path = "src/cli/main.rs"
+
+[dependencies]
+mustache = "*"
diff --git a/TODOs.md b/TODOs.md
index ae05dc6..21dda0a 100644
--- a/TODOs.md
+++ b/TODOs.md
@@ -7,7 +7,7 @@
- [ ] hierarquical tree view, per branch and per commit
- [ ] show notes in commit
-- [ ] `tarballs/` folder, with `.tar.gz`, `.tar.gz.sha256` and `.tar.gz.sig` files
+- [ ] `tarballs/` folder, with `.tar.xz` and `.tar.xz.asc` files
- [ ] generate tarballs for all tags and all branches
- [ ] SHA in log
- [ ] `.patch` files (with `git format-patch --stdout -1 $SHA`), raw view
@@ -33,12 +33,22 @@ Benchmark on (stagit):
# Decisions
-## TODO Perl vs C {#decision-d349b5be-3e00-4e00-a110-0eb7f402d4ab}
+## DONE Perl vs C {#decision-d349b5be-3e00-4e00-a110-0eb7f402d4ab}
+- DONE in 2021-05-28
- TODO in 2021-03-06
---
-FIXME
+Instead of Perl vs C, it became Perl vs Rust, and I've chosen Rust.
+
+I choose Rust over C because it is a higher-level language than C is.
+It allows me to produce binaries and libraries without extra dependencies (unlike C++'s `libstdc++`), and I can deal with memory management without reference counting (unlike Nim) or garbage collection (unlike D).
+
+I'm favoring Rust as a C-like tool because it allows me to write code that transcends the language barries: with C/Rust code, a `.so` library can be consumed by any programming language on any environment.
+The binary application that will be the CLI could be written in any language, also, but it is done so in Rust for convenience.
+
+So the question of Perl vs C now is becoming applicable only on more specific scenarios: when having a `libsomething.so` isn't worth anything.
+This isn't the case for this library.
# Resources
diff --git a/src/cli/main.rs b/src/cli/main.rs
new file mode 100644
index 0000000..cdb964d
--- /dev/null
+++ b/src/cli/main.rs
@@ -0,0 +1,4 @@
+pub fn main() {
+ println!("Hello, World!");
+ println!("a_fn(): {}", gistatic::a_fn());
+}
diff --git a/src/lib/lib.rs b/src/lib/lib.rs
new file mode 100644
index 0000000..311a11f
--- /dev/null
+++ b/src/lib/lib.rs
@@ -0,0 +1,19 @@
+const t: &'static str = include_str!("../templates/log.html");
+
+pub fn a_fn() -> i32 {
+ // println!("log.html.tmpl: {}", t);
+ let template = mustache::compile_str(t).unwrap();
+ let _data = mustache::MapBuilder::new()
+ .insert_str("name", "Venus")
+ .build();
+
+ let mut d2 = std::collections::HashMap::new();
+ d2.insert("a", "b");
+ template.render(&mut std::io::stdout(), &d2). unwrap();
+
+ 0
+}
+
+#[test]
+fn a_test() {
+}
diff --git a/etc/gistatic/templates/html/commit.tmpl b/src/templates/commit.html
index e69de29..e69de29 100644
--- a/etc/gistatic/templates/html/commit.tmpl
+++ b/src/templates/commit.html
diff --git a/etc/gistatic/templates/html/head.html.tmpl b/src/templates/head.html
index 7f036d5..e6988ec 100644
--- a/etc/gistatic/templates/html/head.html.tmpl
+++ b/src/templates/head.html
@@ -1,7 +1,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="icon" type="image/svg+xml" href="favicon.svg" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="alternate" type="application/atom+xml" title="{{ name }} atom feed of commits" href="commits.xml" />
<link rel="alternate" type="application/atom+xml" title="{{ name }} atom feed of tags" href="tags.xml" />
<link rel="stylesheet" type="text/css" href="style.css" />
diff --git a/etc/gistatic/templates/html/header.html.tmpl b/src/templates/header.html
index bbad31a..bbad31a 100644
--- a/etc/gistatic/templates/html/header.html.tmpl
+++ b/src/templates/header.html
diff --git a/etc/gistatic/templates/html/log.html.tmpl b/src/templates/log.html
index 7caa079..7caa079 100644
--- a/etc/gistatic/templates/html/log.html.tmpl
+++ b/src/templates/log.html