mootool 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +71 -67
  5. data/lib/mootool/command.rb +1 -0
  6. data/lib/mootool/controller_base.rb +1 -0
  7. data/lib/mootool/controllers/dwarf.rb +2 -1
  8. data/lib/mootool/controllers/dyld_linker.rb +1 -0
  9. data/lib/mootool/controllers/dyld_shared_cache.rb +1 -0
  10. data/lib/mootool/controllers/fat_binary.rb +1 -0
  11. data/lib/mootool/controllers/kernel_collection.rb +4 -3
  12. data/lib/mootool/controllers/sections.rb +1 -0
  13. data/lib/mootool/core_extensions.rb +3 -3
  14. data/lib/mootool/models/decompressor.rb +5 -2
  15. data/lib/mootool/models/device_tree.rb +5 -3
  16. data/lib/mootool/models/img4.rb +2 -1
  17. data/lib/mootool/models/ipsw.rb +5 -1
  18. data/lib/mootool/version.rb +2 -1
  19. data/lib/mootool.rb +1 -0
  20. data/sorbet/config +1 -1
  21. data/sorbet/rbi/annotations/.gitattributes +1 -0
  22. data/sorbet/rbi/annotations/rainbow.rbi +2 -2
  23. data/sorbet/rbi/gems/.gitattributes +1 -0
  24. data/sorbet/rbi/gems/ast@2.4.2.rbi +48 -82
  25. data/sorbet/rbi/gems/childprocess@4.1.0.rbi +107 -153
  26. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +192 -332
  27. data/sorbet/rbi/gems/docile@1.4.0.rbi +376 -0
  28. data/sorbet/rbi/gems/erubi@1.12.0.rbi +146 -0
  29. data/sorbet/rbi/gems/iniparse@1.5.0.rbi +166 -276
  30. data/sorbet/rbi/gems/{json@2.6.2.rbi → json@2.6.3.rbi} +119 -228
  31. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  32. data/sorbet/rbi/gems/lzfse@0.0.2.rbi +55 -0
  33. data/sorbet/rbi/gems/lzss@0.1.rbi +8 -0
  34. data/sorbet/rbi/gems/netrc@0.11.0.rbi +52 -80
  35. data/sorbet/rbi/gems/{overcommit@0.59.1.rbi → overcommit@0.60.0.rbi} +534 -887
  36. data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
  37. data/sorbet/rbi/gems/parser@3.2.2.4.rbi +5451 -0
  38. data/sorbet/rbi/gems/{plist@3.6.0.rbi → plist@3.7.0.rbi} +125 -3
  39. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  40. data/sorbet/rbi/gems/prism@0.17.1.rbi +27700 -0
  41. data/sorbet/rbi/gems/racc@1.7.3.rbi +161 -0
  42. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +141 -191
  43. data/sorbet/rbi/gems/rake@13.1.0.rbi +2887 -0
  44. data/sorbet/rbi/gems/{rbi@0.0.15.rbi → rbi@0.1.4.rbi} +979 -1676
  45. data/sorbet/rbi/gems/regexp_parser@2.8.2.rbi +3749 -0
  46. data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.2.6.rbi} +811 -1268
  47. data/sorbet/rbi/gems/{rspec-core@3.11.0.rbi → rspec-core@3.12.2.rbi} +2662 -4722
  48. data/sorbet/rbi/gems/{rspec-expectations@3.11.0.rbi → rspec-expectations@3.12.3.rbi} +1557 -2608
  49. data/sorbet/rbi/gems/rspec-mocks@3.12.6.rbi +5306 -0
  50. data/sorbet/rbi/gems/rspec-support@3.12.1.rbi +1609 -0
  51. data/sorbet/rbi/gems/rspec@3.12.0.rbi +82 -0
  52. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +7090 -0
  53. data/sorbet/rbi/gems/rubocop-capybara@2.19.0.rbi +1125 -0
  54. data/sorbet/rbi/gems/rubocop-factory_bot@2.24.0.rbi +878 -0
  55. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +88 -173
  56. data/sorbet/rbi/gems/rubocop-rspec@2.25.0.rbi +7997 -0
  57. data/sorbet/rbi/gems/rubocop@1.57.2.rbi +56813 -0
  58. data/sorbet/rbi/gems/ruby-lzma@0.4.3.rbi +19 -0
  59. data/sorbet/rbi/gems/ruby-macho@3.0.0.rbi +899 -1237
  60. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  61. data/sorbet/rbi/gems/rubyzip@2.3.2.rbi +808 -1275
  62. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +216 -0
  63. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2148 -0
  64. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
  65. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  66. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23136 -0
  67. data/sorbet/rbi/gems/tapioca@0.11.12.rbi +3507 -0
  68. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
  69. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  70. data/sorbet/rbi/gems/{yard@0.9.28.rbi → yard@0.9.34.rbi} +4531 -7160
  71. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +24 -72
  72. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +385 -1697
  73. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +7 -30
  74. data/sorbet/rbi/sorbet-typed/lib/rubocop/>=1.8/rubocop.rbi +1 -3
  75. data/sorbet/rbi/sorbet-typed/lib/thor/all/thor.rbi +905 -0
  76. data/sorbet/rbi/sorbet-typed/lib/yard/all/yard.rbi +35 -0
  77. data/sorbet/tapioca/require.rb +13 -1
  78. metadata +47 -35
  79. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
  80. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -8
  81. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -353
  82. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +0 -6198
  83. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
  84. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -3587
  85. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +0 -3927
  86. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +0 -6506
  87. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +0 -2040
  88. data/sorbet/rbi/gems/rspec@3.11.0.rbi +0 -120
  89. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +0 -7990
  90. data/sorbet/rbi/gems/rubocop-rspec@2.12.1.rbi +0 -7604
  91. data/sorbet/rbi/gems/rubocop@1.35.0.rbi +0 -62260
  92. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -1445
  93. data/sorbet/rbi/gems/spoom@1.1.12.rbi +0 -2829
  94. data/sorbet/rbi/gems/tapioca@0.9.3.rbi +0 -2151
  95. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -4532
  96. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +0 -60
  97. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -8
  98. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -3075
  99. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +0 -458
  100. data/sorbet/rbi/todo.rbi +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4423d77720b71cc43018c7a911d50b845034451429c0e9887f801281069574b
