2021-01-10 20:24:22 -08:00
|
|
|
puts "[params]"
|
|
|
|
puts " [params.submoduleLinks]"
|
|
|
|
|
2021-01-11 12:39:41 -08:00
|
|
|
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(/\/|-|_\./, "")
|
2021-01-10 20:24:22 -08:00
|
|
|
|
2021-01-11 12:39:41 -08:00
|
|
|
if url =~ /dev.danilafe.com/
|
|
|
|
file_url = "#{url}/src/commit/#{hash}"
|
|
|
|
else
|
|
|
|
raise "Submodule URL #{url.dump} not in a known format!"
|
|
|
|
end
|
|
|
|
|
|
|
|
yield ({ :path => full_path, :url => file_url, :name => safe_name })
|
|
|
|
each_submodule(full_path) { |m| yield m }
|
2021-01-10 20:24:22 -08:00
|
|
|
end
|
2021-01-11 12:39:41 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
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}"
|
2021-01-10 20:24:22 -08:00
|
|
|
end
|