mmi 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +5 -9
- data/exe/mmi +1 -1
- data/lib/mmi/asset.rb +16 -0
- data/lib/mmi/assets_processor.rb +13 -44
- data/lib/mmi/constants.rb +14 -0
- data/lib/mmi/content_hash/base.rb +9 -0
- data/lib/mmi/content_hash/sha512.rb +25 -0
- data/lib/mmi/install_record.rb +72 -0
- data/lib/mmi/install_utils.rb +24 -0
- data/lib/mmi/interactive/assets.rb +62 -54
- data/lib/mmi/interactive/modloader.rb +16 -16
- data/lib/mmi/interactive/updater.rb +1 -1
- data/lib/mmi/mod_file_processor.rb +7 -59
- data/lib/mmi/modloader/fabric.rb +38 -47
- data/lib/mmi/modloader/none.rb +5 -1
- data/lib/mmi/property_attributes.rb +192 -0
- data/lib/mmi/source/github.rb +13 -54
- data/lib/mmi/source/modrinth.rb +18 -51
- data/lib/mmi/source/url.rb +8 -37
- data/lib/mmi/version.rb +1 -1
- data/lib/mmi.rb +0 -11
- metadata +14 -93
- data/lib/mmi/cached_download.rb +0 -59
- data/lib/mmi/option_attributes.rb +0 -38
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- expeehaa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cli-ui
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '8.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '8.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday-retry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,90 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.13'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.13'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '13.0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '13.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '3.10'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '3.10'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-rspec
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: warbler
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '2.0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '2.0'
|
153
69
|
description:
|
154
70
|
email:
|
155
71
|
- expeehaa@outlook.com
|
@@ -162,9 +78,14 @@ files:
|
|
162
78
|
- README.adoc
|
163
79
|
- exe/mmi
|
164
80
|
- lib/mmi.rb
|
81
|
+
- lib/mmi/asset.rb
|
165
82
|
- lib/mmi/assets_processor.rb
|
166
|
-
- lib/mmi/
|
83
|
+
- lib/mmi/constants.rb
|
84
|
+
- lib/mmi/content_hash/base.rb
|
85
|
+
- lib/mmi/content_hash/sha512.rb
|
167
86
|
- lib/mmi/github_api.rb
|
87
|
+
- lib/mmi/install_record.rb
|
88
|
+
- lib/mmi/install_utils.rb
|
168
89
|
- lib/mmi/interactive.rb
|
169
90
|
- lib/mmi/interactive/assets.rb
|
170
91
|
- lib/mmi/interactive/modloader.rb
|
@@ -173,7 +94,7 @@ files:
|
|
173
94
|
- lib/mmi/modloader/fabric.rb
|
174
95
|
- lib/mmi/modloader/none.rb
|
175
96
|
- lib/mmi/modrinth_api.rb
|
176
|
-
- lib/mmi/
|
97
|
+
- lib/mmi/property_attributes.rb
|
177
98
|
- lib/mmi/semver.rb
|
178
99
|
- lib/mmi/source/github.rb
|
179
100
|
- lib/mmi/source/modrinth.rb
|
@@ -199,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
120
|
- !ruby/object:Gem::Version
|
200
121
|
version: '0'
|
201
122
|
requirements: []
|
202
|
-
rubygems_version: 3.5.
|
123
|
+
rubygems_version: 3.5.11
|
203
124
|
signing_key:
|
204
125
|
specification_version: 4
|
205
126
|
summary: Program to install minecraft modloaders, mods and other assets through a
|
data/lib/mmi/cached_download.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'digest'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'open-uri'
|
4
|
-
|
5
|
-
module Mmi
|
6
|
-
module CachedDownload
|
7
|
-
class << self
|
8
|
-
def open_cached(path, sha512: nil)
|
9
|
-
if File.exist?(path)
|
10
|
-
File.open(path).tap do |f|
|
11
|
-
if !sha512 || sha512 == Digest::SHA512.hexdigest(f.read)
|
12
|
-
f.seek(0)
|
13
|
-
f
|
14
|
-
else
|
15
|
-
nil
|
16
|
-
end
|
17
|
-
end
|
18
|
-
else
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def download(uri, sha512: nil)
|
24
|
-
URI.parse(uri).open.tap do |stream|
|
25
|
-
if sha512
|
26
|
-
actual_sha512 = Digest::SHA512.hexdigest(stream.read)
|
27
|
-
|
28
|
-
if sha512 == actual_sha512
|
29
|
-
stream.seek(0)
|
30
|
-
else
|
31
|
-
Mmi.fail! "Expected download to have SHA512 sum #{expected_hexdigest.inspect} but received #{actual_sha512.inspect}."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def download_cached(uri, download_path, sha512_uri: nil)
|
38
|
-
ensure_cache_dir_exists!
|
39
|
-
|
40
|
-
expected_hexdigest = URI.parse(sha512_uri).open.read
|
41
|
-
cached_file = open_cached(download_path, sha512: expected_hexdigest)
|
42
|
-
|
43
|
-
if !cached_file
|
44
|
-
stream = download(uri, sha512: expected_hexdigest)
|
45
|
-
|
46
|
-
IO.copy_stream(stream, download_path)
|
47
|
-
else
|
48
|
-
Mmi.info "Using cached version of #{uri.inspect} from #{download_path.inspect}."
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def ensure_cache_dir_exists!
|
55
|
-
FileUtils.mkdir_p(Mmi.cache_dir)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Mmi
|
2
|
-
module OptionAttributes
|
3
|
-
attr_reader :options
|
4
|
-
|
5
|
-
def self.included(klass)
|
6
|
-
klass.extend(ClassMethods)
|
7
|
-
end
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
def opt_reader(attr, name=attr.to_s, &block)
|
11
|
-
define_method(:"#{attr.to_sym}") do
|
12
|
-
result = self.options[name]
|
13
|
-
|
14
|
-
if result.nil? && block_given?
|
15
|
-
block.call
|
16
|
-
else
|
17
|
-
result
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def opt_writer(attr, name=attr.to_s)
|
23
|
-
define_method(:"#{attr.to_sym}=") do |value|
|
24
|
-
if value.nil?
|
25
|
-
self.options.delete(name)
|
26
|
-
else
|
27
|
-
self.options[name] = value
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def opt_accessor(attr, name=attr.to_s, &block)
|
33
|
-
opt_reader(attr, name, &block)
|
34
|
-
opt_writer(attr, name )
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|