module DayOneKindle::DayOne
Public Class Methods
journal_location()
click to toggle source
# File lib/dayone-kindle/day_one.rb, line 3 def self.journal_location @journal_location ||= begin prefs_file = File.join(ENV['HOME'], 'Library/Group Containers/5U8NS4GX82.dayoneapp/Data/Preferences/dayone.plist') raise 'DayOne preference file not found' unless File.exists?(prefs_file) prefs = File.read(prefs_file) match = prefs.match(/<key>JournalPackageURL<\/key>\n\t<string>([^<>]+)<\/string>/) raise 'DayOne journal not found' unless match && match[1] match[1] end end