rbs 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/CHANGELOG.md +37 -0
  4. data/Rakefile +3 -2
  5. data/Steepfile +2 -0
  6. data/bin/rbs-prof +1 -1
  7. data/core/array.rbs +8 -4
  8. data/core/thread.rbs +14 -1
  9. data/lib/rbs.rb +3 -0
  10. data/lib/rbs/ancestor_graph.rb +90 -0
  11. data/lib/rbs/char_scanner.rb +20 -0
  12. data/lib/rbs/definition_builder.rb +38 -20
  13. data/lib/rbs/definition_builder/method_builder.rb +14 -0
  14. data/lib/rbs/environment.rb +42 -5
  15. data/lib/rbs/environment_walker.rb +4 -4
  16. data/lib/rbs/errors.rb +32 -17
  17. data/lib/rbs/parser.rb +437 -416
  18. data/lib/rbs/parser.y +29 -16
  19. data/lib/rbs/test/type_check.rb +7 -3
  20. data/lib/rbs/version.rb +1 -1
  21. data/sig/ancestor_graph.rbs +40 -0
  22. data/sig/char_scanner.rbs +9 -0
  23. data/sig/definition_builder.rbs +5 -1
  24. data/sig/environment.rbs +22 -2
  25. data/sig/environment_walker.rbs +39 -0
  26. data/sig/errors.rbs +42 -17
  27. data/sig/method_builder.rbs +2 -0
  28. data/sig/parser.rbs +11 -4
  29. data/sig/polyfill.rbs +0 -14
  30. data/stdlib/cgi/0/core.rbs +595 -0
  31. data/stdlib/rubygems/0/basic_specification.rbs +3 -0
  32. data/stdlib/rubygems/0/config_file.rbs +3 -0
  33. data/stdlib/rubygems/0/dependency_installer.rbs +5 -0
  34. data/stdlib/rubygems/0/installer.rbs +3 -0
  35. data/stdlib/rubygems/0/path_support.rbs +3 -0
  36. data/stdlib/rubygems/0/platform.rbs +3 -0
  37. data/stdlib/rubygems/0/request_set.rbs +7 -0
  38. data/stdlib/rubygems/0/requirement.rbs +3 -0
  39. data/stdlib/rubygems/0/rubygems.rbs +710 -0
  40. data/stdlib/rubygems/0/source_list.rbs +2 -0
  41. data/stdlib/rubygems/0/specification.rbs +3 -0
  42. data/stdlib/rubygems/0/stream_ui.rbs +3 -0
  43. data/stdlib/rubygems/0/uninstaller.rbs +3 -0
  44. data/stdlib/rubygems/0/version.rbs +228 -0
  45. data/stdlib/strscan/0/string_scanner.rbs +582 -0
  46. metadata +23 -2
