Sha256: 9d46f1ba963f0d5236e395c0fb0037d96549d6d77dfe1c975bd29e12cb316e58
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require "firestore" require "tools/sync_helpers" module Icarus module Mod module Tools # Sync methods class ModSync include SyncHelpers def initialize @firestore = Firestore.new end def mods @firestore.mods end def modinfo_array @modinfo_array ||= @firestore.modinfo_array.map do |url| retrieve_from_url(url)[:mods].map { |mod| Modinfo.new(mod) } rescue RequestFailed => e warn "Failed to retrieve modinfo: #{e.message}" next end.flatten.compact end def find_mod(modinfo) @firestore.find_mod(:name, modinfo.name)&.id end def find_modinfo(modinfo) @modinfo_array.find { |mod| mod.name == modinfo.name } end def update(modinfo) @firestore.update(:mod, modinfo, merge: false) end def delete(modinfo) @firestore.delete(:mod, modinfo) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Icarus-Mod-Tools-1.3.5 | lib/icarus/mod/tools/mod_sync.rb |
Icarus-Mod-Tools-1.3.4 | lib/icarus/mod/tools/mod_sync.rb |