Icarus-Mod-Tools 1.3.2 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/icarus/mod/cli/list.rb +4 -4
- data/lib/icarus/mod/cli/sync.rb +5 -2
- data/lib/icarus/mod/tools/mod_sync.rb +4 -1
- data/lib/icarus/mod/tools/sync_helpers.rb +3 -1
- data/lib/icarus/mod/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6116efa6067d7083fa0bd8702fa0b5e69f3fb5050b4fb9e8109c5d058e2b44ed
|
4
|
+
data.tar.gz: f9b7796983c16913ac855ff74c7cd519765a431678ab6d08f03fab14474d6e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22fedc2ac796efe006680fc5248c33fb01f003b03af14e59a1332fc586b7341dcdda36219e0ec0f00db9d5b790a1fe37062208c5d84ea604d585c391a32dc18c
|
7
|
+
data.tar.gz: ffc80856c30d74b07aa1b5255cfc304f9eb30d9b1277866d862f7ebb833db8cc04e16d67c6f784ad7b9257df8804183b4c6ded9586cfad8d99b93d4740acd6ce
|
data/Gemfile.lock
CHANGED
data/lib/icarus/mod/cli/list.rb
CHANGED
@@ -32,12 +32,12 @@ module Icarus
|
|
32
32
|
filter_field = options[:filter].first&.to_sym
|
33
33
|
filter_value = options[:filter].last&.to_s
|
34
34
|
|
35
|
-
raise "Invalid filter option" unless options[:filter].empty? || options[:filter]&.count == 2
|
35
|
+
raise Icarus::Mod::Tools::Error, "Invalid filter option #{options[:filter]}" unless options[:filter].empty? || options[:filter]&.count == 2
|
36
36
|
|
37
|
-
raise "Invalid filter field '#{filter_field}'" unless filter_field && valid_keys.include?(filter_field)
|
37
|
+
raise Icarus::Mod::Tools::Error, "Invalid filter field '#{filter_field}'" unless filter_field && valid_keys.include?(filter_field)
|
38
38
|
end
|
39
39
|
|
40
|
-
raise "Invalid sort field '#{sort_field}'" unless valid_keys.include?(sort_field)
|
40
|
+
raise Icarus::Mod::Tools::Error, "Invalid sort field '#{sort_field}'" unless valid_keys.include?(sort_field)
|
41
41
|
|
42
42
|
puts "Sorted by #{sort_field}" if sort_field && verbose > 2
|
43
43
|
puts "Filtered by #{filter_field} = #{filter_value}" if filter_field && verbose > 2
|
@@ -76,7 +76,7 @@ module Icarus
|
|
76
76
|
end
|
77
77
|
|
78
78
|
puts "Total: #{mods.count}" if verbose?
|
79
|
-
rescue
|
79
|
+
rescue Icarus::Mod::Tools::Error => e
|
80
80
|
puts e.message
|
81
81
|
exit 1
|
82
82
|
end
|
data/lib/icarus/mod/cli/sync.rb
CHANGED
@@ -15,12 +15,12 @@ module Icarus
|
|
15
15
|
puts "Retrieving repository Data..." if verbose?
|
16
16
|
repositories = modinfo_sync.repositories
|
17
17
|
|
18
|
-
raise "Unable to find any repositories!" unless repositories.any?
|
18
|
+
raise Icarus::Mod::Tools::Error, "Unable to find any repositories!" unless repositories.any?
|
19
19
|
|
20
20
|
puts "Retrieving modinfo Array..." if verbose?
|
21
21
|
modinfo_array = modinfo_sync.modinfo_data(repositories, verbose: verbose > 1)&.map(&:download_url)&.compact
|
22
22
|
|
23
|
-
raise "Unable to find any modinfo.json files!" unless modinfo_array&.any?
|
23
|
+
raise Icarus::Mod::Tools::Error, "Unable to find any modinfo.json files!" unless modinfo_array&.any?
|
24
24
|
|
25
25
|
puts "Saving to Firestore..." if verbose?
|
26
26
|
response = modinfo_sync.update(modinfo_array)
|
@@ -67,6 +67,9 @@ module Icarus
|
|
67
67
|
end
|
68
68
|
|
69
69
|
puts "Deleted #{delete_array.count} outdated mods" if verbose?
|
70
|
+
rescue Icarus::Mod::Tools::Error => e
|
71
|
+
warn e.message
|
72
|
+
exit 1
|
70
73
|
end
|
71
74
|
end
|
72
75
|
end
|
@@ -21,7 +21,10 @@ module Icarus
|
|
21
21
|
def modinfo_array
|
22
22
|
@modinfo_array ||= @firestore.modinfo_array.map do |url|
|
23
23
|
retrieve_from_url(url)[:mods].map { |mod| Modinfo.new(mod) }
|
24
|
-
|
24
|
+
rescue RequestFailed => e
|
25
|
+
warn "Failed to retrieve modinfo: #{e.message}"
|
26
|
+
next
|
27
|
+
end.flatten.compact
|
25
28
|
end
|
26
29
|
|
27
30
|
def find_mod(modinfo)
|
@@ -9,10 +9,12 @@ module Icarus
|
|
9
9
|
module Tools
|
10
10
|
# Sync helper methods
|
11
11
|
module SyncHelpers
|
12
|
+
class RequestFailed < StandardError; end
|
13
|
+
|
12
14
|
def retrieve_from_url(url)
|
13
15
|
res = Net::HTTP.get_response(URI(url))
|
14
16
|
|
15
|
-
raise "HTTP Request failed (#{res.code}): #{res.message}" unless res&.code == "200"
|
17
|
+
raise RequestFailed, "HTTP Request failed for #{url} (#{res.code}): #{res.message}" unless res&.code == "200"
|
16
18
|
|
17
19
|
JSON.parse(res.body, symbolize_names: true)
|
18
20
|
end
|
data/lib/icarus/mod/version.rb
CHANGED