Icarus-Mod-Tools 1.5.1 → 1.7.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/.rspec +0 -0
- data/.rubocop.yml +0 -0
- data/CHANGES.md +5 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +10 -7
- data/Guardfile +0 -0
- data/LICENSE.md +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/icarus-mod-tools.gemspec +1 -1
- data/imtconfig.sample.json +0 -0
- data/lib/icarus/mod/cli/add.rb +0 -0
- data/lib/icarus/mod/cli/base.rb +3 -2
- data/lib/icarus/mod/cli/command.rb +4 -0
- data/lib/icarus/mod/cli/list.rb +0 -0
- data/lib/icarus/mod/cli/subcommand_base.rb +0 -0
- data/lib/icarus/mod/cli/sync.rb +7 -1
- data/lib/icarus/mod/cli/validate.rb +45 -0
- data/lib/icarus/mod/config.rb +0 -0
- data/lib/icarus/mod/firestore.rb +0 -0
- data/lib/icarus/mod/github.rb +0 -0
- data/lib/icarus/mod/tools/mod_sync.rb +0 -0
- data/lib/icarus/mod/tools/modinfo.rb +43 -3
- data/lib/icarus/mod/tools/modinfo_sync.rb +0 -0
- data/lib/icarus/mod/tools/modinfo_validate.rb +16 -0
- data/lib/icarus/mod/tools/sync_helpers.rb +0 -0
- data/lib/icarus/mod/tools.rb +0 -0
- data/lib/icarus/mod/version.rb +1 -1
- data/sig/database/sync/sync.rbs +0 -0
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce305187a0a91ed7a8574f418d6c2afc50380323b3d5fe4d4fa215b61bc1e59c
|
|
4
|
+
data.tar.gz: 28b19fe811f5eec20f5c79d2b9e567a2703cd266a7f1cf122df328f1018c04fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49adc06788394d6015d23d33312a63058fcfb57bd0585c60325383501ee8950e5ba31fc90be13c765d45d397eb099aa494c9723a1bdaef379a4a62c8842f3ee8
|
|
7
|
+
data.tar.gz: a233c109a0f8addcbba424b460ca2cca4100de71e5c771ae79487f13504f1b31ea195c07aa93108df4bc0de5e6fc2a75c09cd4dbf84acafe267c1333da8df3ad
|
data/.rspec
CHANGED
|
File without changes
|
data/.rubocop.yml
CHANGED
|
File without changes
|
data/CHANGES.md
CHANGED
|
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## History (reverse chronological order)
|
|
6
6
|
|
|
7
|
+
### v1.6 - 2023-15
|
|
8
|
+
|
|
9
|
+
- Added `--check` to `sync mods` to check for updates without downloading
|
|
10
|
+
- Added support for `readmeURL` in `modinfo.json`
|
|
11
|
+
|
|
7
12
|
### v1.5 - 2023-08
|
|
8
13
|
|
|
9
14
|
- Moved source into the DonovanMods Github organization
|
data/Gemfile
CHANGED
|
File without changes
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
Icarus-Mod-Tools (1.
|
|
4
|
+
Icarus-Mod-Tools (1.7.0)
|
|
5
5
|
google-cloud-firestore (~> 2.7)
|
|
6
6
|
octokit (~> 6.0)
|
|
7
|
+
paint (~> 2.3)
|
|
7
8
|
thor (~> 1.2)
|
|
8
9
|
|
|
9
10
|
GEM
|
|
@@ -15,7 +16,7 @@ GEM
|
|
|
15
16
|
coderay (1.1.3)
|
|
16
17
|
concurrent-ruby (1.1.10)
|
|
17
18
|
diff-lcs (1.5.0)
|
|
18
|
-
faraday (2.7.
|
|
19
|
+
faraday (2.7.3)
|
|
19
20
|
faraday-net_http (>= 2.0, < 3.1)
|
|
20
21
|
ruby2_keywords (>= 0.0.4)
|
|
21
22
|
faraday-net_http (3.0.2)
|
|
@@ -46,10 +47,10 @@ GEM
|
|
|
46
47
|
gapic-common (>= 0.10, < 2.a)
|
|
47
48
|
google-cloud-errors (~> 1.0)
|
|
48
49
|
google-cloud-location (>= 0.0, < 2.a)
|
|
49
|
-
google-cloud-location (0.
|
|
50
|
-
gapic-common (>= 0.
|
|
50
|
+
google-cloud-location (0.3.0)
|
|
51
|
+
gapic-common (>= 0.16.0, < 2.a)
|
|
51
52
|
google-cloud-errors (~> 1.0)
|
|
52
|
-
google-protobuf (3.21.12-x86_64-
|
|
53
|
+
google-protobuf (3.21.12-x86_64-darwin)
|
|
53
54
|
googleapis-common-protos (1.4.0)
|
|
54
55
|
google-protobuf (~> 3.14)
|
|
55
56
|
googleapis-common-protos-types (~> 1.2)
|
|
@@ -63,7 +64,7 @@ GEM
|
|
|
63
64
|
multi_json (~> 1.11)
|
|
64
65
|
os (>= 0.9, < 2.0)
|
|
65
66
|
signet (>= 0.16, < 2.a)
|
|
66
|
-
grpc (1.50.0-x86_64-
|
|
67
|
+
grpc (1.50.0-x86_64-darwin)
|
|
67
68
|
google-protobuf (~> 3.21)
|
|
68
69
|
googleapis-common-protos-types (~> 1.0)
|
|
69
70
|
guard (2.18.0)
|
|
@@ -97,6 +98,7 @@ GEM
|
|
|
97
98
|
faraday (>= 1, < 3)
|
|
98
99
|
sawyer (~> 0.9)
|
|
99
100
|
os (1.1.4)
|
|
101
|
+
paint (2.3.0)
|
|
100
102
|
parallel (1.22.1)
|
|
101
103
|
parser (3.2.0.0)
|
|
102
104
|
ast (~> 2.4.1)
|
|
@@ -137,7 +139,7 @@ GEM
|
|
|
137
139
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
138
140
|
rubocop-ast (1.24.1)
|
|
139
141
|
parser (>= 3.1.1.0)
|
|
140
|
-
rubocop-rspec (2.
|
|
142
|
+
rubocop-rspec (2.17.0)
|
|
141
143
|
rubocop (~> 1.33)
|
|
142
144
|
ruby-progressbar (1.11.0)
|
|
143
145
|
ruby2_keywords (0.0.5)
|
|
@@ -154,6 +156,7 @@ GEM
|
|
|
154
156
|
unicode-display_width (2.4.2)
|
|
155
157
|
|
|
156
158
|
PLATFORMS
|
|
159
|
+
x86_64-darwin-22
|
|
157
160
|
x86_64-linux
|
|
158
161
|
|
|
159
162
|
DEPENDENCIES
|
data/Guardfile
CHANGED
|
File without changes
|
data/LICENSE.md
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
File without changes
|
data/Rakefile
CHANGED
|
File without changes
|
data/icarus-mod-tools.gemspec
CHANGED
|
@@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
# spec.add_dependency "example-gem", "~> 1.0"
|
|
34
34
|
spec.add_dependency "google-cloud-firestore", "~> 2.7"
|
|
35
35
|
spec.add_dependency "octokit", "~> 6.0"
|
|
36
|
+
spec.add_dependency "paint", "~> 2.3"
|
|
36
37
|
spec.add_dependency "thor", "~> 1.2"
|
|
37
|
-
|
|
38
38
|
# For more information and examples about making a new gem, check out our
|
|
39
39
|
# guide at: https://bundler.io/guides/creating_gem.html
|
|
40
40
|
end
|
data/imtconfig.sample.json
CHANGED
|
File without changes
|
data/lib/icarus/mod/cli/add.rb
CHANGED
|
File without changes
|
data/lib/icarus/mod/cli/base.rb
CHANGED
|
@@ -5,6 +5,7 @@ require "cli/subcommand_base"
|
|
|
5
5
|
require "cli/sync"
|
|
6
6
|
require "cli/list"
|
|
7
7
|
require "cli/add"
|
|
8
|
+
require "cli/validate"
|
|
8
9
|
|
|
9
10
|
module Icarus
|
|
10
11
|
module Mod
|
|
@@ -35,6 +36,9 @@ module Icarus
|
|
|
35
36
|
|
|
36
37
|
desc "add", "Adds entries to the databases"
|
|
37
38
|
subcommand "add", Add
|
|
39
|
+
|
|
40
|
+
desc "validate", "Validates various entries"
|
|
41
|
+
subcommand "validate", Validate
|
|
38
42
|
end
|
|
39
43
|
end
|
|
40
44
|
end
|
data/lib/icarus/mod/cli/list.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/icarus/mod/cli/sync.rb
CHANGED
|
@@ -28,6 +28,7 @@ module Icarus
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
desc "mods", "Reads from 'meta/modinfo/list' and updates the 'mods' database accordingly"
|
|
31
|
+
method_option :check, type: :boolean, default: false, desc: "Validate modinfo without applying changes"
|
|
31
32
|
def mods
|
|
32
33
|
modsync = Icarus::Mod::Tools::ModSync.new
|
|
33
34
|
|
|
@@ -37,11 +38,16 @@ module Icarus
|
|
|
37
38
|
puts "Retrieving mod Data..." if verbose?
|
|
38
39
|
mod_array = modsync.mods
|
|
39
40
|
|
|
41
|
+
return if options[:check]
|
|
42
|
+
|
|
40
43
|
puts "Updating mod Data..." if verbose?
|
|
41
44
|
modinfo_array.each do |mod|
|
|
42
45
|
verb = "Creating"
|
|
43
|
-
doc_id = modsync.find_mod(mod)
|
|
44
46
|
|
|
47
|
+
puts "Validating modinfo Data for #{mod.uniq_name}..." if verbose > 2
|
|
48
|
+
warn "Skipping mod #{mod.uniq_name} due to validation errors" && next unless mod.validate
|
|
49
|
+
|
|
50
|
+
doc_id = modsync.find_mod(mod)
|
|
45
51
|
if doc_id
|
|
46
52
|
puts "Found existing mod #{mod.name} at #{doc_id}" if verbose > 2
|
|
47
53
|
mod.id = doc_id
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "tools/modinfo_validate"
|
|
4
|
+
|
|
5
|
+
module Icarus
|
|
6
|
+
module Mod
|
|
7
|
+
module CLI
|
|
8
|
+
# Sync CLI command definitions
|
|
9
|
+
class Validate < SubcommandBase
|
|
10
|
+
desc "modinfo", "Reads modinfo data from 'meta/modinfo/list' and Validates syntax of modfiles"
|
|
11
|
+
def modinfo
|
|
12
|
+
exit_code = 0
|
|
13
|
+
modinfo_validate = Icarus::Mod::Tools::ModinfoValidate.new
|
|
14
|
+
|
|
15
|
+
puts "Validating Entries..." if verbose?
|
|
16
|
+
max_length = modinfo_validate.modinfo_array.map { |modinfo| modinfo.uniq_name.length }.max
|
|
17
|
+
|
|
18
|
+
modinfo_validate.modinfo_array.each do |modinfo|
|
|
19
|
+
print Paint[format("%s %-#{max_length}s", "Running validation steps on", modinfo.uniq_name), :cyan, :bright] if verbose > 1
|
|
20
|
+
|
|
21
|
+
modinfo.validate
|
|
22
|
+
|
|
23
|
+
if modinfo.errors.empty? && modinfo.warnings.empty?
|
|
24
|
+
puts Paint["SUCCESS", :green, :bright] if verbose > 1
|
|
25
|
+
next
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if modinfo.errors.any?
|
|
29
|
+
exit_code = 1
|
|
30
|
+
puts Paint["ERROR", :red, :bright] if verbose? && verbose > 1
|
|
31
|
+
warn modinfo.errors.map { |error| Paint[error, :red] }.join("\n")
|
|
32
|
+
puts "\n" if verbose > 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
puts Paint["WARNING", :yellow, :bright] if modinfo.warnings.any? && verbose > 1
|
|
36
|
+
puts modinfo.warnings.map { |warning| Paint["#{warning} in #{modinfo.uniq_name}", :yellow] }.join("\n")
|
|
37
|
+
puts "\n" if verbose > 1
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
exit exit_code
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/lib/icarus/mod/config.rb
CHANGED
|
File without changes
|
data/lib/icarus/mod/firestore.rb
CHANGED
|
File without changes
|
data/lib/icarus/mod/github.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -5,14 +5,17 @@ module Icarus
|
|
|
5
5
|
module Tools
|
|
6
6
|
# Sync methods
|
|
7
7
|
class Modinfo
|
|
8
|
-
attr_reader :data, :id, :created_at, :updated_at
|
|
8
|
+
attr_reader :data, :errors, :id, :created_at, :updated_at, :warnings
|
|
9
9
|
|
|
10
|
-
HASHKEYS = %i[name author version compatibility description long_description fileType fileURL imageURL].freeze
|
|
10
|
+
HASHKEYS = %i[name author version compatibility description long_description fileType fileURL imageURL readmeURL].freeze
|
|
11
11
|
|
|
12
12
|
def initialize(data, id: nil, created: nil, updated: nil)
|
|
13
13
|
@id = id
|
|
14
14
|
@created_at = created
|
|
15
15
|
@updated_at = updated
|
|
16
|
+
@errors = []
|
|
17
|
+
@warnings = []
|
|
18
|
+
|
|
16
19
|
read(data)
|
|
17
20
|
end
|
|
18
21
|
|
|
@@ -20,6 +23,10 @@ module Icarus
|
|
|
20
23
|
@data = data.is_a?(String) ? JSON.parse(data, symbolize_names: true) : data
|
|
21
24
|
end
|
|
22
25
|
|
|
26
|
+
def uniq_name
|
|
27
|
+
"#{author}/#{name}"
|
|
28
|
+
end
|
|
29
|
+
|
|
23
30
|
# rubocop:disable Naming/MethodName
|
|
24
31
|
def fileType
|
|
25
32
|
@data[:fileType] || "pak"
|
|
@@ -40,10 +47,27 @@ module Icarus
|
|
|
40
47
|
long_description:,
|
|
41
48
|
fileType:,
|
|
42
49
|
fileURL:,
|
|
43
|
-
imageURL
|
|
50
|
+
imageURL:,
|
|
51
|
+
readmeURL:
|
|
44
52
|
}
|
|
45
53
|
end
|
|
46
54
|
|
|
55
|
+
def validate
|
|
56
|
+
@warnings << "Version should not be blank" unless validate_string(version)
|
|
57
|
+
|
|
58
|
+
%w[name author description].each do |key|
|
|
59
|
+
@errors << "#{key.capitalize} cannot be blank" unless validate_string(@data[key.to_sym])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
@errors << "Invalid FileType: #{fileType || "blank"}" unless validate_filetype(fileType)
|
|
63
|
+
|
|
64
|
+
%w[fileURL imageURL readmeURL].each do |key|
|
|
65
|
+
@errors << "Invalid URL #{key.capitalize}: #{@data[key.to_sym] || "blank"}" unless validate_url(@data[key.to_sym])
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
@errors.empty?
|
|
69
|
+
end
|
|
70
|
+
|
|
47
71
|
def method_missing(method_name, *_args, &)
|
|
48
72
|
@data[method_name.to_sym]&.strip
|
|
49
73
|
end
|
|
@@ -51,6 +75,22 @@ module Icarus
|
|
|
51
75
|
def respond_to_missing?(method_name, include_private = false)
|
|
52
76
|
HASHKEYS.include?(method_name.to_sym) || super
|
|
53
77
|
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
def validate_url(url)
|
|
82
|
+
return true if url.nil? || url.empty?
|
|
83
|
+
|
|
84
|
+
url =~ URI::DEFAULT_PARSER.make_regexp
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def validate_filetype(filetype)
|
|
88
|
+
%w[pak zip exmod].include?(filetype.downcase)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def validate_string(string)
|
|
92
|
+
!(string.nil? || string.empty?)
|
|
93
|
+
end
|
|
54
94
|
end
|
|
55
95
|
end
|
|
56
96
|
end
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Icarus
|
|
4
|
+
module Mod
|
|
5
|
+
module Tools
|
|
6
|
+
# Validate Methods
|
|
7
|
+
class ModinfoValidate
|
|
8
|
+
attr_reader :modinfo_array
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
@modinfo_array = ModSync.new.modinfo_array
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
File without changes
|
data/lib/icarus/mod/tools.rb
CHANGED
|
File without changes
|
data/lib/icarus/mod/version.rb
CHANGED
data/sig/database/sync/sync.rbs
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Donovan Young
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-01-
|
|
11
|
+
date: 2023-01-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: google-cloud-firestore
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '6.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: paint
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '2.3'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '2.3'
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: thor
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -78,6 +92,7 @@ files:
|
|
|
78
92
|
- lib/icarus/mod/cli/list.rb
|
|
79
93
|
- lib/icarus/mod/cli/subcommand_base.rb
|
|
80
94
|
- lib/icarus/mod/cli/sync.rb
|
|
95
|
+
- lib/icarus/mod/cli/validate.rb
|
|
81
96
|
- lib/icarus/mod/config.rb
|
|
82
97
|
- lib/icarus/mod/firestore.rb
|
|
83
98
|
- lib/icarus/mod/github.rb
|
|
@@ -85,6 +100,7 @@ files:
|
|
|
85
100
|
- lib/icarus/mod/tools/mod_sync.rb
|
|
86
101
|
- lib/icarus/mod/tools/modinfo.rb
|
|
87
102
|
- lib/icarus/mod/tools/modinfo_sync.rb
|
|
103
|
+
- lib/icarus/mod/tools/modinfo_validate.rb
|
|
88
104
|
- lib/icarus/mod/tools/sync_helpers.rb
|
|
89
105
|
- lib/icarus/mod/version.rb
|
|
90
106
|
- sig/database/sync/sync.rbs
|