@@ -0,0 +1,3 @@
1
+ class Gem::BasicSpecification
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::ConfigFile
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,5 @@
1
+ class Gem::DependencyInstaller
2
+ type options = Hash[Symbol, untyped] # TODO: Add options...
3
+
4
+ # TODO: Add sinatures...
5
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::Installer
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::PathSupport
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::Platform
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,7 @@
1
+ class Gem::RequestSet
2
+ # TODO: Add sinatures...
3
+ end
4
+
5
+ class Gem::RequestSet::GemDependencyAPI
6
+ # TODO: Add sinatures...
7
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::Requirement
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,710 @@
1
+ # RubyGems is the Ruby standard for publishing and managing third party
2
+ # libraries.
3
+ #
4
+ # For user documentation, see:
5
+ #
6
+ # * `gem help` and `gem help [command]`
7
+ # * [RubyGems User Guide](https://guides.rubygems.org/)
8
+ # * [Frequently Asked Questions](https://guides.rubygems.org/faqs)
9
+ #
10
+ #
11
+ # For gem developer documentation see:
12
+ #
13
+ # * [Creating Gems](https://guides.rubygems.org/make-your-own-gem)
14
+ # * Gem::Specification
15
+ # * Gem::Version for version dependency notes
16
+ #
17
+ #
18
+ # Further RubyGems documentation can be found at:
19
+ #
20
+ # * [RubyGems Guides](https://guides.rubygems.org)
21
+ # * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
22
+ # available from `gem server`)
23
+ #
24
+ #
25
+ # ## RubyGems Plugins
26
+ #
27
+ # RubyGems will load plugins in the latest version of each installed gem or
28
+ # $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and
29
+ # placed at the root of your gem's #require_path. Plugins are installed at a
30
+ # special location and loaded on boot.
31
+ #
32
+ # For an example plugin, see the [Graph gem](https://github.com/seattlerb/graph)
33
+ # which adds a `gem graph` command.
34
+ #
35
+ # ## RubyGems Defaults, Packaging
36
+ #
37
+ # RubyGems defaults are stored in lib/rubygems/defaults.rb. If you're packaging
38
+ # RubyGems or implementing Ruby you can change RubyGems' defaults.
39
+ #
40
+ # For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb and
41
+ # override any defaults from lib/rubygems/defaults.rb.
42
+ #
43
+ # For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and
44
+ # override any defaults from lib/rubygems/defaults.rb.
45
+ #
46
+ # If you need RubyGems to perform extra work on install or uninstall, your
47
+ # defaults override file can set pre/post install and uninstall hooks. See
48
+ # Gem::pre_install, Gem::pre_uninstall, Gem::post_install, Gem::post_uninstall.
49
+ #
50
+ # ## Bugs
51
+ #
52
+ # You can submit bugs to the [RubyGems bug
53
+ # tracker](https://github.com/rubygems/rubygems/issues) on GitHub
54
+ #
55
+ # ## Credits
56
+ #
57
+ # RubyGems is currently maintained by Eric Hodel.
58
+ #
59
+ # RubyGems was originally developed at RubyConf 2003 by:
60
+ #
61
+ # * Rich Kilmer -- rich(at)infoether.com
62
+ # * Chad Fowler -- chad(at)chadfowler.com
63
+ # * David Black -- dblack(at)wobblini.net
64
+ # * Paul Brannan -- paul(at)atdesk.com
65
+ # * Jim Weirich -- jim(at)weirichhouse.org
66
+ #
67
+ #
68
+ # Contributors:
69
+ #
70
+ # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
71
+ # * George Marrows -- george.marrows(at)ntlworld.com
72
+ # * Dick Davies -- rasputnik(at)hellooperator.net
73
+ # * Mauricio Fernandez -- batsman.geo(at)yahoo.com
74
+ # * Simon Strandgaard -- neoneye(at)adslhome.dk
75
+ # * Dave Glasser -- glasser(at)mit.edu
76
+ # * Paul Duncan -- pabs(at)pablotron.org
77
+ # * Ville Aine -- vaine(at)cs.helsinki.fi
78
+ # * Eric Hodel -- drbrain(at)segment7.net
79
+ # * Daniel Berger -- djberg96(at)gmail.com
80
+ # * Phil Hagelberg -- technomancy(at)gmail.com
81
+ # * Ryan Davis -- ryand-ruby(at)zenspider.com
82
+ # * Evan Phoenix -- evan(at)fallingsnow.net
83
+ # * Steve Klabnik -- steve(at)steveklabnik.com
84
+ #
85
+ #
86
+ # (If your name is missing, PLEASE let us know!)
87
+ #
88
+ # ## License
89
+ #
90
+ # See [LICENSE.txt](rdoc-ref:lib/rubygems/LICENSE.txt) for permissions.
91
+ #
92
+ # Thanks!
93
+ #
94
+ # -The RubyGems Team
95
+ #
96
+ module Gem
97
+ interface _HashLike[K, V]
98
+ def each_pair: () { ([ K, V ]) -> untyped } -> self
99
+ end
100
+
101
+ DEFAULT_HOST: String
102
+
103
+ GEM_DEP_FILES: Array[String]
104
+
105
+ # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to
106
+ # override Kernel#warn
107
+ #
108
+ KERNEL_WARN_IGNORES_INTERNAL_ENTRIES: bool
109
+
110
+ LOADED_SPECS_MUTEX: Thread::Mutex
111
+
112
+ # Location of Marshal quick gemspecs on remote repositories
113
+ #
114
+ MARSHAL_SPEC_DIR: String
115
+
116
+ # Exception classes used in a Gem.read_binary `rescue` statement
117
+ #
118
+ READ_BINARY_ERRORS: Array[Class]
119
+
120
+ # Subdirectories in a gem repository for default gems
121
+ #
122
+ REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES: Array[String]
123
+
124
+ # Subdirectories in a gem repository
125
+ #
126
+ REPOSITORY_SUBDIRECTORIES: Array[String]
127
+
128
+ RUBYGEMS_DIR: String
129
+
130
+ # Taint support is deprecated in Ruby 2.7. This allows switching ".untaint" to
131
+ # ".tap(&Gem::UNTAINT)", to avoid deprecation warnings in Ruby 2.7.
132
+ #
133
+ UNTAINT: Proc
134
+
135
+ VERSION: String
136
+
137
+ # An Array of Regexps that match windows Ruby platforms.
138
+ #
139
+ WIN_PATTERNS: Array[Regexp]
140
+
141
+ # Exception classes used in Gem.write_binary `rescue` statement
142
+ #
143
+ WRITE_BINARY_ERRORS: Array[Class]
144
+
145
+ # The number of paths in the `$LOAD_PATH` from activated gems. Used to
146
+ # prioritize `-I` and `[ENV]('RUBYLIB`)` entries during `require`.
147
+ #
148
+ def self.activated_gem_paths: () -> Integer
149
+
150
+ # Add a list of paths to the $LOAD_PATH at the proper place.
151
+ #
152
+ def self.add_to_load_path: (*String paths) -> Array[String]
153
+
154
+ # Find the full path to the executable for gem `name`. If the `exec_name` is
155
+ # not given, an exception will be raised, otherwise the specified executable's
156
+ # path is returned. `requirements` allows you to specify specific gem versions.
157
+ #
158
+ def self.bin_path: (String name, String exec_name, ?Array[Requirement] requirements) -> String
159
+
160
+ # The mode needed to read a file as straight binary.
161
+ #
162
+ def self.binary_mode: () -> String
163
+
164
+ # The path where gem executables are to be installed.
165
+ #
166
+ def self.bindir: (?String install_dir) -> String
167
+
168
+ # The path to standard location of the user's cache directory.
169
+ #
170
+ def self.cache_home: () -> String
171
+
172
+ # Clear default gem related variables. It is for test
173
+ #
174
+ def self.clear_default_specs: () -> void
175
+
176
+ # Reset the `dir` and `path` values. The next time `dir` or `path` is
177
+ # requested, the values will be calculated from scratch. This is mainly used by
178
+ # the unit tests to provide test isolation.
179
+ #
180
+ def self.clear_paths: () -> void
181
+
182
+ # The path to standard location of the user's .gemrc file.
183
+ #
184
+ def self.config_file: () -> String
185
+
186
+ # The path to standard location of the user's configuration directory.
187
+ #
188
+ def self.config_home: () -> String
189
+
190
+ # The standard configuration object for gems.
191
+ #
192
+ def self.configuration: () -> ConfigFile
193
+
194
+ # Use the given configuration object (which implements the ConfigFile protocol)
195
+ # as the standard configuration object.
196
+ #
197
+ def self.configuration=: (ConfigFile config) -> ConfigFile
198
+
199
+ # The path to standard location of the user's data directory.
200
+ #
201
+ def self.data_home: () -> String
202
+
203
+ # The path to the data directory specified by the gem name. If the package is
204
+ # not available as a gem, return nil.
205
+ #
206
+ def self.datadir: (String gem_name) -> String?
207
+
208
+ # The default directory for binaries
209
+ #
210
+ def self.default_bindir: () -> String
211
+
212
+ # The default signing certificate chain path
213
+ #
214
+ def self.default_cert_path: () -> String
215
+
216
+ # Default home directory path to be used if an alternate value is not specified
217
+ # in the environment
218
+ #
219
+ def self.default_dir: () -> String
220
+
221
+ # Deduce Ruby's --program-prefix and --program-suffix from its install name
222
+ #
223
+ def self.default_exec_format: () -> String
224
+
225
+ # Returns binary extensions dir for specified RubyGems base dir or nil if such
226
+ # directory cannot be determined.
227
+ #
228
+ # By default, the binary extensions are located side by side with their Ruby
229
+ # counterparts, therefore nil is returned
230
+ #
231
+ def self.default_ext_dir_for: (String base_dir) -> String?
232
+
233
+ # The default signing key path
234
+ #
235
+ def self.default_key_path: () -> String
236
+
237
+ # Default gem load path
238
+ #
239
+ def self.default_path: () -> Array[String]
240
+
241
+ # Paths where RubyGems' .rb files and bin files are installed
242
+ #
243
+ def self.default_rubygems_dirs: () -> Array[String]?
244
+
245
+ # An Array of the default sources that come with RubyGems
246
+ #
247
+ def self.default_sources: () -> Array[String]
248
+
249
+ # Default spec directory path to be used if an alternate value is not specified
250
+ # in the environment
251
+ #
252
+ def self.default_spec_cache_dir: () -> String
253
+
254
+ # Path to specification files of default gems.
255
+ #
256
+ def self.default_specifications_dir: () -> String
257
+
258
+ # A Zlib::Deflate.deflate wrapper
259
+ #
260
+ def self.deflate: (String data) -> String
261
+
262
+ # The path where gems are to be installed.
263
+ #
264
+ def self.dir: () -> String
265
+
266
+ # RubyGems distributors (like operating system package managers) can disable
267
+ # RubyGems update by setting this to error message printed to end-users on gem
268
+ # update --system instead of actual update.
269
+ #
270
+ def self.disable_system_update_message: () -> String?
271
+
272
+ def self.disable_system_update_message=: (String?) -> String?
273
+
274
+ # Adds a post-installs hook that will be passed a Gem::DependencyInstaller and a
275
+ # list of installed specifications when Gem::DependencyInstaller#install is
276
+ # complete
277
+ #
278
+ def self.done_installing: () { (DependencyInstaller, Array[Specification]) -> untyped } -> Array[Proc]
279
+
280
+ # The list of hooks to be run after Gem::DependencyInstaller installs a set of
281
+ # gems
282
+ #
283
+ def self.done_installing_hooks: () -> Array[Proc?]
284
+
285
+ # Quietly ensure the Gem directory `dir` contains all the proper subdirectories
286
+ # for handling default gems. If we can't create a directory due to a permission
287
+ # problem, then we will silently continue.
288
+ #
289
+ # If `mode` is given, missing directories are created with this mode.
290
+ #
291
+ # World-writable directories will never be created.
292
+ #
293
+ def self.ensure_default_gem_subdirectories: (?String dir, ?Integer | String mode) -> Array[String]
294
+
295
+ # Quietly ensure the Gem directory `dir` contains all the proper subdirectories.
296
+ # If we can't create a directory due to a permission problem, then we will
297
+ # silently continue.
298
+ #
299
+ # If `mode` is given, missing directories are created with this mode.
300
+ #
301
+ # World-writable directories will never be created.
302
+ #
303
+ def self.ensure_gem_subdirectories: (?String dir, ?Integer | String mode) -> Array[String]
304
+
305
+ def self.env_requirement: (String gem_name) -> Requirement
306
+
307
+ # Finds the user's config file
308
+ #
309
+ def self.find_config_file: () -> String
310
+
311
+ # Returns a list of paths matching `glob` that can be used by a gem to pick up
312
+ # features from other gems. For example:
313
+ #
314
+ # Gem.find_files('rdoc/discover').each do |path| load path end
315
+ #
316
+ # if `check_load_path` is true (the default), then find_files also searches
317
+ # $LOAD_PATH for files as well as gems.
318
+ #
319
+ # Note that find_files will return all files even if they are from different
320
+ # versions of the same gem. See also find_latest_files
321
+ #
322
+ def self.find_files: (String glob, ?boolish check_load_path) -> Array[String]
323
+
324
+ # Returns a list of paths matching `glob` from the latest gems that can be used
325
+ # by a gem to pick up features from other gems. For example:
326
+ #
327
+ # Gem.find_latest_files('rdoc/discover').each do |path| load path end
328
+ #
329
+ # if `check_load_path` is true (the default), then find_latest_files also
330
+ # searches $LOAD_PATH for files as well as gems.
331
+ #
332
+ # Unlike find_files, find_latest_files will return only files from the latest
333
+ # version of a gem.
334
+ #
335
+ def self.find_latest_files: (String glob, ?boolish check_load_path) -> Array[String]
336
+
337
+ # Find a Gem::Specification of default gem from `path`
338
+ #
339
+ def self.find_unresolved_default_spec: (String path) -> Specification?
340
+
341
+ def self.finish_resolve: (?RequestSet request_set) -> Array[Specification]
342
+
343
+ # GemDependencyAPI object, which is set when .use_gemdeps is called. This
344
+ # contains all the information from the Gemfile.
345
+ #
346
+ def self.gemdeps: () -> RequestSet::GemDependencyAPI?
347
+
348
+ # Get the default RubyGems API host. This is normally `https://rubygems.org`.
349
+ #
350
+ def self.host: () -> String
351
+
352
+ # Set the default RubyGems API host.
353
+ #
354
+ def self.host=: (String host) -> String
355
+
356
+ # Top level install helper method. Allows you to install gems interactively:
357
+ #
358
+ # % irb
359
+ # >> Gem.install "minitest"
360
+ # Fetching: minitest-5.14.0.gem (100%)
361
+ # => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
362
+ #
363
+ def self.install: (String name, ?Gem::Requirement version, *DependencyInstaller::options options) -> Array[Specification]
364
+
365
+ # Is this a java platform?
366
+ #
367
+ def self.java_platform?: () -> bool
368
+
369
+ # Returns the latest release version of RubyGems.
370
+ #
371
+ def self.latest_rubygems_version: () -> Version
372
+
373
+ # Returns the latest release-version specification for the gem `name`.
374
+ #
375
+ def self.latest_spec_for: (String name) -> Specification?
376
+
377
+ # Returns the version of the latest release-version of gem `name`
378
+ #
379
+ def self.latest_version_for: (String name) -> Version?
380
+
381
+ # Find all 'rubygems_plugin' files in $LOAD_PATH and load them
382
+ #
383
+ def self.load_env_plugins: () -> Array[String]
384
+
385
+ # The index to insert activated gem paths into the $LOAD_PATH. The activated
386
+ # gem's paths are inserted before site lib directory by default.
387
+ #
388
+ def self.load_path_insert_index: () -> Integer
389
+
390
+ # Find rubygems plugin files in the standard location and load them
391
+ #
392
+ def self.load_plugins: () -> Array[String]
393
+
394
+ # Loads YAML, preferring Psych
395
+ #
396
+ def self.load_yaml: () -> bool?
397
+
398
+ # Hash of loaded Gem::Specification keyed by name
399
+ #
400
+ def self.loaded_specs: () -> Hash[String, BasicSpecification]
401
+
402
+ # The file name and line number of the caller of the caller of this method.
403
+ #
404
+ # `depth` is how many layers up the call stack it should go.
405
+ #
406
+ # e.g.,
407
+ #
408
+ # def a; Gem.location_of_caller; end a #=> ["x.rb", 2] # (it'll vary depending
409
+ # on file name and line number)
410
+ #
411
+ # def b; c; end def c; Gem.location_of_caller(2); end b #=> ["x.rb", 6] #
412
+ # (it'll vary depending on file name and line number)
413
+ #
414
+ def self.location_of_caller: (?Integer depth) -> [ String, Integer ]
415
+
416
+ # The version of the Marshal format for your Ruby.
417
+ #
418
+ def self.marshal_version: () -> String
419
+
420
+ def self.needs: () { (RequestSet) -> untyped } -> Array[Specification]
421
+
422
+ # Default options for gem commands for Ruby packagers.
423
+ #
424
+ # The options here should be structured as an array of string "gem" command
425
+ # names as keys and a string of the default options as values.
426
+ #
427
+ # Example:
428
+ #
429
+ # def self.operating_system_defaults
430
+ # {
431
+ # 'install' => '--no-rdoc --no-ri --env-shebang',
432
+ # 'update' => '--no-rdoc --no-ri --env-shebang'
433
+ # }
434
+ #
435
+ # end
436
+ #
437
+ def self.operating_system_defaults: () -> Hash[String, String]
438
+
439
+ def self.path: () -> Array[String]
440
+
441
+ # How String Gem paths should be split. Overridable for esoteric platforms.
442
+ #
443
+ def self.path_separator: () -> String
444
+
445
+ # Retrieve the PathSupport object that RubyGems uses to lookup files.
446
+ #
447
+ def self.paths: () -> PathSupport
448
+
449
+ # Initialize the filesystem paths to use from `env`. `env` is a hash-like object
450
+ # (typically ENV) that is queried for 'GEM_HOME', 'GEM_PATH', and
451
+ # 'GEM_SPEC_CACHE' Keys for the `env` hash should be Strings, and values of the
452
+ # hash should be Strings or `nil`.
453
+ #
454
+ def self.paths=: (_HashLike[String, String?] env) -> Array[String]
455
+
456
+ # Default options for gem commands for Ruby implementers.
457
+ #
458
+ # The options here should be structured as an array of string "gem" command
459
+ # names as keys and a string of the default options as values.
460
+ #
461
+ # Example:
462
+ #
463
+ # def self.platform_defaults
464
+ # {
465
+ # 'install' => '--no-rdoc --no-ri --env-shebang',
466
+ # 'update' => '--no-rdoc --no-ri --env-shebang'
467
+ # }
468
+ #
469
+ # end
470
+ #
471
+ def self.platform_defaults: () -> Hash[String, String]
472
+
473
+ # Array of platforms this RubyGems supports.
474
+ #
475
+ def self.platforms: () -> Array[String | Platform]
476
+
477
+ # Set array of platforms this RubyGems supports (primarily for testing).
478
+ #
479
+ def self.platforms=: (Array[String | Platform] platforms) -> Array[String | Platform]
480
+
481
+ # Glob pattern for require-able plugin suffixes.
482
+ #
483
+ def self.plugin_suffix_pattern: () -> String
484
+
485
+ # Regexp for require-able plugin suffixes.
486
+ #
487
+ def self.plugin_suffix_regexp: () -> Regexp
488
+
489
+ # The path were rubygems plugins are to be installed.
490
+ #
491
+ def self.plugindir: (?String install_dir) -> String
492
+
493
+ # Adds a post-build hook that will be passed an Gem::Installer instance when
494
+ # Gem::Installer#install is called. The hook is called after the gem has been
495
+ # extracted and extensions have been built but before the executables or gemspec
496
+ # has been written. If the hook returns `false` then the gem's files will be
497
+ # removed and the install will be aborted.
498
+ #
499
+ def self.post_build: () { (Installer) -> untyped } -> Array[Proc]
500
+
501
+ # The list of hooks to be run after Gem::Installer#install extracts files and
502
+ # builds extensions
503
+ #
504
+ def self.post_build_hooks: () -> Array[Proc]
505
+
506
+ # Adds a post-install hook that will be passed an Gem::Installer instance when
507
+ # Gem::Installer#install is called
508
+ #
509
+ def self.post_install: () { (Installer) -> untyped } -> Array[Proc]
510
+
511
+ # The list of hooks to be run after Gem::Installer#install completes
512
+ # installation
513
+ #
514
+ def self.post_install_hooks: () -> Array[Proc]
515
+
516
+ # Adds a hook that will get run after Gem::Specification.reset is run.
517
+ #
518
+ def self.post_reset: () { () -> untyped } -> Array[Proc]
519
+
520
+ # The list of hooks to be run after Gem::Specification.reset is run.
521
+ #
522
+ def self.post_reset_hooks: () -> Array[Proc?]
523
+
524
+ # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance and
525
+ # the spec that was uninstalled when Gem::Uninstaller#uninstall is called
526
+ #
527
+ def self.post_uninstall: () { (Uninstaller) -> untyped } -> Array[Proc]
528
+
529
+ # The list of hooks to be run after Gem::Uninstaller#uninstall completes
530
+ # installation
531
+ #
532
+ def self.post_uninstall_hooks: () -> Array[Proc?]
533
+
534
+ # Adds a pre-install hook that will be passed an Gem::Installer instance when
535
+ # Gem::Installer#install is called. If the hook returns `false` then the
536
+ # install will be aborted.
537
+ #
538
+ def self.pre_install: () { (Installer) -> untyped } -> Array[Proc]
539
+
540
+ # The list of hooks to be run before Gem::Installer#install does any work
541
+ #
542
+ def self.pre_install_hooks: () -> Array[Proc?]
543
+
544
+ # Adds a hook that will get run before Gem::Specification.reset is run.
545
+ #
546
+ def self.pre_reset: () { () -> untyped } -> Array[Proc]
547
+
548
+ # The list of hooks to be run before Gem::Specification.reset is run.
549
+ #
550
+ def self.pre_reset_hooks: () -> Array[Proc?]
551
+
552
+ # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance and
553
+ # the spec that will be uninstalled when Gem::Uninstaller#uninstall is called
554
+ #
555
+ def self.pre_uninstall: () { (Uninstaller) -> untyped } -> Array[Proc]
556
+
557
+ # The list of hooks to be run before Gem::Uninstaller#uninstall does any work
558
+ #
559
+ def self.pre_uninstall_hooks: () -> Array[Proc?]
560
+
561
+ # The directory prefix this RubyGems was installed at. If your prefix is in a
562
+ # standard location (ie, rubygems is installed where you'd expect it to be),
563
+ # then prefix returns nil.
564
+ #
565
+ def self.prefix: () -> String?
566
+
567
+ # Safely read a file in binary mode on all platforms.
568
+ #
569
+ def self.read_binary: (String path) -> String
570
+
571
+ # Refresh available gems from disk.
572
+ #
573
+ def self.refresh: () -> Array[Proc]
574
+
575
+ # Register a Gem::Specification for default gem.
576
+ #
577
+ # Two formats for the specification are supported:
578
+ #
579
+ # * MRI 2.0 style, where spec.files contains unprefixed require names. The
580
+ # spec's filenames will be registered as-is.
581
+ # * New style, where spec.files contains files prefixed with paths from
582
+ # spec.require_paths. The prefixes are stripped before registering the
583
+ # spec's filenames. Unprefixed files are omitted.
584
+ #
585
+ def self.register_default_spec: (Specification spec) -> Array[String]
586
+
587
+ # The path to the running Ruby interpreter.
588
+ #
589
+ def self.ruby: () -> String
590
+
591
+ # Returns a String containing the API compatibility version of Ruby
592
+ #
593
+ def self.ruby_api_version: () -> String
594
+
595
+ def self.ruby_engine: () -> String
596
+
597
+ # A Gem::Version for the currently running Ruby.
598
+ #
599
+ def self.ruby_version: () -> Version
600
+
601
+ # A Gem::Version for the currently running RubyGems
602
+ #
603
+ def self.rubygems_version: () -> Version
604
+
605
+ # Returns the value of Gem.source_date_epoch_string, as a Time object.
606
+ #
607
+ # This is used throughout RubyGems for enabling reproducible builds.
608
+ #
609
+ def self.source_date_epoch: () -> Time
610
+
611
+ # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
612
+ # Otherwise, returns the time that `Gem.source_date_epoch_string` was first
613
+ # called in the same format as SOURCE_DATE_EPOCH.
614
+ #
615
+ # NOTE(@duckinator): The implementation is a tad weird because we want to:
616
+ # 1. Make builds reproducible by default, by having this function always
617
+ # return the same result during a given run.
618
+ # 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple
619
+ # tests that set this variable will be run in a single process.
620
+ #
621
+ # If you simplify this function and a lot of tests fail, that is likely due to
622
+ # #2 above.
623
+ #
624
+ # Details on SOURCE_DATE_EPOCH:
625
+ # https://reproducible-builds.org/specs/source-date-epoch/
626
+ #
627
+ def self.source_date_epoch_string: () -> String
628
+
629
+ # Returns an Array of sources to fetch remote gems from. Uses default_sources if
630
+ # the sources list is empty.
631
+ #
632
+ def self.sources: () -> SourceList
633
+
634
+ # Need to be able to set the sources without calling Gem.sources.replace since
635
+ # that would cause an infinite loop.
636
+ #
637
+ # DOC: This comment is not documentation about the method itself, it's more of a
638
+ # code comment about the implementation.
639
+ #
640
+ def self.sources=: (SourceList? new_sources) -> SourceList?
641
+
642
+ def self.spec_cache_dir: () -> String
643
+
644
+ # Glob pattern for require-able path suffixes.
645
+ #
646
+ def self.suffix_pattern: () -> String
647
+
648
+ # Regexp for require-able path suffixes.
649
+ #
650
+ def self.suffix_regexp: () -> Regexp
651
+
652
+ # Suffixes for require-able paths.
653
+ #
654
+ def self.suffixes: () -> Array[String]
655
+
656
+ # Prints the amount of time the supplied block takes to run using the debug UI
657
+ # output.
658
+ #
659
+ def self.time: [T] (String msg, ?Integer width, ?boolish display) { () -> T } -> T
660
+
661
+ # Try to activate a gem containing `path`. Returns true if activation succeeded
662
+ # or wasn't needed because it was already activated. Returns false if it can't
663
+ # find the path in a gem.
664
+ #
665
+ def self.try_activate: (String path) -> bool
666
+
667
+ # Lazily loads DefaultUserInteraction and returns the default UI.
668
+ #
669
+ def self.ui: () -> StreamUI
670
+
671
+ # Looks for a gem dependency file at `path` and activates the gems in the file
672
+ # if found. If the file is not found an ArgumentError is raised.
673
+ #
674
+ # If `path` is not given the RUBYGEMS_GEMDEPS environment variable is used, but
675
+ # if no file is found no exception is raised.
676
+ #
677
+ # If '-' is given for `path` RubyGems searches up from the current working
678
+ # directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and
679
+ # activates the gems in the first one found.
680
+ #
681
+ # You can run this automatically when rubygems starts. To enable, set the
682
+ # `RUBYGEMS_GEMDEPS` environment variable to either the path of your gem
683
+ # dependencies file or "-" to auto-discover in parent directories.
684
+ #
685
+ # NOTE: Enabling automatic discovery on multiuser systems can lead to execution
686
+ # of arbitrary code when used from directories outside your control.
687
+ #
688
+ def self.use_gemdeps: (?String path) -> Array[Specification]?
689
+
690
+ # Use the `home` and `paths` values for Gem.dir and Gem.path. Used mainly by
691
+ # the unit tests to provide environment isolation.
692
+ #
693
+ def self.use_paths: (String home, *String paths) -> Hash[String, String]
694
+
695
+ # Path for gems in the user's home directory
696
+ #
697
+ def self.user_dir: () -> String
698
+
699
+ # The home directory for the user.
700
+ #
701
+ def self.user_home: () -> String
702
+
703
+ # Is this a windows platform?
704
+ #
705
+ def self.win_platform?: () -> bool
706
+
707
+ # Safely write a file in binary mode on all platforms.
708
+ #
709
+ def self.write_binary: (String path, String data) -> Integer
710
+ end