From d7c140bca1321e56efc3dea829b62b1e4eb263f8 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sun, 19 May 2024 20:46:37 -0300 Subject: [PATCH] Add "jsondir" --- rake/tasks/t.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rake/tasks/t.rake b/rake/tasks/t.rake index bbf236930..a1f21dd89 100644 --- a/rake/tasks/t.rake +++ b/rake/tasks/t.rake @@ -1,14 +1,14 @@ # frozen_string_literal: true namespace :t do + jsondir = File.join(Dir.getwd, "src", "json") desc "Generate /json///info.json from surahs.json" task :"surahs.json" do require "json" - path = File.join(Dir.getwd, "src", "json", "surahs.json") - surahs = JSON.parse(File.read(path)) + surahs = JSON.parse File.read(File.join(jsondir, "surahs.json")) surahs.keys.each do |locale| surahs[locale].each.with_index(1) do |surah, index| - target = File.join(Dir.getwd, "src", "json", locale, index.to_s, "info.json") + target = File.join(jsondir, locale, index.to_s, "info.json") File.write(target, JSON.pretty_generate(surah)) end end