Sha256: 00ddc052cef9b6bc70de7cd51875a321f431eb9b87fbe8518b4e992bb8c8a1bd
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require 'time' require 'builder' # This module contains all classes used in the DayOne gem, # as well as some helper methods module DayOne class << self # This is where all DayOne-relevant information is stored. # Set by default to ~/.rb-dayone attr_accessor :dayone_folder # The location of the journal file attr_accessor :journal_location # This is where your DayOne Journal is kept. Modify either # by directly modifying the ~/.rb-dayone/location file # or by running `dayone --set location` # @return [String] the location of DayOne's journal file. def journal_location @journal_location ||= File.read(journal_file).strip end # Error-checking method. Ensures that the journal location # file exists. # @return [Boolean] whether or not the journal location file exists def journal_location_exists? File.exists? journal_file end private # The journal file location # @return [String] the location of the journal file def journal_file @journal_file ||= File.join(dayone_folder, 'location') end end end DayOne::dayone_folder = File.join(ENV['HOME'], '.rb-dayone') unless DayOne::journal_location_exists? puts <<-end Error: DayOne journal file has not been located. Please set this using the command `dayone --set location before continuing. end end require 'rb-dayone/entry'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rb-dayone-0.1.7 | lib/rb-dayone.rb |