Module: Booker::Sources

Defined in:
lib/booker/config.rb

Overview

where browsers keep their bookmarks. one implementation, shared by the auto-detection Config falls back on and by booker --install bookmarks - the installer's job is to show what auto-detection would find, so a second copy of these paths guarantees it eventually shows something else. nothing here tags a source: Bookmarks.source_for reads that off the filename

Constant Summary collapse

CHROME =
[
  "/Library/Application Support/Google/Chrome",      # macOS
  "/Library/Application Support/Chromium",           # macOS Chromium
  "/.config/google-chrome",                          # Linux
  "/.config/chromium",                               # Linux Chromium
  "/snap/chromium/common/chromium",                  # Linux (snap)
  "/snap/chromium/current/.config/chromium",         # Linux (snap alt)
  "/AppData/Local/Google/Chrome/User Data"           # Windows
].freeze
FIREFOX =
[
  "/.mozilla/firefox",                               # Linux
  "/snap/firefox/common/.mozilla/firefox",           # Linux (snap)
  "/Library/Application Support/Firefox",            # macOS
  "/AppData/Roaming/Mozilla/Firefox"                 # Windows
].freeze
SAFARI =
"/Library/Safari/Bookmarks.plist"

Class Method Summary collapse

Class Method Details

.discoverObject



170
# File 'lib/booker/config.rb', line 170

def discover = (chrome + firefox + safari).uniq

.profiles(ini_path, base) ⇒ Object

every places.sqlite named by a profiles.ini. any Path= counts, and the [Install...] block firefox also writes names a profile already listed, hence the uniq



175
176
177
178
179
180
181
182
183
# File 'lib/booker/config.rb', line 175

def profiles(ini_path, base)
  File.readlines(ini_path).filter_map do |line|
    key, value = line.strip.split("=", 2)
    next unless key == "Path" && value

    db = File.join(base, value.strip, "places.sqlite")
    db if File.exist?(db)
  end.uniq
end