Icarus-Mod-Tools 1.8.2.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/Gemfile.lock +5 -1
- data/README.md +5 -5
- data/imtconfig.sample.json +2 -2
- data/lib/icarus/mod/cli/add.rb +4 -4
- data/lib/icarus/mod/cli/list.rb +9 -9
- data/lib/icarus/mod/cli/sync.rb +16 -16
- data/lib/icarus/mod/cli/validate.rb +3 -3
- data/lib/icarus/mod/firestore.rb +11 -11
- data/lib/icarus/mod/tools/baseinfo.rb +1 -1
- data/lib/icarus/mod/tools/sync/helpers.rb +2 -0
- data/lib/icarus/mod/tools/sync/{modinfo.rb → modinfo_list.rb} +1 -1
- data/lib/icarus/mod/tools/sync/mods.rb +1 -1
- data/lib/icarus/mod/tools/sync/{proginfo.rb → toolinfo_list.rb} +8 -8
- data/lib/icarus/mod/tools/sync/{progs.rb → tools.rb} +15 -13
- data/lib/icarus/mod/tools/{proginfo.rb → toolinfo.rb} +1 -1
- data/lib/icarus/mod/tools/validator.rb +2 -2
- data/lib/icarus/mod/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fba522a3f41d8d1c77402e95f59684594bb7be97a8227966e4b647777152f05
|
4
|
+
data.tar.gz: 933ee795c5f13f964e1a866c0ce06549912c6e99c06c78fd687e5c25886bf148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cd6a08a77be86801059b2b63a81fb662583ca404391afa2fd9544dbda8549e0652ce4c7db9a5ff64edb04afd07b50b742e1473861639ea190eddd22dda70f03
|
7
|
+
data.tar.gz: 1f28bff449d31ea47fa9166586dd10b996c466ed898ff53449a2cfd84fff98a5454418214fa479fa9976c0700ca88b12724c8b1f166b059093658d32862ee938
|
data/CHANGES.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
Icarus-Mod-Tools (1.
|
4
|
+
Icarus-Mod-Tools (1.9.0)
|
5
5
|
google-cloud-firestore (~> 2.7)
|
6
6
|
octokit (~> 6.0)
|
7
7
|
paint (~> 2.3)
|
@@ -51,6 +51,7 @@ GEM
|
|
51
51
|
gapic-common (>= 0.16.0, < 2.a)
|
52
52
|
google-cloud-errors (~> 1.0)
|
53
53
|
google-protobuf (3.21.12-x86_64-darwin)
|
54
|
+
google-protobuf (3.21.12-x86_64-linux)
|
54
55
|
googleapis-common-protos (1.4.0)
|
55
56
|
google-protobuf (~> 3.14)
|
56
57
|
googleapis-common-protos-types (~> 1.2)
|
@@ -67,6 +68,9 @@ GEM
|
|
67
68
|
grpc (1.51.0-x86_64-darwin)
|
68
69
|
google-protobuf (~> 3.21)
|
69
70
|
googleapis-common-protos-types (~> 1.0)
|
71
|
+
grpc (1.51.0-x86_64-linux)
|
72
|
+
google-protobuf (~> 3.21)
|
73
|
+
googleapis-common-protos-types (~> 1.0)
|
70
74
|
guard (2.18.0)
|
71
75
|
formatador (>= 0.2.4)
|
72
76
|
listen (>= 2.7, < 4.0)
|
data/README.md
CHANGED
@@ -71,7 +71,7 @@ Options:
|
|
71
71
|
Commands:
|
72
72
|
imt add help [COMMAND] # Describe subcommands or one specific subcommand
|
73
73
|
imt add modinfo # Adds an entry to 'meta/modinfo/list'
|
74
|
-
imt add
|
74
|
+
imt add toolinfo # Adds an entry to 'meta/toolinfo/list'
|
75
75
|
imt add repos # Adds an entry to 'meta/repos/list'
|
76
76
|
|
77
77
|
Options:
|
@@ -89,8 +89,8 @@ Commands:
|
|
89
89
|
imt list help [COMMAND] # Describe subcommands or one specific subcommand
|
90
90
|
imt list modinfo # Displays data from 'meta/modinfo/list'
|
91
91
|
imt list mods # Displays data from 'mods'
|
92
|
-
imt list
|
93
|
-
imt list
|
92
|
+
imt list toolinfo # Displays data from 'meta/toolinfo/list'
|
93
|
+
imt list tools # Displays data from 'tools'
|
94
94
|
imt list repos # Displays data from 'meta/repos/list'
|
95
95
|
|
96
96
|
Options:
|
@@ -109,8 +109,8 @@ Commands:
|
|
109
109
|
imt sync help [COMMAND] # Describe subcommands or one specific subcommand
|
110
110
|
imt sync modinfo # Reads from 'meta/repos/list' and Syncs any modinfo files we find (github only for now)
|
111
111
|
imt sync mods # Reads from 'meta/modinfo/list' and updates the 'mods' database accordingly
|
112
|
-
imt sync
|
113
|
-
imt sync
|
112
|
+
imt sync toolinfo # Reads from 'meta/repos/list' and Syncs any toolinfo files we find (github only for now)
|
113
|
+
imt sync tools # Reads from 'meta/toolinfo/list' and updates the 'tools' database accordingly
|
114
114
|
|
115
115
|
Options:
|
116
116
|
-C, [--config=CONFIG] # Path to the config file
|
data/imtconfig.sample.json
CHANGED
data/lib/icarus/mod/cli/add.rb
CHANGED
@@ -15,12 +15,12 @@ module Icarus
|
|
15
15
|
puts firestore.update(:modinfo, payload, merge: true) ? "Success" : "Failure"
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "
|
19
|
-
def
|
18
|
+
desc "toolinfo", "Adds an entry to 'meta/toolinfo/list'"
|
19
|
+
def toolinfo(item)
|
20
20
|
firestore = Firestore.new
|
21
|
-
payload = [firestore.list(:
|
21
|
+
payload = [firestore.list(:toolinfo), item].flatten.compact
|
22
22
|
|
23
|
-
puts firestore.update(:
|
23
|
+
puts firestore.update(:toolinfo, payload, merge: true) ? "Success" : "Failure"
|
24
24
|
end
|
25
25
|
|
26
26
|
desc "repos", "Adds an entry to 'meta/repos/list'"
|
data/lib/icarus/mod/cli/list.rb
CHANGED
@@ -15,11 +15,11 @@ module Icarus
|
|
15
15
|
puts "Total: #{modinfo_array.count}" if verbose > 1
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "
|
19
|
-
def
|
20
|
-
|
21
|
-
puts
|
22
|
-
puts "Total: #{
|
18
|
+
desc "toolinfo", "Displays data from 'meta/toolinfo/list'"
|
19
|
+
def toolinfo
|
20
|
+
toolinfo_array = Firestore.new.list(:toolinfo)
|
21
|
+
puts toolinfo_array
|
22
|
+
puts "Total: #{toolinfo_array.count}" if verbose > 1
|
23
23
|
end
|
24
24
|
|
25
25
|
desc "repos", "Displays data from 'meta/repos/list'"
|
@@ -36,16 +36,16 @@ module Icarus
|
|
36
36
|
list_for_type(:mods)
|
37
37
|
end
|
38
38
|
|
39
|
-
desc "
|
39
|
+
desc "tools", "Displays data from 'tools'"
|
40
40
|
method_option :sort, type: :string, default: "name", desc: "Sort by field (name, author, etc.)"
|
41
41
|
method_option :filter, type: :array, default: [], desc: "Filter by field (name, author, etc.)"
|
42
|
-
def
|
43
|
-
list_for_type(:
|
42
|
+
def tools
|
43
|
+
list_for_type(:tools)
|
44
44
|
end
|
45
45
|
|
46
46
|
no_commands do
|
47
47
|
def list_for_type(type)
|
48
|
-
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::
|
48
|
+
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
|
49
49
|
valid_keys = klass::HASHKEYS + [:updated_at]
|
50
50
|
sort_field = options[:sort]&.to_sym
|
51
51
|
filter = !options[:filter].empty?
|
data/lib/icarus/mod/cli/sync.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "tools/sync/
|
4
|
-
require "tools/sync/
|
3
|
+
require "tools/sync/modinfo_list"
|
4
|
+
require "tools/sync/toolinfo_list"
|
5
5
|
require "tools/sync/mods"
|
6
|
-
require "tools/sync/
|
6
|
+
require "tools/sync/tools"
|
7
7
|
|
8
8
|
module Icarus
|
9
9
|
module Mod
|
@@ -17,11 +17,11 @@ module Icarus
|
|
17
17
|
|
18
18
|
desc "all", "Run all sync jobs"
|
19
19
|
def all
|
20
|
-
puts "Running
|
21
|
-
invoke :
|
20
|
+
puts "Running Toolinfo Sync..." if verbose?
|
21
|
+
invoke :toolinfo
|
22
22
|
|
23
|
-
puts "Running
|
24
|
-
invoke :
|
23
|
+
puts "Running Tools Sync..." if verbose?
|
24
|
+
invoke :tools
|
25
25
|
|
26
26
|
puts "Running Modinfo Sync..." if verbose?
|
27
27
|
invoke :modinfo
|
@@ -35,9 +35,9 @@ module Icarus
|
|
35
35
|
sync_info(:modinfo)
|
36
36
|
end
|
37
37
|
|
38
|
-
desc "
|
39
|
-
def
|
40
|
-
sync_info(:
|
38
|
+
desc "toolinfo", "Reads from 'meta/repos/list' and Syncs any toolinfo files we find (github only for now)"
|
39
|
+
def toolinfo
|
40
|
+
sync_info(:toolinfo)
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "mods", "Reads from 'meta/modinfo/list' and updates the 'mods' database accordingly"
|
@@ -46,10 +46,10 @@ module Icarus
|
|
46
46
|
sync_list(:mods)
|
47
47
|
end
|
48
48
|
|
49
|
-
desc "
|
50
|
-
method_option :check, type: :boolean, default: false, desc: "Validate
|
51
|
-
def
|
52
|
-
sync_list(:
|
49
|
+
desc "tools", "Reads from 'meta/toolinfo/list' and updates the 'tools' database accordingly"
|
50
|
+
method_option :check, type: :boolean, default: false, desc: "Validate toolinfo without applying changes"
|
51
|
+
def tools
|
52
|
+
sync_list(:tools)
|
53
53
|
end
|
54
54
|
|
55
55
|
no_commands do
|
@@ -58,7 +58,7 @@ module Icarus
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def sync_info(type)
|
61
|
-
sync = (type == :modinfo ? Icarus::Mod::Tools::Sync::
|
61
|
+
sync = (type == :modinfo ? Icarus::Mod::Tools::Sync::ModinfoList : Icarus::Mod::Tools::Sync::ToolinfoList).new(client: firestore)
|
62
62
|
|
63
63
|
puts "Retrieving repository Data..." if verbose?
|
64
64
|
repositories = sync.repositories
|
@@ -83,7 +83,7 @@ module Icarus
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def sync_list(type)
|
86
|
-
sync = (type == :mods ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::
|
86
|
+
sync = (type == :mods ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Tools).new(client: firestore)
|
87
87
|
|
88
88
|
puts "Retrieving Info Data..." if verbose?
|
89
89
|
info_array = sync.info_array
|
@@ -12,9 +12,9 @@ module Icarus
|
|
12
12
|
validate(:modinfo)
|
13
13
|
end
|
14
14
|
|
15
|
-
desc "
|
16
|
-
def
|
17
|
-
validate(:
|
15
|
+
desc "toolinfo", "Reads Toolinfo data from 'meta/toolinfo/list' and Validates syntax of toolfiles"
|
16
|
+
def toolinfo
|
17
|
+
validate(:toolinfo)
|
18
18
|
end
|
19
19
|
|
20
20
|
no_commands do
|
data/lib/icarus/mod/firestore.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "google/cloud/firestore"
|
4
4
|
require "tools/modinfo"
|
5
|
-
require "tools/
|
5
|
+
require "tools/toolinfo"
|
6
6
|
|
7
7
|
module Icarus
|
8
8
|
module Mod
|
@@ -23,16 +23,16 @@ module Icarus
|
|
23
23
|
@modinfo ||= list(:modinfo)
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
@
|
26
|
+
def toolinfo
|
27
|
+
@toolinfo ||= list(:toolinfo)
|
28
28
|
end
|
29
29
|
|
30
30
|
def mods
|
31
31
|
@mods ||= list(:mods)
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
@
|
34
|
+
def tools
|
35
|
+
@tools ||= list(:tools)
|
36
36
|
end
|
37
37
|
|
38
38
|
def find_by_type(type:, name:, author:)
|
@@ -47,11 +47,11 @@ module Icarus
|
|
47
47
|
|
48
48
|
def list(type)
|
49
49
|
case type.to_sym
|
50
|
-
when :modinfo, :
|
50
|
+
when :modinfo, :toolinfo, :repositories
|
51
51
|
get_list(type)
|
52
|
-
when :mods, :
|
52
|
+
when :mods, :tools
|
53
53
|
@client.col(collections.send(type)).get.map do |doc|
|
54
|
-
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::
|
54
|
+
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
|
55
55
|
klass.new(doc.data, id: doc.document_id, created: doc.create_time, updated: doc.update_time)
|
56
56
|
end
|
57
57
|
else
|
@@ -71,12 +71,12 @@ module Icarus
|
|
71
71
|
raise "You must specify a payload to update" if payload&.empty? || payload.nil?
|
72
72
|
|
73
73
|
case type.to_sym
|
74
|
-
when :modinfo, :
|
74
|
+
when :modinfo, :toolinfo
|
75
75
|
update_array = (send(type) + [payload]).flatten.uniq
|
76
76
|
response = @client.doc(collections.send(type)).set({ list: update_array }, merge:) if update_array.any?
|
77
77
|
when :repositories
|
78
78
|
response = @client.doc(collections.repositories).set({ list: payload }, merge:)
|
79
|
-
when :mod, :
|
79
|
+
when :mod, :tool
|
80
80
|
response = update_or_create(pluralize(type), payload, merge:)
|
81
81
|
else
|
82
82
|
raise "Invalid type: #{type}"
|
@@ -87,7 +87,7 @@ module Icarus
|
|
87
87
|
|
88
88
|
def delete(type, payload)
|
89
89
|
case type.to_sym
|
90
|
-
when :mod, :
|
90
|
+
when :mod, :tool
|
91
91
|
response = @client.doc("#{collections.send(pluralize(type))}/#{payload.id}").delete
|
92
92
|
else
|
93
93
|
raise "Invalid type: #{type}"
|
@@ -13,6 +13,8 @@ module Icarus
|
|
13
13
|
# Sync helper methods
|
14
14
|
module Helpers
|
15
15
|
def retrieve_from_url(url)
|
16
|
+
raise RequestFailed, "Invalid URI: '#{url}'" unless url && url =~ URI::DEFAULT_PARSER.make_regexp
|
17
|
+
|
16
18
|
res = Net::HTTP.get_response(URI(url))
|
17
19
|
|
18
20
|
raise RequestFailed, "HTTP Request failed for #{url} (#{res.code}): #{res.message}" unless res&.code == "200"
|
@@ -21,7 +21,7 @@ module Icarus
|
|
21
21
|
|
22
22
|
def info_array
|
23
23
|
@info_array ||= @firestore.modinfo.map do |url|
|
24
|
-
retrieve_from_url(url)[:mods].map { |mod| Tools::Modinfo.new(mod) if mod[:name] =~ /[a-z0-9]+/i }
|
24
|
+
retrieve_from_url(url)[:mods].map { |mod| Icarus::Mod::Tools::Modinfo.new(mod) if mod[:name] =~ /[a-z0-9]+/i }
|
25
25
|
rescue Icarus::Mod::Tools::Sync::RequestFailed
|
26
26
|
warn "Skipped; Failed to retrieve #{url}"
|
27
27
|
next
|
@@ -9,7 +9,7 @@ module Icarus
|
|
9
9
|
module Tools
|
10
10
|
module Sync
|
11
11
|
# Sync methods
|
12
|
-
class
|
12
|
+
class ToolinfoList
|
13
13
|
include Helpers
|
14
14
|
|
15
15
|
def initialize(client: nil)
|
@@ -22,11 +22,11 @@ module Icarus
|
|
22
22
|
@firestore.repos
|
23
23
|
end
|
24
24
|
|
25
|
-
def update(
|
26
|
-
@firestore.update(:
|
25
|
+
def update(toolinfo_array)
|
26
|
+
@firestore.update(:toolinfo, toolinfo_array)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def toolinfo(url)
|
30
30
|
retrieve_from_url(url)
|
31
31
|
end
|
32
32
|
|
@@ -37,15 +37,15 @@ module Icarus
|
|
37
37
|
case repo
|
38
38
|
when /github/
|
39
39
|
@github.repository = repo
|
40
|
-
|
40
|
+
toolinfo_url = @github.find("toolinfo.json")
|
41
41
|
|
42
|
-
unless
|
43
|
-
puts "Skipped...no
|
42
|
+
unless toolinfo_url
|
43
|
+
puts "Skipped...no toolinfo.json" if verbose
|
44
44
|
next
|
45
45
|
end
|
46
46
|
|
47
47
|
puts "Found!" if verbose
|
48
|
-
|
48
|
+
toolinfo_url
|
49
49
|
else
|
50
50
|
puts "Skipped...repository type not supported yet" if verbose
|
51
51
|
end
|
@@ -8,20 +8,22 @@ module Icarus
|
|
8
8
|
module Tools
|
9
9
|
module Sync
|
10
10
|
# Sync methods
|
11
|
-
class
|
11
|
+
class Tools
|
12
12
|
include Helpers
|
13
13
|
|
14
14
|
def initialize(client: nil)
|
15
15
|
@firestore = client || Firestore.new
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
@firestore.
|
18
|
+
def tools
|
19
|
+
@firestore.tools
|
20
20
|
end
|
21
21
|
|
22
22
|
def info_array
|
23
|
-
@info_array ||= @firestore.
|
24
|
-
|
23
|
+
@info_array ||= @firestore.toolinfo.map do |url|
|
24
|
+
next unless url
|
25
|
+
|
26
|
+
retrieve_from_url(url)[:tools].map { |tool| Icarus::Mod::Tools::Toolinfo.new(tool) if tool[:name] =~ /[a-z0-9]+/i }
|
25
27
|
rescue Icarus::Mod::Tools::Sync::RequestFailed
|
26
28
|
warn "Skipped; Failed to retrieve #{url}"
|
27
29
|
next
|
@@ -31,20 +33,20 @@ module Icarus
|
|
31
33
|
end.flatten.compact
|
32
34
|
end
|
33
35
|
|
34
|
-
def find(
|
35
|
-
@firestore.find_by_type(type: "
|
36
|
+
def find(toolinfo)
|
37
|
+
@firestore.find_by_type(type: "tools", name: toolinfo.name, author: toolinfo.author)&.id
|
36
38
|
end
|
37
39
|
|
38
|
-
def find_info(
|
39
|
-
@info_array.find { |
|
40
|
+
def find_info(toolinfo)
|
41
|
+
@info_array.find { |tool| tool.name == toolinfo.name }
|
40
42
|
end
|
41
43
|
|
42
|
-
def update(
|
43
|
-
@firestore.update(:
|
44
|
+
def update(toolinfo)
|
45
|
+
@firestore.update(:tool, toolinfo, merge: false)
|
44
46
|
end
|
45
47
|
|
46
|
-
def delete(
|
47
|
-
@firestore.delete(:
|
48
|
+
def delete(toolinfo)
|
49
|
+
@firestore.delete(:tool, toolinfo)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
end
|
data/lib/icarus/mod/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Icarus-Mod-Tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donovan Young
|
@@ -99,12 +99,12 @@ files:
|
|
99
99
|
- lib/icarus/mod/tools.rb
|
100
100
|
- lib/icarus/mod/tools/baseinfo.rb
|
101
101
|
- lib/icarus/mod/tools/modinfo.rb
|
102
|
-
- lib/icarus/mod/tools/proginfo.rb
|
103
102
|
- lib/icarus/mod/tools/sync/helpers.rb
|
104
|
-
- lib/icarus/mod/tools/sync/
|
103
|
+
- lib/icarus/mod/tools/sync/modinfo_list.rb
|
105
104
|
- lib/icarus/mod/tools/sync/mods.rb
|
106
|
-
- lib/icarus/mod/tools/sync/
|
107
|
-
- lib/icarus/mod/tools/sync/
|
105
|
+
- lib/icarus/mod/tools/sync/toolinfo_list.rb
|
106
|
+
- lib/icarus/mod/tools/sync/tools.rb
|
107
|
+
- lib/icarus/mod/tools/toolinfo.rb
|
108
108
|
- lib/icarus/mod/tools/validator.rb
|
109
109
|
- lib/icarus/mod/version.rb
|
110
110
|
- sig/database/sync/sync.rbs
|