4
- data.tar.gz: 0e3aaf185576fbb642b96bdfb278271d5efa647703bb6b77363427d06c3e5bcb
3
+ metadata.gz: e4b46205baa6c47ebe654ff25f8db755911ebbbbcaeaa8a779d13f505f385f07
4
+ data.tar.gz: e8c5f1c19fdb080244ed7b5999c72b4a35a8a1d76e928eef5050f3ff0b0798b8
5
5
  SHA512:
6
- metadata.gz: e4d94fd22c8177b5d77becdbc2cf74dbe09f4bf535402e1ebac3d6b429a34a68490abf2a612e4033c9579bc62e47605ea61ccffdd708531177fede70e6e4ea39
7
- data.tar.gz: 2fb4220cef9356f35886f6c39694ce2bdb074ed495b5b229aad789d32fe6107099cf3643d07b5d37356f39a9be95a76038e31eb4b62a9e00cd39fe900027f5eb
6
+ metadata.gz: 05bdbd7bdfc6f42a384a0ef5d0475b3b9b0f28c79efe7620e8214d04e37810051dca180add54591deaf04375e1048506627342ffeb94bc3b79f6a84d89c64c24
7
+ data.tar.gz: d263e31f809c885695ffce50840ffa6c43f58fcb1f1e8dcb313284c8db3e5f8bd2f1f39ad250f94e86313b1c3541f46b7b569e3f0a8979f95b1c4695708a46da
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 3.0
3
+ NewCops: enable
3
4
 
4
5
  Metrics/BlockLength:
5
6
  Max: 35
