From a29bca499f766e112b56b717e920b6b438cfd361 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 16 May 2024 15:38:59 -0700 Subject: [PATCH] Switch to using data/ for submodule information Signed-off-by: Danila Fedorin --- config-gen.toml | 17 ----------------- data/submodules.json | 7 +++++++ submodule-links.rb | 13 ++++++------- themes/vanilla | 2 +- 4 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 config-gen.toml create mode 100644 data/submodules.json diff --git a/config-gen.toml b/config-gen.toml deleted file mode 100644 index c40bef1..0000000 --- a/config-gen.toml +++ /dev/null @@ -1,17 +0,0 @@ -[params] - [params.submoduleLinks] - [params.submoduleLinks.agdaspa] - url = "https://dev.danilafe.com/DanilaFe/agda-spa/src/commit/f0da9a902005b24db4e03a89c2862493735467c4" - path = "agda-spa" - [params.submoduleLinks.aoc2020] - url = "https://dev.danilafe.com/Advent-of-Code/AdventOfCode-2020/src/commit/7a8503c3fe1aa7e624e4d8672aa9b56d24b4ba82" - path = "aoc-2020" - [params.submoduleLinks.blogstaticflake] - url = "https://dev.danilafe.com/Nix-Configs/blog-static-flake/src/commit/67b47d9c298e7476c2ca211aac5c5fd961637b7b" - path = "blog-static-flake" - [params.submoduleLinks.compiler] - url = "https://dev.danilafe.com/DanilaFe/bloglang/src/commit/137455b0f4365ba3fd11c45ce49781cdbe829ec3" - path = "compiler" - [params.submoduleLinks.serverconfig] - url = "https://dev.danilafe.com/Nix-Configs/server-config/src/commit/98cffe09546aee1678f7baebdea5eb5fef288935" - path = "server-config" diff --git a/data/submodules.json b/data/submodules.json new file mode 100644 index 0000000..bb8736d --- /dev/null +++ b/data/submodules.json @@ -0,0 +1,7 @@ +{ + "agda-spa": "https://dev.danilafe.com/DanilaFe/agda-spa/src/commit/f0da9a902005b24db4e03a89c2862493735467c4", + "aoc-2020": "https://dev.danilafe.com/Advent-of-Code/AdventOfCode-2020/src/commit/7a8503c3fe1aa7e624e4d8672aa9b56d24b4ba82", + "blog-static-flake": "https://dev.danilafe.com/Nix-Configs/blog-static-flake/src/commit/67b47d9c298e7476c2ca211aac5c5fd961637b7b", + "compiler": "https://dev.danilafe.com/DanilaFe/bloglang/src/commit/137455b0f4365ba3fd11c45ce49781cdbe829ec3", + "server-config": "https://dev.danilafe.com/Nix-Configs/server-config/src/commit/98cffe09546aee1678f7baebdea5eb5fef288935" +} diff --git a/submodule-links.rb b/submodule-links.rb index 4e958ef..e5587db 100644 --- a/submodule-links.rb +++ b/submodule-links.rb @@ -1,12 +1,10 @@ -puts "[params]" -puts " [params.submoduleLinks]" +require "json" def each_submodule(base_path) `cd #{base_path} && git submodule status`.lines do |line| hash, path = line[1..].split " " full_path = "#{base_path}/#{path}" url = `git config --file #{base_path}/.gitmodules --get 'submodule.#{path}.url'`.chomp.delete_suffix(".git") - safe_name = full_path.gsub(/\/|-|_\./, "") if url =~ /dev.danilafe.com/ file_url = "#{url}/src/commit/#{hash}" @@ -14,14 +12,15 @@ def each_submodule(base_path) raise "Submodule URL #{url.dump} not in a known format!" end - yield ({ :path => full_path, :url => file_url, :name => safe_name }) + yield ({ :path => full_path, :url => file_url }) each_submodule(full_path) { |m| yield m } end end +hash = {} each_submodule(".") do |m| next unless m[:path].start_with? "./code/" - puts " [params.submoduleLinks.#{m[:name].delete_prefix(".code")}]" - puts " url = #{m[:url].dump}" - puts " path = #{m[:path].delete_prefix("./code/").dump}" + hash[m[:path].delete_prefix("./code/")] = m[:url] end + +puts JSON.pretty_generate(hash) diff --git a/themes/vanilla b/themes/vanilla index e2fb936..77b8d5e 160000 --- a/themes/vanilla +++ b/themes/vanilla @@ -1 +1 @@ -Subproject commit e2fb9362f611bcf7d92ad2f3ae99c904e3fa4474 +Subproject commit 77b8d5e65b0162bb448265bd5039054f9a87631a