quran-json/lib/quran-pull/command.rb
0x1eef 2d9a22ea8f The great rewrite
The project's directory structure has been changed to be similar
to how FreeBSD organizes its filesystem. The english, portuguese,
and farsi translations are now sourced from https://quran.com. The
original Arabic is still sourced from searchtruth.com. Files
have been removed, and / or replaced. The SQL-related files have
been removed, with the intention to separate them into a new project
in the future (quran-sql). The lessons learnt from the development of
quran-audio were an inspiration for this change.
2023-02-08 16:14:48 -03:00

37 lines
626 B
Ruby

module Command
require "ryo"
require "json"
require "io/line"
def root_dir
File.realpath File.join(__dir__, "..", "..")
end
def share_dir
File.join(root_dir, "share", "quran-pull")
end
def data_dir
File.join(share_dir, "data")
end
def quran_dir
File.join(share_dir, "TheQuran")
end
def line
@line ||= IO::Line.new($stdout)
end
def count
@count ||= Ryo.from(
JSON.parse File.binread(File.join(data_dir, "count.json"))
)
end
def surah_info
@surah_info ||= Ryo.from(
JSON.parse File.binread(File.join(data_dir, "surahinfo.json"))
)
end
end