@@ -10,6 +11,12 @@ Metrics/BlockLength:
10
11
  Metrics/MethodLength:
11
12
  Max: 35
12
13
 
14
+ Metrics/CyclomaticComplexity:
15
+ Max: 15
16
+
17
+ Metrics/PerceivedComplexity:
18
+ Max: 15
19
+
13
20
  Metrics/AbcSize:
14
21
  Max: 25
15
22
 
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in mootool.gemspec
6
6
  gemspec
7
7
 
8
+ gem 'rubyzip'
8
9
  gem 'sorbet-runtime'
9
10
 
10
11
  group :development, :test do
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mootool (0.2.6)
4
+ mootool (0.2.8)
5
5
  lzfse
6
6
  lzss
7
7
  plist (~> 3)
@@ -15,112 +15,115 @@ GEM
15
15
  specs:
16
16
  ast (2.4.2)
17
17
  childprocess (4.1.0)
18
- coderay (1.1.3)
19
18
  diff-lcs (1.5.0)
20
19
  docile (1.4.0)
20
+ erubi (1.12.0)
21
21
  iniparse (1.5.0)
22
- json (2.6.2)
23
- lzfse (0.0.1)
22
+ json (2.6.3)
23
+ language_server-protocol (3.17.0.3)
24
+ lzfse (0.0.2)
24
25
  lzss (0.1)
25
- method_source (1.0.0)
26
26
  netrc (0.11.0)
27
- overcommit (0.59.1)
27
+ overcommit (0.60.0)
28
28
  childprocess (>= 0.6.3, < 5)
29
29
  iniparse (~> 1.4)
30
30
  rexml (~> 3.2)
31
- parallel (1.22.1)
32
- parser (3.1.2.1)
31
+ parallel (1.23.0)
32
+ parser (3.2.2.4)
33
33
  ast (~> 2.4.1)
34
- plist (3.6.0)
35
- pry (0.14.1)
36
- coderay (~> 1.1)
37
- method_source (~> 1.0)
34
+ racc
35
+ plist (3.7.0)
36
+ prettier_print (1.2.1)
37
+ prism (0.17.1)
38
+ racc (1.7.3)
38
39
  rainbow (3.1.1)
39
- rake (13.0.6)
40
- rbi (0.0.15)
41
- ast
42
- parser (>= 2.6.4.0)
40
+ rake (13.1.0)
41
+ rbi (0.1.4)
42
+ prism (>= 0.17.1, < 0.18)
43
43
  sorbet-runtime (>= 0.5.9204)
44
- unparser
45
- regexp_parser (2.5.0)
46
- rexml (3.2.5)
47
- rspec (3.11.0)
48
- rspec-core (~> 3.11.0)
49
- rspec-expectations (~> 3.11.0)
50
- rspec-mocks (~> 3.11.0)
51
- rspec-core (3.11.0)
52
- rspec-support (~> 3.11.0)
53
- rspec-expectations (3.11.0)
44
+ regexp_parser (2.8.2)
45
+ rexml (3.2.6)
46
+ rspec (3.12.0)
47
+ rspec-core (~> 3.12.0)
48
+ rspec-expectations (~> 3.12.0)
49
+ rspec-mocks (~> 3.12.0)
50
+ rspec-core (3.12.2)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-expectations (3.12.3)
54
53
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.11.0)
56
- rspec-mocks (3.11.1)
54
+ rspec-support (~> 3.12.0)
55
+ rspec-mocks (3.12.6)
57
56
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.11.0)
59
- rspec-support (3.11.0)
60
- rubocop (1.35.1)
57
+ rspec-support (~> 3.12.0)
58
+ rspec-support (3.12.1)
59
+ rubocop (1.57.2)
61
60
  json (~> 2.3)
61
+ language_server-protocol (>= 3.17.0)
62
62
  parallel (~> 1.10)
63
- parser (>= 3.1.2.1)
63
+ parser (>= 3.2.2.4)
64
64
  rainbow (>= 2.2.2, < 4.0)
