Icarus-Mod-Tools 2.0 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CHANGES.md → CHANGELOG.md} +12 -0
- data/Gemfile.lock +4 -8
- data/{LICENSE.md → LICENSE} +0 -0
- data/README.md +4 -1
- data/icarus-mod-tools.gemspec +1 -1
- data/lib/icarus/mod/cli/add.rb +3 -3
- data/lib/icarus/mod/cli/list.rb +4 -4
- data/lib/icarus/mod/firestore.rb +30 -31
- data/lib/icarus/mod/tools/modinfo.rb +12 -3
- data/lib/icarus/mod/tools/sync/modinfo_list.rb +1 -1
- data/lib/icarus/mod/tools/sync/toolinfo_list.rb +1 -1
- data/lib/icarus/mod/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c66a2adaabe6da3d7ef43db063f7d2924e182e574b4d9d77c1786a15aea1c8b
|
4
|
+
data.tar.gz: d28b3240fbfc0670ab652ac131bfad396f1e6e09e30fbd7c5c3dace8c51e1784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b823d39db613491f965a185a43bcf848629e84ca88fca358e2bc9412bbc42802c92a6fc6fe72870907e6d970415fe4d037035057a946bd19495b7bf9650a9c
|
7
|
+
data.tar.gz: 7e625e03b7d027a0d52f28d955b80abf3cab001f879a0169a7e500d0123775801580e9c7b8ef85438ba7eb7813b7ac02f37114ea37496e7b1beeec1e73bdd1d1
|
data/{CHANGES.md → CHANGELOG.md}
RENAMED
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## History (reverse chronological order)
|
6
6
|
|
7
|
+
## [2.0.2](https://github.com/DonovanMods/icarus-mod-tools/compare/v2.0.1...v2.0.2) (2023-02-04)
|
8
|
+
|
9
|
+
|
10
|
+
### Bug Fixes
|
11
|
+
|
12
|
+
* Create fileType and fileURL along with files ([a5294a4](https://github.com/DonovanMods/icarus-mod-tools/commit/a5294a479bcc68f6e4125f5062db9a0dbd48bdf8))
|
13
|
+
* Create fileType and fileURL along with files ([db5620f](https://github.com/DonovanMods/icarus-mod-tools/commit/db5620fafefd750196d6470f00e4000971adae1f))
|
14
|
+
|
15
|
+
### v2.0 - 2023-02-03
|
16
|
+
|
17
|
+
- Converts to new `files` object, replacing fileType and fileURL
|
18
|
+
|
7
19
|
### v1.9 - 2023-01-28
|
8
20
|
|
9
21
|
- Renamed `Progs` to `Tools`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
Icarus-Mod-Tools (2.0)
|
4
|
+
Icarus-Mod-Tools (2.0.3)
|
5
5
|
google-cloud-firestore (~> 2.7)
|
6
6
|
octokit (~> 6.0)
|
7
7
|
paint (~> 2.3)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
google-cloud-env (1.6.0)
|
39
39
|
faraday (>= 0.17.3, < 3.0)
|
40
40
|
google-cloud-errors (1.3.0)
|
41
|
-
google-cloud-firestore (2.9.
|
41
|
+
google-cloud-firestore (2.9.1)
|
42
42
|
concurrent-ruby (~> 1.0)
|
43
43
|
google-cloud-core (~> 1.5)
|
44
44
|
google-cloud-firestore-v1 (~> 0.0)
|
@@ -50,7 +50,6 @@ GEM
|
|
50
50
|
google-cloud-location (0.3.0)
|
51
51
|
gapic-common (>= 0.16.0, < 2.a)
|
52
52
|
google-cloud-errors (~> 1.0)
|
53
|
-
google-protobuf (3.21.12-x86_64-darwin)
|
54
53
|
google-protobuf (3.21.12-x86_64-linux)
|
55
54
|
googleapis-common-protos (1.4.0)
|
56
55
|
google-protobuf (~> 3.14)
|
@@ -65,9 +64,6 @@ GEM
|
|
65
64
|
multi_json (~> 1.11)
|
66
65
|
os (>= 0.9, < 2.0)
|
67
66
|
signet (>= 0.16, < 2.a)
|
68
|
-
grpc (1.51.0-x86_64-darwin)
|
69
|
-
google-protobuf (~> 3.21)
|
70
|
-
googleapis-common-protos-types (~> 1.0)
|
71
67
|
grpc (1.51.0-x86_64-linux)
|
72
68
|
google-protobuf (~> 3.21)
|
73
69
|
googleapis-common-protos-types (~> 1.0)
|
@@ -122,7 +118,7 @@ GEM
|
|
122
118
|
rspec-core (~> 3.12.0)
|
123
119
|
rspec-expectations (~> 3.12.0)
|
124
120
|
rspec-mocks (~> 3.12.0)
|
125
|
-
rspec-core (3.12.
|
121
|
+
rspec-core (3.12.1)
|
126
122
|
rspec-support (~> 3.12.0)
|
127
123
|
rspec-expectations (3.12.2)
|
128
124
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -177,4 +173,4 @@ DEPENDENCIES
|
|
177
173
|
rubocop-rspec (~> 2.16)
|
178
174
|
|
179
175
|
BUNDLED WITH
|
180
|
-
2.3.
|
176
|
+
2.3.26
|
data/{LICENSE.md → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -33,8 +33,10 @@ Create a file called `.imtconfig.json` in your home directory with the following
|
|
33
33
|
},
|
34
34
|
"collections": {
|
35
35
|
"modinfo": "meta/modinfo",
|
36
|
+
"toolinfo": "meta/toolinfo",
|
36
37
|
"repositories": "meta/repos",
|
37
|
-
"mods": "mods"
|
38
|
+
"mods": "mods",
|
39
|
+
"tools": "tools"
|
38
40
|
}
|
39
41
|
},
|
40
42
|
"github": {
|
@@ -73,6 +75,7 @@ Commands:
|
|
73
75
|
imt add modinfo # Adds an entry to 'meta/modinfo/list'
|
74
76
|
imt add toolinfo # Adds an entry to 'meta/toolinfo/list'
|
75
77
|
imt add repos # Adds an entry to 'meta/repos/list'
|
78
|
+
imt add mod <filename> # Adds an entry to 'mods' when given a modinfo.json file
|
76
79
|
|
77
80
|
Options:
|
78
81
|
-C, [--config=CONFIG] # Path to the config file
|
data/icarus-mod-tools.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/
|
18
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
19
19
|
spec.metadata["rubygems_mfa_required"] = "true"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
data/lib/icarus/mod/cli/add.rb
CHANGED
@@ -11,7 +11,7 @@ module Icarus
|
|
11
11
|
desc "modinfo", "Adds an entry to 'meta/modinfo/list'"
|
12
12
|
def modinfo(item)
|
13
13
|
firestore = Firestore.new
|
14
|
-
payload = [firestore.
|
14
|
+
payload = [firestore.modinfo, item].flatten.compact
|
15
15
|
|
16
16
|
puts firestore.update(:modinfo, payload, merge: true) ? "Success" : "Failure"
|
17
17
|
end
|
@@ -19,7 +19,7 @@ module Icarus
|
|
19
19
|
desc "toolinfo", "Adds an entry to 'meta/toolinfo/list'"
|
20
20
|
def toolinfo(item)
|
21
21
|
firestore = Firestore.new
|
22
|
-
payload = [firestore.
|
22
|
+
payload = [firestore.toolinfo, item].flatten.compact
|
23
23
|
|
24
24
|
puts firestore.update(:toolinfo, payload, merge: true) ? "Success" : "Failure"
|
25
25
|
end
|
@@ -27,7 +27,7 @@ module Icarus
|
|
27
27
|
desc "repos", "Adds an entry to 'meta/repos/list'"
|
28
28
|
def repos(item)
|
29
29
|
firestore = Firestore.new
|
30
|
-
payload = [firestore.
|
30
|
+
payload = [firestore.repositories, item].flatten.compact
|
31
31
|
|
32
32
|
puts firestore.update(:repositories, payload, merge: true) ? "Success" : "Failure"
|
33
33
|
end
|
data/lib/icarus/mod/cli/list.rb
CHANGED
@@ -10,21 +10,21 @@ module Icarus
|
|
10
10
|
class List < SubcommandBase
|
11
11
|
desc "modinfo", "Displays data from 'meta/modinfo/list'"
|
12
12
|
def modinfo
|
13
|
-
modinfo_array = Firestore.new.
|
13
|
+
modinfo_array = Firestore.new.send(:modinfo)
|
14
14
|
puts modinfo_array
|
15
15
|
puts "Total: #{modinfo_array.count}" if verbose > 1
|
16
16
|
end
|
17
17
|
|
18
18
|
desc "toolinfo", "Displays data from 'meta/toolinfo/list'"
|
19
19
|
def toolinfo
|
20
|
-
toolinfo_array = Firestore.new.
|
20
|
+
toolinfo_array = Firestore.new.send(:toolinfo)
|
21
21
|
puts toolinfo_array
|
22
22
|
puts "Total: #{toolinfo_array.count}" if verbose > 1
|
23
23
|
end
|
24
24
|
|
25
25
|
desc "repos", "Displays data from 'meta/repos/list'"
|
26
26
|
def repos
|
27
|
-
repos = Firestore.new.
|
27
|
+
repos = Firestore.new.send(:repositories)
|
28
28
|
puts repos
|
29
29
|
puts "Total: #{repos.count}" if verbose > 1
|
30
30
|
end
|
@@ -64,7 +64,7 @@ module Icarus
|
|
64
64
|
puts "Sorted by #{sort_field}" if sort_field && verbose > 2
|
65
65
|
puts "Filtered by #{filter_field} = #{filter_value}" if filter_field && verbose > 2
|
66
66
|
|
67
|
-
items = Firestore.new.
|
67
|
+
items = Firestore.new.send(type)
|
68
68
|
|
69
69
|
# Filter by field
|
70
70
|
items.select! { |item| item.send(filter_field).downcase =~ /#{filter_value&.downcase}/ } if filter_field
|
data/lib/icarus/mod/firestore.rb
CHANGED
@@ -13,10 +13,15 @@ module Icarus
|
|
13
13
|
def initialize
|
14
14
|
@client = Google::Cloud::Firestore.new(credentials: Config.firebase.credentials.to_h)
|
15
15
|
@collections = Config.firebase.collections
|
16
|
+
@repositories = repositories
|
17
|
+
@modinfo = modinfo
|
18
|
+
@toolinfo = toolinfo
|
19
|
+
@mods = mods
|
20
|
+
@tools = tools
|
16
21
|
end
|
17
22
|
|
18
|
-
def
|
19
|
-
@
|
23
|
+
def repositories
|
24
|
+
@repositories ||= list(:repositories)
|
20
25
|
end
|
21
26
|
|
22
27
|
def modinfo
|
@@ -36,35 +41,7 @@ module Icarus
|
|
36
41
|
end
|
37
42
|
|
38
43
|
def find_by_type(type:, name:, author:)
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
def get_list(type)
|
43
|
-
raise "Invalid type: #{type} - unknown collection" unless collections.respond_to?(type)
|
44
|
-
|
45
|
-
@client.doc(collections.send(type)).get[:list]
|
46
|
-
end
|
47
|
-
|
48
|
-
def list(type)
|
49
|
-
case type.to_sym
|
50
|
-
when :modinfo, :toolinfo, :repositories
|
51
|
-
get_list(type)
|
52
|
-
when :mods, :tools
|
53
|
-
@client.col(collections.send(type)).get.map do |doc|
|
54
|
-
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
|
55
|
-
klass.new(doc.data, id: doc.document_id, created: doc.create_time, updated: doc.update_time)
|
56
|
-
end
|
57
|
-
else
|
58
|
-
raise "Invalid type: #{type}"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def update_or_create(type, payload, merge:)
|
63
|
-
doc_id = payload.id || find_by_type(type:, name: payload.name, author: payload.author)&.id
|
64
|
-
|
65
|
-
return @client.doc("#{collections.send(type)}/#{doc_id}").set(payload.to_h, merge:) if doc_id
|
66
|
-
|
67
|
-
@client.col(collections.send(type)).add(payload.to_h)
|
44
|
+
instance_variable_get("@#{type}").find { |obj| obj.name == name && obj.author == author }
|
68
45
|
end
|
69
46
|
|
70
47
|
def update(type, payload, merge: false)
|
@@ -98,6 +75,28 @@ module Icarus
|
|
98
75
|
|
99
76
|
private
|
100
77
|
|
78
|
+
def list(type)
|
79
|
+
case type.to_sym
|
80
|
+
when :modinfo, :toolinfo, :repositories
|
81
|
+
@client.doc(collections.send(type)).get[:list]
|
82
|
+
when :mods, :tools
|
83
|
+
@client.col(collections.send(type)).get.map do |doc|
|
84
|
+
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
|
85
|
+
klass.new(doc.data, id: doc.document_id, created: doc.create_time, updated: doc.update_time)
|
86
|
+
end
|
87
|
+
else
|
88
|
+
raise "Invalid type: #{type}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def update_or_create(type, payload, merge:)
|
93
|
+
doc_id = payload.id || find_by_type(type:, name: payload.name, author: payload.author)&.id
|
94
|
+
|
95
|
+
return @client.doc("#{collections.send(type)}/#{doc_id}").set(payload.to_h, merge:) if doc_id
|
96
|
+
|
97
|
+
@client.col(collections.send(type)).add(payload.to_h)
|
98
|
+
end
|
99
|
+
|
101
100
|
def pluralize(type)
|
102
101
|
type.to_s.end_with?("s") ? type.to_s : "#{type}s"
|
103
102
|
end
|
@@ -9,15 +9,24 @@ module Icarus
|
|
9
9
|
class Modinfo < Baseinfo
|
10
10
|
HASHKEYS = %i[name author version compatibility description long_description files fileType fileURL imageURL readmeURL].freeze
|
11
11
|
|
12
|
+
# rubocop:disable Metrics/AbcSize
|
12
13
|
def to_h
|
13
|
-
HASHKEYS.each_with_object({}) do |key, hash|
|
14
|
-
next if
|
15
|
-
next if %i[fileType fileURL].include?(key.to_sym) && !@data[:files].nil?
|
14
|
+
db_hash = HASHKEYS.each_with_object({}) do |key, hash|
|
15
|
+
# next if %i[fileType fileURL].include?(key.to_sym)
|
16
16
|
next if key == :long_description && @data[:long_description].nil?
|
17
17
|
|
18
18
|
hash[key] = @data[key]
|
19
19
|
end
|
20
|
+
|
21
|
+
db_hash[:files] = { @data[:fileType].downcase.to_sym => @data[:fileURL] } if db_hash[:files].nil? && !@data[:fileType].nil?
|
22
|
+
|
23
|
+
# Remove this once all mods have been updated
|
24
|
+
db_hash[:fileType] = db_hash[:files].keys.first.to_s if db_hash[:fileType].nil? && !db_hash[:files].nil?
|
25
|
+
db_hash[:fileURL] = db_hash[:files].values.first if db_hash[:fileURL].nil? && !db_hash[:files].nil?
|
26
|
+
|
27
|
+
db_hash
|
20
28
|
end
|
29
|
+
# rubocop:enable Metrics/AbcSize
|
21
30
|
|
22
31
|
def file_types
|
23
32
|
files&.keys || [@data[:fileType] || "pak"]
|
data/lib/icarus/mod/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Icarus-Mod-Tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donovan Young
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2023-02-04 00:00:00.000000000 Z
|
@@ -76,11 +76,11 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- ".rspec"
|
78
78
|
- ".rubocop.yml"
|
79
|
-
-
|
79
|
+
- CHANGELOG.md
|
80
80
|
- Gemfile
|
81
81
|
- Gemfile.lock
|
82
82
|
- Guardfile
|
83
|
-
- LICENSE
|
83
|
+
- LICENSE
|
84
84
|
- README.md
|
85
85
|
- Rakefile
|
86
86
|
- exe/imt
|
@@ -113,9 +113,9 @@ licenses: []
|
|
113
113
|
metadata:
|
114
114
|
homepage_uri: https://github.com/DonovanMods/icarus-mod-tools
|
115
115
|
source_code_uri: https://github.com/DonovanMods/icarus-mod-tools
|
116
|
-
changelog_uri: https://github.com/DonovanMods/icarus-mod-tools/blob/main/
|
116
|
+
changelog_uri: https://github.com/DonovanMods/icarus-mod-tools/blob/main/CHANGELOG.md
|
117
117
|
rubygems_mfa_required: 'true'
|
118
|
-
post_install_message:
|
118
|
+
post_install_message:
|
119
119
|
rdoc_options: []
|
120
120
|
require_paths:
|
121
121
|
- lib
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubygems_version: 3.3.26
|
135
|
-
signing_key:
|
135
|
+
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Various tools for Icarus Modding
|
138
138
|
test_files: []
|