Icarus-Mod-Tools 2.1.2 → 2.1.4
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/.standard.yml +2 -0
- data/.standard_rubocop_extensions.yml +10 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +37 -24
- data/Rakefile +3 -7
- data/lib/icarus/mod/cli/base.rb +4 -4
- data/lib/icarus/mod/cli/list.rb +3 -3
- data/lib/icarus/mod/cli/subcommand_base.rb +2 -2
- data/lib/icarus/mod/cli/sync.rb +22 -11
- data/lib/icarus/mod/firestore.rb +11 -11
- data/lib/icarus/mod/github.rb +4 -4
- data/lib/icarus/mod/tools/baseinfo.rb +3 -3
- data/lib/icarus/mod/tools/modinfo.rb +1 -1
- data/lib/icarus/mod/tools/sync/mods.rb +1 -1
- data/lib/icarus/mod/tools/sync/tools.rb +1 -1
- data/lib/icarus/mod/tools/validator.rb +7 -7
- data/lib/icarus/mod/version.rb +1 -1
- metadata +4 -3
- data/.rubocop.yml +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6567527e650542f138580d498b0096d41595a10703b25a572ffc624baba6610
|
|
4
|
+
data.tar.gz: '09e582fbbd638e722b5bd54a232f491f94d190226015d9d95ca0c26d126d57c8'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 615be569c373d31071b5ee747a4ad28183d5db7cefc0409105a42511bd853ec9a3a89aff3c187a1908b0ca16f83e2f613db88899b329ca3358804542fe0f31fd
|
|
7
|
+
data.tar.gz: f496b73c26b7b98afbcc7a8521b1d955116dfb7fedc8b0999d87baaefcb917128310ff0122f35aa8c492f7e358f0c4e59d7e68361cc49ff5a59f700aa4ce9490
|
data/.standard.yml
ADDED
data/Gemfile
CHANGED
|
@@ -8,10 +8,12 @@ gemspec
|
|
|
8
8
|
gem "rake", "~> 13.0"
|
|
9
9
|
|
|
10
10
|
group :develop do
|
|
11
|
+
gem "fuubar"
|
|
11
12
|
gem "guard", "~> 2.18"
|
|
12
13
|
gem "guard-rspec", "~> 4.7"
|
|
13
14
|
gem "pry", "~> 0.14.1"
|
|
14
15
|
gem "rspec", "~> 3.12"
|
|
15
16
|
gem "rubocop", "~> 1.41"
|
|
16
17
|
gem "rubocop-rspec", "~> 2.16", require: false
|
|
18
|
+
gem "standard"
|
|
17
19
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
Icarus-Mod-Tools (2.1.
|
|
4
|
+
Icarus-Mod-Tools (2.1.4)
|
|
5
5
|
google-cloud-firestore (~> 2.7)
|
|
6
6
|
octokit (~> 6.0)
|
|
7
7
|
paint (~> 2.3)
|
|
@@ -14,17 +14,20 @@ GEM
|
|
|
14
14
|
public_suffix (>= 2.0.2, < 6.0)
|
|
15
15
|
ast (2.4.2)
|
|
16
16
|
coderay (1.1.3)
|
|
17
|
-
concurrent-ruby (1.2.
|
|
17
|
+
concurrent-ruby (1.2.2)
|
|
18
18
|
diff-lcs (1.5.0)
|
|
19
19
|
faraday (2.7.4)
|
|
20
20
|
faraday-net_http (>= 2.0, < 3.1)
|
|
21
21
|
ruby2_keywords (>= 0.0.4)
|
|
22
22
|
faraday-net_http (3.0.2)
|
|
23
|
-
faraday-retry (2.
|
|
23
|
+
faraday-retry (2.1.0)
|
|
24
24
|
faraday (~> 2.0)
|
|
25
25
|
ffi (1.15.5)
|
|
26
26
|
formatador (1.1.0)
|
|
27
|
-
|
|
27
|
+
fuubar (2.5.1)
|
|
28
|
+
rspec-core (~> 3.0)
|
|
29
|
+
ruby-progressbar (~> 1.4)
|
|
30
|
+
gapic-common (0.18.0)
|
|
28
31
|
faraday (>= 1.9, < 3.a)
|
|
29
32
|
faraday-retry (>= 1.0, < 3.a)
|
|
30
33
|
google-protobuf (~> 3.14)
|
|
@@ -37,34 +40,34 @@ GEM
|
|
|
37
40
|
google-cloud-errors (~> 1.0)
|
|
38
41
|
google-cloud-env (1.6.0)
|
|
39
42
|
faraday (>= 0.17.3, < 3.0)
|
|
40
|
-
google-cloud-errors (1.3.
|
|
41
|
-
google-cloud-firestore (2.
|
|
43
|
+
google-cloud-errors (1.3.1)
|
|
44
|
+
google-cloud-firestore (2.11.0)
|
|
42
45
|
concurrent-ruby (~> 1.0)
|
|
43
46
|
google-cloud-core (~> 1.5)
|
|
44
|
-
google-cloud-firestore-v1 (~> 0.
|
|
47
|
+
google-cloud-firestore-v1 (~> 0.10)
|
|
45
48
|
rbtree (~> 0.4.2)
|
|
46
|
-
google-cloud-firestore-v1 (0.
|
|
47
|
-
gapic-common (>= 0.
|
|
49
|
+
google-cloud-firestore-v1 (0.10.0)
|
|
50
|
+
gapic-common (>= 0.17.1, < 2.a)
|
|
48
51
|
google-cloud-errors (~> 1.0)
|
|
49
|
-
google-cloud-location (>= 0.
|
|
50
|
-
google-cloud-location (0.
|
|
51
|
-
gapic-common (>= 0.
|
|
52
|
+
google-cloud-location (>= 0.4, < 2.a)
|
|
53
|
+
google-cloud-location (0.4.0)
|
|
54
|
+
gapic-common (>= 0.17.1, < 2.a)
|
|
52
55
|
google-cloud-errors (~> 1.0)
|
|
53
|
-
google-protobuf (3.
|
|
56
|
+
google-protobuf (3.22.2-x86_64-linux)
|
|
54
57
|
googleapis-common-protos (1.4.0)
|
|
55
58
|
google-protobuf (~> 3.14)
|
|
56
59
|
googleapis-common-protos-types (~> 1.2)
|
|
57
60
|
grpc (~> 1.27)
|
|
58
61
|
googleapis-common-protos-types (1.5.0)
|
|
59
62
|
google-protobuf (~> 3.14)
|
|
60
|
-
googleauth (1.
|
|
63
|
+
googleauth (1.5.0)
|
|
61
64
|
faraday (>= 0.17.3, < 3.a)
|
|
62
65
|
jwt (>= 1.4, < 3.0)
|
|
63
66
|
memoist (~> 0.16)
|
|
64
67
|
multi_json (~> 1.11)
|
|
65
68
|
os (>= 0.9, < 2.0)
|
|
66
69
|
signet (>= 0.16, < 2.a)
|
|
67
|
-
grpc (1.
|
|
70
|
+
grpc (1.53.0-x86_64-linux)
|
|
68
71
|
google-protobuf (~> 3.21)
|
|
69
72
|
googleapis-common-protos-types (~> 1.0)
|
|
70
73
|
guard (2.18.0)
|
|
@@ -83,6 +86,7 @@ GEM
|
|
|
83
86
|
rspec (>= 2.99.0, < 4.0)
|
|
84
87
|
json (2.6.3)
|
|
85
88
|
jwt (2.7.0)
|
|
89
|
+
language_server-protocol (3.17.0.3)
|
|
86
90
|
listen (3.8.0)
|
|
87
91
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
88
92
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
@@ -94,13 +98,13 @@ GEM
|
|
|
94
98
|
notiffany (0.1.3)
|
|
95
99
|
nenv (~> 0.1)
|
|
96
100
|
shellany (~> 0.0)
|
|
97
|
-
octokit (6.0
|
|
101
|
+
octokit (6.1.0)
|
|
98
102
|
faraday (>= 1, < 3)
|
|
99
103
|
sawyer (~> 0.9)
|
|
100
104
|
os (1.1.4)
|
|
101
105
|
paint (2.3.0)
|
|
102
106
|
parallel (1.22.1)
|
|
103
|
-
parser (3.2.1.
|
|
107
|
+
parser (3.2.1.1)
|
|
104
108
|
ast (~> 2.4.1)
|
|
105
109
|
pry (0.14.2)
|
|
106
110
|
coderay (~> 1.1)
|
|
@@ -123,28 +127,31 @@ GEM
|
|
|
123
127
|
rspec-expectations (3.12.2)
|
|
124
128
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
125
129
|
rspec-support (~> 3.12.0)
|
|
126
|
-
rspec-mocks (3.12.
|
|
130
|
+
rspec-mocks (3.12.4)
|
|
127
131
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
128
132
|
rspec-support (~> 3.12.0)
|
|
129
133
|
rspec-support (3.12.0)
|
|
130
|
-
rubocop (1.
|
|
134
|
+
rubocop (1.48.1)
|
|
131
135
|
json (~> 2.3)
|
|
132
136
|
parallel (~> 1.10)
|
|
133
137
|
parser (>= 3.2.0.0)
|
|
134
138
|
rainbow (>= 2.2.2, < 4.0)
|
|
135
139
|
regexp_parser (>= 1.8, < 3.0)
|
|
136
140
|
rexml (>= 3.2.5, < 4.0)
|
|
137
|
-
rubocop-ast (>= 1.
|
|
141
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
|
138
142
|
ruby-progressbar (~> 1.7)
|
|
139
143
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
140
|
-
rubocop-ast (1.
|
|
144
|
+
rubocop-ast (1.28.0)
|
|
141
145
|
parser (>= 3.2.1.0)
|
|
142
|
-
rubocop-capybara (2.17.
|
|
146
|
+
rubocop-capybara (2.17.1)
|
|
143
147
|
rubocop (~> 1.41)
|
|
144
|
-
rubocop-
|
|
148
|
+
rubocop-performance (1.16.0)
|
|
149
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
150
|
+
rubocop-ast (>= 0.4.0)
|
|
151
|
+
rubocop-rspec (2.19.0)
|
|
145
152
|
rubocop (~> 1.33)
|
|
146
153
|
rubocop-capybara (~> 2.17)
|
|
147
|
-
ruby-progressbar (1.
|
|
154
|
+
ruby-progressbar (1.13.0)
|
|
148
155
|
ruby2_keywords (0.0.5)
|
|
149
156
|
sawyer (0.9.2)
|
|
150
157
|
addressable (>= 2.3.5)
|
|
@@ -155,6 +162,10 @@ GEM
|
|
|
155
162
|
faraday (>= 0.17.5, < 3.a)
|
|
156
163
|
jwt (>= 1.5, < 3.0)
|
|
157
164
|
multi_json (~> 1.10)
|
|
165
|
+
standard (1.25.3)
|
|
166
|
+
language_server-protocol (~> 3.17.0.2)
|
|
167
|
+
rubocop (~> 1.48.1)
|
|
168
|
+
rubocop-performance (~> 1.16.0)
|
|
158
169
|
thor (1.2.1)
|
|
159
170
|
unicode-display_width (2.4.2)
|
|
160
171
|
|
|
@@ -164,6 +175,7 @@ PLATFORMS
|
|
|
164
175
|
|
|
165
176
|
DEPENDENCIES
|
|
166
177
|
Icarus-Mod-Tools!
|
|
178
|
+
fuubar
|
|
167
179
|
guard (~> 2.18)
|
|
168
180
|
guard-rspec (~> 4.7)
|
|
169
181
|
pry (~> 0.14.1)
|
|
@@ -171,6 +183,7 @@ DEPENDENCIES
|
|
|
171
183
|
rspec (~> 3.12)
|
|
172
184
|
rubocop (~> 1.41)
|
|
173
185
|
rubocop-rspec (~> 2.16)
|
|
186
|
+
standard
|
|
174
187
|
|
|
175
188
|
BUNDLED WITH
|
|
176
189
|
2.3.26
|
data/Rakefile
CHANGED
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
4
|
require "rake/testtask"
|
|
5
5
|
require "rspec/core/rake_task"
|
|
6
|
-
require "
|
|
6
|
+
require "standard/rake"
|
|
7
7
|
|
|
8
|
-
RuboCop::RakeTask.new
|
|
9
|
-
|
|
10
|
-
# Default directory to look in is `/specs`
|
|
11
|
-
# Run with `rake spec`
|
|
12
8
|
RSpec::Core::RakeTask.new(:spec) do |task|
|
|
13
|
-
task.rspec_opts = ["--color", "--format", "
|
|
9
|
+
task.rspec_opts = ["--color", "--format", "Fuubar"]
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
task default: %i[spec
|
|
12
|
+
task default: %i[spec standard]
|
data/lib/icarus/mod/cli/base.rb
CHANGED
|
@@ -11,12 +11,12 @@ module Icarus
|
|
|
11
11
|
# The Base CLI class for Icarus Mod Tools. This is inherited by all subcommands.
|
|
12
12
|
class Base < Thor
|
|
13
13
|
class_option :config,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
aliases: "-C", type: :string, default: File.join(Dir.home, "/.imtconfig.json"),
|
|
15
|
+
desc: "Path to the config file"
|
|
16
16
|
|
|
17
17
|
class_option :version,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
aliases: "-V", type: :boolean,
|
|
19
|
+
desc: "Print the version and exit"
|
|
20
20
|
|
|
21
21
|
def self.exit_on_failure?
|
|
22
22
|
true
|
data/lib/icarus/mod/cli/list.rb
CHANGED
|
@@ -45,10 +45,10 @@ module Icarus
|
|
|
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::Toolinfo
|
|
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
|
-
filter
|
|
51
|
+
filter = !options[:filter].empty?
|
|
52
52
|
|
|
53
53
|
if filter
|
|
54
54
|
filter_field = options[:filter].first&.to_sym
|
|
@@ -90,7 +90,7 @@ module Icarus
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# Sort by field, optionally subsorting by name
|
|
93
|
-
(sort_field == :name ? items.sort_by(&:name) : items.sort_by { |item| [item.send(sort_field), item.name] }).each do |item|
|
|
93
|
+
((sort_field == :name) ? items.sort_by(&:name) : items.sort_by { |item| [item.send(sort_field), item.name] }).each do |item|
|
|
94
94
|
data_format = "%-<name>50s %-<author>20s v%-<version>10s%-<updated_at>20s"
|
|
95
95
|
data_format += " %-<id>20s %<description>s" if verbose > 1
|
|
96
96
|
|
|
@@ -8,8 +8,8 @@ module Icarus
|
|
|
8
8
|
# Base class for all subcommands
|
|
9
9
|
class SubcommandBase < Base
|
|
10
10
|
class_option :verbose,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
aliases: "-v", type: :boolean, repeatable: true, default: [true],
|
|
12
|
+
desc: "Increase verbosity. May be repeated for even more verbosity."
|
|
13
13
|
|
|
14
14
|
no_commands do
|
|
15
15
|
def check_false
|
data/lib/icarus/mod/cli/sync.rb
CHANGED
|
@@ -57,8 +57,12 @@ module Icarus
|
|
|
57
57
|
$firestore ||= Firestore.new
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
+
def success_or_failure(status)
|
|
61
|
+
format("%<status>10s", status: status ? Paint["Success", :green] : Paint["Failure", :red])
|
|
62
|
+
end
|
|
63
|
+
|
|
60
64
|
def sync_info(type)
|
|
61
|
-
sync = (type == :modinfo ? Icarus::Mod::Tools::Sync::ModinfoList : Icarus::Mod::Tools::Sync::ToolinfoList).new(client: firestore)
|
|
65
|
+
sync = ((type == :modinfo) ? Icarus::Mod::Tools::Sync::ModinfoList : Icarus::Mod::Tools::Sync::ToolinfoList).new(client: firestore)
|
|
62
66
|
|
|
63
67
|
puts "Retrieving repository Data..." if verbose?
|
|
64
68
|
repositories = sync.repositories
|
|
@@ -71,19 +75,19 @@ module Icarus
|
|
|
71
75
|
raise Icarus::Mod::Tools::Error, "no .json files found for #{type}" unless info_array&.any?
|
|
72
76
|
|
|
73
77
|
if options[:dry_run]
|
|
74
|
-
puts "Dry run; no changes will be made"
|
|
78
|
+
puts Paint["Dry run; no changes will be made", :orange, :bright]
|
|
75
79
|
return
|
|
76
80
|
end
|
|
77
81
|
|
|
78
|
-
puts "Saving to Firestore..." if verbose?
|
|
82
|
+
puts Paint["Saving to Firestore...", :black] if verbose?
|
|
79
83
|
response = sync.update(info_array)
|
|
80
|
-
puts response ? "Success" : "Failure (may be no changes)" if verbose?
|
|
84
|
+
puts response ? Paint["Success", :green, :bright] : Paint["Failure (may be no changes)", :red, :bright] if verbose?
|
|
81
85
|
rescue Icarus::Mod::Tools::Error => e
|
|
82
86
|
warn e.message
|
|
83
87
|
end
|
|
84
88
|
|
|
85
89
|
def sync_list(type)
|
|
86
|
-
sync = (type == :mods ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Tools).new(client: firestore)
|
|
90
|
+
sync = ((type == :mods) ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Tools).new(client: firestore)
|
|
87
91
|
|
|
88
92
|
puts "Syncing #{type} to #{Config.firebase.collections.send(type)}" if verbose > 1
|
|
89
93
|
|
|
@@ -100,11 +104,18 @@ module Icarus
|
|
|
100
104
|
verb = "Creating"
|
|
101
105
|
|
|
102
106
|
puts "Validating Info Data for #{list.uniq_name}..." if verbose > 2
|
|
103
|
-
|
|
107
|
+
unless list.valid?
|
|
108
|
+
warn Paint["Skipping List #{list.uniq_name} due to validation errors", :yellow, :bright]
|
|
109
|
+
if verbose > 1
|
|
110
|
+
warn list.errors.map { |error| Paint[error, :red] }.join("\n")
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
next
|
|
114
|
+
end
|
|
104
115
|
|
|
105
116
|
doc_id = sync.find(list)
|
|
106
117
|
if doc_id
|
|
107
|
-
puts "Found existing list #{list.name} at #{doc_id}" if verbose > 2
|
|
118
|
+
puts Paint["Found existing list #{list.name} at #{doc_id}", :black] if verbose > 2
|
|
108
119
|
list.id = doc_id
|
|
109
120
|
verb = "Updating"
|
|
110
121
|
end
|
|
@@ -112,16 +123,16 @@ module Icarus
|
|
|
112
123
|
print format("#{verb} %-<name>60s", name: "'#{list.author || "NoOne"}/#{list.name || "Unnamed"}'") if verbose > 1
|
|
113
124
|
|
|
114
125
|
if options[:dry_run]
|
|
115
|
-
puts "Dry run; no changes will be made" if verbose > 1
|
|
126
|
+
puts Paint["Dry run; no changes will be made", :yellow] if verbose > 1
|
|
116
127
|
next
|
|
117
128
|
end
|
|
118
129
|
|
|
119
130
|
response = sync.update(list)
|
|
120
|
-
puts
|
|
131
|
+
puts success_or_failure(status: response) if verbose > 1
|
|
121
132
|
end
|
|
122
133
|
|
|
123
134
|
if options[:dry_run]
|
|
124
|
-
puts "Dry run; no changes will be made" if verbose?
|
|
135
|
+
puts Paint["Dry run; no changes will be made", :white] if verbose?
|
|
125
136
|
return
|
|
126
137
|
end
|
|
127
138
|
|
|
@@ -135,7 +146,7 @@ module Icarus
|
|
|
135
146
|
delete_array.each do |list|
|
|
136
147
|
print format("Deleting %-<name>60s", name: "'#{list.author || "NoOne"}/#{list.name || "Unnamed'"}") if verbose > 1
|
|
137
148
|
response = sync.delete(list)
|
|
138
|
-
puts
|
|
149
|
+
puts success_or_failure(status: response) if verbose > 1
|
|
139
150
|
end
|
|
140
151
|
|
|
141
152
|
puts "Deleted #{delete_array.count} outdated items" if verbose?
|
data/lib/icarus/mod/firestore.rb
CHANGED
|
@@ -48,16 +48,16 @@ module Icarus
|
|
|
48
48
|
raise "You must specify a payload to update" if payload&.empty? || payload.nil?
|
|
49
49
|
|
|
50
50
|
response = case type.to_sym
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
when :modinfo, :toolinfo
|
|
52
|
+
update_array = (send(type) + [payload]).flatten.uniq
|
|
53
|
+
@client.doc(collections.meta.send(type)).set({list: update_array}, merge:) if update_array.any?
|
|
54
|
+
when :repositories
|
|
55
|
+
@client.doc(collections.meta.repositories).set({list: payload}, merge:)
|
|
56
|
+
when :mod, :tool
|
|
57
|
+
create_or_update(pluralize(type), payload, merge:)
|
|
58
|
+
else
|
|
59
|
+
raise "Invalid type: #{type}"
|
|
60
|
+
end
|
|
61
61
|
|
|
62
62
|
response.is_a?(Google::Cloud::Firestore::DocumentReference) || response.is_a?(Google::Cloud::Firestore::CommitResponse::WriteResult)
|
|
63
63
|
end
|
|
@@ -81,7 +81,7 @@ module Icarus
|
|
|
81
81
|
@client.doc(collections.meta.send(type)).get[:list]
|
|
82
82
|
when :mods, :tools
|
|
83
83
|
@client.col(collections.send(type)).get.map do |doc|
|
|
84
|
-
klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
|
|
84
|
+
klass = (type == :mods) ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
|
|
85
85
|
klass.new(doc.data, id: doc.document_id, created: doc.create_time, updated: doc.update_time)
|
|
86
86
|
end
|
|
87
87
|
else
|
data/lib/icarus/mod/github.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Icarus
|
|
|
34
34
|
use_cache = @resources.any? && cache
|
|
35
35
|
|
|
36
36
|
if use_cache
|
|
37
|
-
@resources.each { |file| block.call(file) } if
|
|
37
|
+
@resources.each { |file| block.call(file) } if block
|
|
38
38
|
else
|
|
39
39
|
@client.contents(repository, path:).each do |entry|
|
|
40
40
|
if entry[:type] == "dir"
|
|
@@ -42,16 +42,16 @@ module Icarus
|
|
|
42
42
|
next # we don't need directories in our output
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
block
|
|
45
|
+
block&.call(entry)
|
|
46
46
|
@resources << entry # cache the file
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
@resources unless
|
|
50
|
+
@resources unless block
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def find(pattern)
|
|
54
|
-
all_files { |file| return file if
|
|
54
|
+
all_files { |file| return file if /#{pattern}/i.match?(file[:name]) }
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def get_contents(url)
|
|
@@ -102,11 +102,11 @@ module Icarus
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def method_missing(method_name, *_args, &_block)
|
|
105
|
-
@data[method_name.to_sym] if @data.
|
|
105
|
+
@data[method_name.to_sym] if @data.key?(method_name.to_sym)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def respond_to_missing?(method_name, include_private = false)
|
|
109
|
-
@data.
|
|
109
|
+
@data.key?(method_name.to_sym) || super
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
private
|
|
@@ -144,7 +144,7 @@ module Icarus
|
|
|
144
144
|
if version.nil?
|
|
145
145
|
@warnings << "Version was nil, it has been defaulted to 1.0"
|
|
146
146
|
else
|
|
147
|
-
@warnings << "Version should be a version string" unless
|
|
147
|
+
@warnings << "Version should be a version string" unless /^\d+[.\d+]*/.match?(version)
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
150
|
end
|
|
@@ -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| Icarus::Mod::Tools::Modinfo.new(mod) if mod[:name]
|
|
24
|
+
retrieve_from_url(url)[:mods].map { |mod| Icarus::Mod::Tools::Modinfo.new(mod) if mod[:name].match?(/[a-z0-9]+/i) }
|
|
25
25
|
rescue Icarus::Mod::Tools::Sync::RequestFailed
|
|
26
26
|
warn "Skipped; Failed to retrieve #{url}"
|
|
27
27
|
next
|
|
@@ -23,7 +23,7 @@ module Icarus
|
|
|
23
23
|
@info_array ||= @firestore.toolinfo.map do |url|
|
|
24
24
|
next unless url
|
|
25
25
|
|
|
26
|
-
retrieve_from_url(url)[:tools].map { |tool| Icarus::Mod::Tools::Toolinfo.new(tool) if
|
|
26
|
+
retrieve_from_url(url)[:tools].map { |tool| Icarus::Mod::Tools::Toolinfo.new(tool) if /[a-z0-9]+/i.match?(tool[:name]) }
|
|
27
27
|
rescue Icarus::Mod::Tools::Sync::RequestFailed
|
|
28
28
|
warn "Skipped; Failed to retrieve #{url}"
|
|
29
29
|
next
|
|
@@ -9,13 +9,13 @@ module Icarus
|
|
|
9
9
|
|
|
10
10
|
def initialize(type)
|
|
11
11
|
@array = case type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
when :modinfo
|
|
13
|
+
Sync::Mods.new.info_array
|
|
14
|
+
when :toolinfo
|
|
15
|
+
Sync::Tools.new.info_array
|
|
16
|
+
else
|
|
17
|
+
raise ArgumentError, "Invalid type: #{type}"
|
|
18
|
+
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
data/lib/icarus/mod/version.rb
CHANGED
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: 2.1.
|
|
4
|
+
version: 2.1.4
|
|
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-
|
|
11
|
+
date: 2023-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: google-cloud-firestore
|
|
@@ -75,8 +75,9 @@ extensions: []
|
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
77
|
- ".rspec"
|
|
78
|
-
- ".rubocop.yml"
|
|
79
78
|
- ".ruby-version"
|
|
79
|
+
- ".standard.yml"
|
|
80
|
+
- ".standard_rubocop_extensions.yml"
|
|
80
81
|
- CHANGELOG.md
|
|
81
82
|
- Gemfile
|
|
82
83
|
- Gemfile.lock
|
data/.rubocop.yml
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
require: rubocop-rspec
|
|
2
|
-
|
|
3
|
-
AllCops:
|
|
4
|
-
TargetRubyVersion: 3.1
|
|
5
|
-
NewCops: enable
|
|
6
|
-
SuggestExtensions: false
|
|
7
|
-
|
|
8
|
-
Style/StringLiterals:
|
|
9
|
-
Enabled: true
|
|
10
|
-
EnforcedStyle: double_quotes
|
|
11
|
-
|
|
12
|
-
Style/StringLiteralsInInterpolation:
|
|
13
|
-
Enabled: true
|
|
14
|
-
EnforcedStyle: double_quotes
|
|
15
|
-
|
|
16
|
-
Layout/LineLength:
|
|
17
|
-
Max: 160
|
|
18
|
-
|
|
19
|
-
Style/FrozenStringLiteralComment:
|
|
20
|
-
Exclude:
|
|
21
|
-
- Guardfile
|
|
22
|
-
- spec/**/*_spec.rb
|
|
23
|
-
|
|
24
|
-
Metrics/CyclomaticComplexity:
|
|
25
|
-
Max: 15
|
|
26
|
-
Exclude:
|
|
27
|
-
- spec/**/*_spec.rb
|
|
28
|
-
- lib/icarus/mod/cli/*.rb # Thor command files
|
|
29
|
-
|
|
30
|
-
Metrics/PerceivedComplexity:
|
|
31
|
-
Max: 15
|
|
32
|
-
Exclude:
|
|
33
|
-
- spec/**/*_spec.rb
|
|
34
|
-
- lib/icarus/mod/cli/*.rb # Thor command files
|
|
35
|
-
|
|
36
|
-
Metrics/AbcSize:
|
|
37
|
-
Max: 35
|
|
38
|
-
Exclude:
|
|
39
|
-
- lib/icarus/mod/cli/*.rb # Thor command files
|
|
40
|
-
|
|
41
|
-
Metrics/BlockLength:
|
|
42
|
-
Enabled: false
|
|
43
|
-
|
|
44
|
-
Metrics/ClassLength:
|
|
45
|
-
Enabled: false
|
|
46
|
-
|
|
47
|
-
Metrics/MethodLength:
|
|
48
|
-
Enabled: false
|
|
49
|
-
|
|
50
|
-
Naming/BlockForwarding:
|
|
51
|
-
EnforcedStyle: explicit
|
|
52
|
-
|
|
53
|
-
RSpec/MultipleMemoizedHelpers:
|
|
54
|
-
Enabled: false
|
|
55
|
-
|
|
56
|
-
Style/Documentation:
|
|
57
|
-
Exclude:
|
|
58
|
-
- lib/icarus/mod/cli/*.rb # Thor command files
|
|
59
|
-
|
|
60
|
-
Style/OpenStructUse:
|
|
61
|
-
Enabled: false
|