65
65
  regexp_parser (>= 1.8, < 3.0)
66
66
  rexml (>= 3.2.5, < 4.0)
67
- rubocop-ast (>= 1.20.1, < 2.0)
67
+ rubocop-ast (>= 1.28.1, < 2.0)
68
68
  ruby-progressbar (~> 1.7)
69
- unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.21.0)
71
- parser (>= 3.1.1.0)
69
+ unicode-display_width (>= 2.4.0, < 3.0)
70
+ rubocop-ast (1.30.0)
71
+ parser (>= 3.2.1.0)
72
+ rubocop-capybara (2.19.0)
73
+ rubocop (~> 1.41)
74
+ rubocop-factory_bot (2.24.0)
75
+ rubocop (~> 1.33)
72
76
  rubocop-rake (0.6.0)
73
77
  rubocop (~> 1.0)
74
- rubocop-rspec (2.12.1)
75
- rubocop (~> 1.31)
78
+ rubocop-rspec (2.25.0)
79
+ rubocop (~> 1.40)
80
+ rubocop-capybara (~> 2.17)
81
+ rubocop-factory_bot (~> 2.22)
76
82
  ruby-lzma (0.4.3)
77
83
  ruby-macho (3.0.0)
78
- ruby-progressbar (1.11.0)
84
+ ruby-progressbar (1.13.0)
79
85
  rubyzip (2.3.2)
80
- simplecov (0.21.2)
86
+ simplecov (0.22.0)
81
87
  docile (~> 1.1)
82
88
  simplecov-html (~> 0.11)
83
89
  simplecov_json_formatter (~> 0.1)
84
90
  simplecov-html (0.12.3)
85
91
  simplecov_json_formatter (0.1.4)
86
- sorbet (0.5.10346)
87
- sorbet-static (= 0.5.10346)
88
- sorbet-runtime (0.5.10346)
89
- sorbet-static (0.5.10346-universal-darwin-21)
90
- sorbet-static (0.5.10346-universal-darwin-22)
91
- sorbet-static (0.5.10346-x86_64-linux)
92
- sorbet-static-and-runtime (0.5.10346)
93
- sorbet (= 0.5.10346)
94
- sorbet-runtime (= 0.5.10346)
95
- spoom (1.1.12)
96
- sorbet (>= 0.5.9204)
97
- sorbet-runtime (>= 0.5.9204)
92
+ sorbet (0.5.11139)
93
+ sorbet-static (= 0.5.11139)
94
+ sorbet-runtime (0.5.11139)
95
+ sorbet-static (0.5.11139-universal-darwin)
96
+ sorbet-static (0.5.11139-x86_64-linux)
97
+ sorbet-static-and-runtime (0.5.11139)
98
+ sorbet (= 0.5.11139)
99
+ sorbet-runtime (= 0.5.11139)
100
+ spoom (1.2.4)
101
+ erubi (>= 1.10.0)
102
+ sorbet-static-and-runtime (>= 0.5.10187)
103
+ syntax_tree (>= 6.1.1)
98
104
  thor (>= 0.19.2)
99
- tapioca (0.9.4)
100
- bundler (>= 1.17.3)
105
+ syntax_tree (6.2.0)
106
+ prettier_print (>= 1.2.0)
107
+ tapioca (0.11.12)
108
+ bundler (>= 2.2.25)
101
109
  netrc (>= 0.11.0)
102
110
  parallel (>= 1.21.0)
103
- pry (>= 0.12.2)
104
- rbi (~> 0.0.0, >= 0.0.14)
105
- sorbet-static-and-runtime (>= 0.5.9204)
106
- spoom (~> 1.1.0, >= 1.1.11)
111
+ rbi (>= 0.1.4, < 0.2)
112
+ sorbet-static-and-runtime (>= 0.5.10187)
113
+ spoom (~> 1.2.0, >= 1.2.0)
107
114
  thor (>= 1.2.0)
108
115
  yard-sorbet
