Class: Icarus::Mod::Tools::Sync::ModinfoList
- Inherits:
-
Object
- Object
- Icarus::Mod::Tools::Sync::ModinfoList
- Includes:
- Helpers
- Defined in:
- lib/icarus/mod/tools/sync/modinfo_list.rb
Overview
Sync methods
Instance Method Summary collapse
- #data(repositories, verbose: false) ⇒ Object
-
#initialize(client: nil) ⇒ ModinfoList
constructor
A new instance of ModinfoList.
- #modinfo(url) ⇒ Object
- #repositories ⇒ Object
- #update(modinfo_array) ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(client: nil) ⇒ ModinfoList
Returns a new instance of ModinfoList.
15 16 17 18 19 |
# File 'lib/icarus/mod/tools/sync/modinfo_list.rb', line 15 def initialize(client: nil) @firestore = client || Firestore.new @github = Github.new @repositories = [] end |
Instance Method Details
#data(repositories, verbose: false) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/icarus/mod/tools/sync/modinfo_list.rb', line 33 def data(repositories, verbose: false) repositories.map do |repo| print "searching #{repo}..." if verbose case repo when /github/ @github.repository = repo modinfo_url = @github.find("modinfo.json") unless modinfo_url puts "Skipped...no modinfo.json" if verbose next end puts "Found!" if verbose modinfo_url else puts "Skipped...repository type not supported yet" if verbose end end.compact end |
#modinfo(url) ⇒ Object
29 30 31 |
# File 'lib/icarus/mod/tools/sync/modinfo_list.rb', line 29 def modinfo(url) retrieve_from_url(url) end |
#repositories ⇒ Object
21 22 23 |
# File 'lib/icarus/mod/tools/sync/modinfo_list.rb', line 21 def repositories @firestore.repositories end |
#update(modinfo_array) ⇒ Object
25 26 27 |
# File 'lib/icarus/mod/tools/sync/modinfo_list.rb', line 25 def update(modinfo_array) @firestore.update(:modinfo, modinfo_array) end |