al-quran.reflectslight.io/rake/tasks/t.rake

15 lines
519 B
Ruby
Raw Normal View History

2024-05-20 01:22:14 +02:00
# frozen_string_literal: true
namespace :t do
desc "Generate /json/<locale>/<surahid>/info.json from surahs.json"
task :"surahs.json" do
2024-06-22 05:04:27 +02:00
surahs = Ryo.from_json(path: File.join(dirs.content, "json", "surahs.json"))
Ryo.properties_of(surahs).each do |locale|
2024-05-20 01:22:14 +02:00
surahs[locale].each.with_index(1) do |surah, index|
2024-06-22 05:04:27 +02:00
File.write File.join(dirs.content, "json", locale, index.to_s, "info.json"),
JSON.pretty_generate(Ryo.table_of(surah, recursive: true))
2024-05-20 01:22:14 +02:00
end
end
end
end