109
- thor (1.2.1)
110
- unicode-display_width (2.2.0)
111
- unparser (0.6.5)
112
- diff-lcs (~> 1.3)
113
- parser (>= 3.1.0)
114
- webrick (1.7.0)
115
- yard (0.9.28)
116
- webrick (~> 1.7.0)
117
- yard-sorbet (0.6.1)
116
+ thor (1.3.0)
117
+ unicode-display_width (2.5.0)
118
+ yard (0.9.34)
119
+ yard-sorbet (0.8.1)
118
120
  sorbet-runtime (>= 0.5)
119
121
  yard (>= 0.9)
120
122
 
121
123
  PLATFORMS
122
124
  arm64-darwin-21
123
125
  arm64-darwin-22
126
+ arm64-darwin-23
124
127
  x86_64-darwin-21
125
128
  x86_64-darwin-22
126
129
  x86_64-linux
@@ -133,6 +136,7 @@ DEPENDENCIES
133
136
  rubocop
134
137
  rubocop-rake
135
138
  rubocop-rspec
139
+ rubyzip
136
140
  simplecov
137
141
  sorbet
138
142
  sorbet-runtime
@@ -1,3 +1,4 @@
1
+ # typed: true
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
@@ -1,3 +1,4 @@
1
+ # typed: true
1
2
  # frozen_string_literal: true
2
3
 
3
4
  CONTROLLERS_PATH = File.join(File.dirname(__FILE__), 'controllers')
@@ -1,8 +1,9 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTools
4
5
  module Controllers
5
- class DWARF < ControllerBase
6
+ class DWARF < MooTool::ControllerBase
6
7
  end
7
8
  end
8
9
  end
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
@@ -1,3 +1,4 @@
1
+ # typed: true
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
@@ -8,16 +9,16 @@ module MooTool
8
9
  description 'Kernel Collections'
9
10
 
10
11
  def extract(command, output_folder)
11
- file = MachO.open command.file
12
+ file = command.file
12
13
  input = File.open(command.file, 'rb')
13
14
 
14
- file.command(:LC_FILESET_ENTRY).each do |entry|
15
+ T.must(file).command(:LC_FILESET_ENTRY).each do |entry|
15
16
  output_path = File.join(output_folder, entry.entry_id.to_s)
16
17
  puts "Writing to #{output_path}"
17
18
  output_file = File.open(output_path, 'wb')
18
19
  # rubocop:disable Naming/VariableNumber
19
20
  # We do not have control of this name as it is part of ruby-macho
20
- matching = file.command(:LC_SEGMENT_64).find { |c| c.fileoff == entry.fileoff }
21
+ matching = T.must(file).command(:LC_SEGMENT_64).find { |c| c.fileoff == entry.fileoff }
21
22
  # rubocop:enable Naming/VariableNumber
22
23
 
23
24
  input.seek(matching.fileoff)
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
@@ -11,11 +11,11 @@ class Integer
11
11
  # @return [Integer] the aligned integer
12
12
  sig { params(alignment: T.nilable(Integer)).returns(Integer) }
13
13
  def align(alignment = nil)
14
- alignment ||= Integer.size
14
+ alignment ||= 4
15
15
 
16
- return self if alignment < 2
16
+ return self if T.must(alignment) < 2
17
17
 
18
- alignment -= 1
18
+ alignment = T.must(alignment) - 1
19
19
 
20
20
  if (self & alignment).zero?
21
21
  self
@@ -1,9 +1,12 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require 'lzfse'
4
5
  require 'lzma'
5
6
  require 'compress/lzss'
6
7
 
8
+ require 'sorbet-runtime'
9
+
7
10
  module MooTool
8
11
  # The magic Apple decompressor (as in it uses magics)
9
12
  class Decompressor
@@ -21,9 +24,9 @@ module MooTool
21
24
  when COMPRESSION_LZVN
22
25
  LZFSE.lzvn_decompress(data)
23
26
  when COMPRESSION_LZSS
