diff --git a/lib/quran-json/command.rb b/lib/quran-json/command.rb index 64f225e..ac2ddbd 100644 --- a/lib/quran-json/command.rb +++ b/lib/quran-json/command.rb @@ -19,6 +19,10 @@ module Command File.join(share_dir, "TheQuran") end + def locale_dir + File.join(share_dir, options.locale) + end + def line @line ||= IO::Line.new($stdout) end diff --git a/lib/quran-json/pull.rb b/lib/quran-json/pull.rb index faeaa5c..a7c310a 100644 --- a/lib/quran-json/pull.rb +++ b/lib/quran-json/pull.rb @@ -42,10 +42,9 @@ class Pull end def write(surah_no, rows) - dir = File.join(quran_dir, options.locale) - mkdir_p(dir) + mkdir_p(locale_dir) rows.unshift(Ryo.table_of(surah_info[surah_no - 1])) - File.binwrite File.join(dir, "#{surah_no}.json"), JSON.pretty_generate(rows) + File.binwrite File.join(locale_dir, "#{surah_no}.json"), JSON.pretty_generate(rows) end def keepalive @@ -69,7 +68,7 @@ class Pull end def exist?(surah_no) - File.exist? File.join(quran_dir, options.locale, "#{surah_no}.json") + File.exist? File.join(locale_dir, "#{surah_no}.json") end def headers