mmi 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mmi/interactive/assets.rb +12 -1
- data/lib/mmi/modrinth_api.rb +3 -7
- data/lib/mmi/source/modrinth.rb +5 -7
- data/lib/mmi/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac664a5f071c4eeb437b6e1f501130373baa722e3e97277bd627de91db6340b0
|
4
|
+
data.tar.gz: ec0937a098b99dd02302ee3c0256ad1d6e3e3e6f14e7ef72e76dfb7924e52beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7eac5b99470ab80d174bdac020fd0f2872907d2bc2fc117ac102806d5dc6a2a58e410b6f96811376a0d8c32d8970c155b119ecf1d6620436211769b011676b4b
|
7
|
+
data.tar.gz: 600c32a227d7458a3f034e00c40347fd35bf11a4699f76ebd35521d9ee5a366e55740b70cfe8122ab96b468c9b985131cfc7218468231ed0c5c9edb8a04ce7ad
|
@@ -160,7 +160,18 @@ module Mmi
|
|
160
160
|
end
|
161
161
|
when Mmi::Source::Modrinth
|
162
162
|
mod_version = CLI::UI::Prompt.ask('Choose a version.') do |handler|
|
163
|
-
|
163
|
+
version_filter_parameters =
|
164
|
+
case processor.parsed_modloader
|
165
|
+
when Mmi::Modloader::Fabric
|
166
|
+
{
|
167
|
+
loader: 'fabric',
|
168
|
+
game_version: processor.parsed_modloader.mcversion,
|
169
|
+
}
|
170
|
+
else
|
171
|
+
{}
|
172
|
+
end
|
173
|
+
|
174
|
+
asset.cached_mod_versions(**version_filter_parameters).select do |version|
|
164
175
|
version['files'].any?
|
165
176
|
end.each do |version|
|
166
177
|
handler.option("#{version['name']} (for game versions #{version['game_versions'].join('/')})") do
|
data/lib/mmi/modrinth_api.rb
CHANGED
@@ -3,15 +3,11 @@ require 'open-uri'
|
|
3
3
|
|
4
4
|
module Mmi
|
5
5
|
module ModrinthApi
|
6
|
-
BASE_URL = URI('https://api.modrinth.com/
|
6
|
+
BASE_URL = URI('https://api.modrinth.com/v2/')
|
7
7
|
|
8
8
|
class << self
|
9
|
-
def
|
10
|
-
JSON.parse((BASE_URL + "
|
11
|
-
end
|
12
|
-
|
13
|
-
def mod_versions(mod_id)
|
14
|
-
JSON.parse((BASE_URL + "mod/#{mod_id}/version").open.read)
|
9
|
+
def project_versions(mod_slug, loader: nil, game_version: nil)
|
10
|
+
JSON.parse((BASE_URL + "project/#{mod_slug}/version?#{URI.encode_www_form(loaders: (%Q{["#{loader}"]} if loader), game_versions: (%Q{["#{game_version}"]} if game_version))}").open.read)
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
data/lib/mmi/source/modrinth.rb
CHANGED
@@ -42,18 +42,16 @@ module Mmi
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
@
|
47
|
-
end
|
48
|
-
|
49
|
-
def cached_mod_versions
|
50
|
-
@cached_mod_versions ||= Mmi::ModrinthApi.mod_versions(cached_mod_id)
|
45
|
+
def cached_mod_versions(loader: nil, game_version: nil)
|
46
|
+
(@cached_mod_versions ||= Hash.new)[{loader: loader, game_version: game_version}] ||= Mmi::ModrinthApi.project_versions(self.name, loader: loader, game_version: game_version)
|
51
47
|
end
|
52
48
|
|
53
49
|
def download_url
|
54
50
|
cached_mod_versions.select do |version|
|
55
51
|
version['name'] == self.version
|
56
|
-
end.
|
52
|
+
end.map do |version|
|
53
|
+
version['files']
|
54
|
+
end.flatten(1).select do |files|
|
57
55
|
files['filename'] == self.version_file
|
58
56
|
end.first['url'].gsub(/ /, '%20')
|
59
57
|
end
|
data/lib/mmi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- expeehaa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cli-ui
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '4.22'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday-retry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: pry
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
199
|
- !ruby/object:Gem::Version
|
186
200
|
version: '0'
|
187
201
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
202
|
+
rubygems_version: 3.5.9
|
189
203
|
signing_key:
|
190
204
|
specification_version: 4
|
191
205
|
summary: Program to install minecraft modloaders, mods and other assets through a
|