24
- Compress::LZSS.decompress(data)
27
+ OpenSSL::Digest::DSS.decompress(data)
25
28
  when COMPRESSION_LZMA
26
- LZMA.decompress(data)
29
+ Net::DNS::QueryTypes::ATMA.decompress(data)
27
30
  else
28
31
  data
29
32
  end
@@ -36,7 +36,7 @@ module MooTool
36
36
  end
37
37
  child_count.times { @children << Node.new(tree, data) }
38
38
 
39
- @tree.add_handle(self, @properties[PHANDLE_PROP].value) if @properties.key? PHANDLE_PROP
39
+ @tree.add_handle(self, T.must(@properties[PHANDLE_PROP]).value) if @properties.key? PHANDLE_PROP
40
40
  end
41
41
 
42
42
  def to_h
@@ -76,9 +76,11 @@ module MooTool
76
76
 
77
77
  def normalize
78
78
  @value = @value.split("\x00").map(&:chomp) if @name == COMPATIBLE_PROP
79
- @value = @value.unpack1('V') if @size == 4
79
+ @value = @value.unpack1('V') if @size == 4 && @value.is_a?(String)
80
+ @value = @value.unpack1('Q') if @size == 8 && @value.is_a?(String)
80
81
 
81
82
  @value = @value.chomp("\x00") if @value.is_a?(String) && @value.count("\x00") == 1 && @value.end_with?("\x00")
83
+ @value = @value.force_encoding('ASCII-8BIT') if @value.is_a?(String)
82
84
  end
83
85
  end
84
86
 
@@ -96,7 +98,7 @@ module MooTool
96
98
  data = T.assert_type!(data, String)
97
99
  @data = StringIO.new(data)
98
100
  when IO
99
- @data = T.cast(data, IO)
101
+ @data = T.let(data, T.any(IO, StringIO))
100
102
  end
101
103
  @root = Node.new(self, @data)
102
104
  end
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require 'openssl'
@@ -26,7 +27,7 @@ module MooTool
26
27
  raise "Unknown IMG4 type #{@data.first.value}"
27
28
  end
28
29
 
29
- @manifest = Manifest.new(@payload) if @payload.start_with?('IM4M')
30
+ @manifest = Digest.new(@payload) if @payload.start_with?('IM4M')
30
31
  end
31
32
 
32
33
  def payload?
@@ -1,11 +1,15 @@
1
+ # typed: true
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require 'zip'
4
5
  require 'plist'
6
+ require 'net/http'
5
7
 
6
8
  module MooTool
7
9
  # Represents a single IPSW package
8
10
  class IPSW
11
+ attr_reader :manifest
12
+
9
13
  def initialize(file)
10
14
  @file = file
11
15
  @zip = Zip::File.open(file)
@@ -13,7 +17,7 @@ module MooTool
13
17
 
14
18
  raise 'Invalid IPSW, does not contain BuildManifest.plist' unless manifest
15
19
 
16
- @manifest = Plist.parse_xml(manifest.get_input_stream.read)
20
+ @manifest = Plist.parse_xml manifest.get_input_stream.read
17
21
  end
18
22
  end
19
23
  end
@@ -1,5 +1,6 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module MooTool
4
- VERSION = '0.2.7'
5
+ VERSION = '0.2.8'
5
6
  end
data/lib/mootool.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # typed: strict
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require_relative 'mootool/version'
data/sorbet/config CHANGED
@@ -1,3 +1,3 @@
1
1
  --dir
2
2
  .
3
- --ignore=/vendor/bundle
3
+ --ignore=/vendor/bundle
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-vendored=true
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: true
2
2
 
3
3
  # DO NOT EDIT MANUALLY
4
4
  # This file was pulled from a central RBI files repository.
@@ -266,4 +266,4 @@ module Rainbow
266
266
  end
267
267
 
268
268
  sig { params(string: String).returns(Rainbow::Presenter) }
269
- def Rainbow(string); end
269
+ def Rainbow(string); end
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-generated=true