Class: Icarus::Mod::Tools::Sync::ToolinfoList
- Inherits:
-
Object
- Object
- Icarus::Mod::Tools::Sync::ToolinfoList
- Includes:
- Helpers
- Defined in:
- lib/icarus/mod/tools/sync/toolinfo_list.rb
Overview
Sync methods
Instance Method Summary collapse
- #data(repositories, verbose: false) ⇒ Object
-
#initialize(client: nil) ⇒ ToolinfoList
constructor
A new instance of ToolinfoList.
- #repositories ⇒ Object
- #toolinfo(url) ⇒ Object
- #update(toolinfo_array) ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(client: nil) ⇒ ToolinfoList
Returns a new instance of ToolinfoList.
15 16 17 18 19 |
# File 'lib/icarus/mod/tools/sync/toolinfo_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/toolinfo_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 toolinfo_url = @github.find("toolinfo.json") unless toolinfo_url puts "Skipped...no toolinfo.json" if verbose next end puts "Found!" if verbose toolinfo_url else puts "Skipped...repository type not supported yet" if verbose end end.compact end |
#repositories ⇒ Object
21 22 23 |
# File 'lib/icarus/mod/tools/sync/toolinfo_list.rb', line 21 def repositories @firestore.repositories end |
#toolinfo(url) ⇒ Object
29 30 31 |
# File 'lib/icarus/mod/tools/sync/toolinfo_list.rb', line 29 def toolinfo(url) retrieve_from_url(url) end |
#update(toolinfo_array) ⇒ Object
25 26 27 |
# File 'lib/icarus/mod/tools/sync/toolinfo_list.rb', line 25 def update(toolinfo_array) @firestore.update(:toolinfo, toolinfo_array) end |