sorbet 0.5.5841

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,189 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ require_relative '../real_stdlib'
5
+
6
+ require 'set'
7
+
8
+ if defined?(DelegateClass)
9
+ alias DelegateClass_without_rbi_generator DelegateClass
10
+ def DelegateClass(superclass)
11
+ result = DelegateClass_without_rbi_generator(superclass)
12
+ Sorbet::Private::GemGeneratorTracepoint::Tracer.register_delegate_class(superclass, result)
13
+ result
14
+ end
15
+ end
16
+
17
+ module Sorbet::Private
18
+ module GemGeneratorTracepoint
19
+ class Tracer
20
+ module ModuleOverride
21
+ def include(mod, *smth)
22
+ result = super
23
+ Sorbet::Private::GemGeneratorTracepoint::Tracer.on_module_included(mod, self)
24
+ result
25
+ end
26
+ end
27
+ Module.prepend(ModuleOverride)
28
+
29
+ module ObjectOverride
30
+ def extend(mod, *args)
31
+ result = super
32
+ Sorbet::Private::GemGeneratorTracepoint::Tracer.on_module_extended(mod, self)
33
+ result
34
+ end
35
+ end
36
+ Object.prepend(ObjectOverride)
37
+
38
+ module ClassOverride
39
+ def new(*)
40
+ result = super
41
+ Sorbet::Private::GemGeneratorTracepoint::Tracer.on_module_created(result)
42
+ result
43
+ end
44
+ end
45
+ Class.prepend(ClassOverride)
46
+
47
+ def self.register_delegate_class(klass, delegate)
48
+ @delegate_classes[Sorbet::Private::RealStdlib.real_object_id(delegate)] = klass
49
+ end
50
+
51
+ def self.on_module_created(mod)
52
+ add_to_context(type: :module, module: mod)
53
+ end
54
+
55
+ def self.on_module_included(included, includer)
56
+ add_to_context(type: :include, module: includer, include: included)
57
+ end
58
+
59
+ def self.on_module_extended(extended, extender)
60
+ add_to_context(type: :extend, module: extender, extend: extended)
61
+ end
62
+
63
+ def self.on_method_added(mod, method, singleton)
64
+ add_to_context(type: :method, module: mod, method: method, singleton: singleton)
65
+ end
66
+
67
+ T::Sig::WithoutRuntime.sig {returns({files: T::Hash, delegate_classes: T::Hash})}
68
+ def self.trace
69
+ start
70
+ yield
71
+ finish
72
+ trace_results
73
+ end
74
+
75
+ T::Sig::WithoutRuntime.sig {void}
76
+ def self.start
77
+ pre_cache_module_methods
78
+ install_tracepoints
79
+ end
80
+
81
+ T::Sig::WithoutRuntime.sig {void}
82
+ def self.finish
83
+ disable_tracepoints
84
+ end
85
+
86
+ T::Sig::WithoutRuntime.sig {returns({files: T::Hash, delegate_classes: T::Hash})}
87
+ def self.trace_results
88
+ {
89
+ files: @files,
90
+ delegate_classes: @delegate_classes
91
+ }
92
+ end
93
+
94
+ private
95
+
96
+ @modules = {}
97
+ @context_stack = [[]]
98
+ @files = {}
99
+ @delegate_classes = {}
100
+
101
+ def self.pre_cache_module_methods
102
+ ObjectSpace.each_object(Module) do |mod_|
103
+ mod = T.cast(mod_, Module)
104
+ @modules[Sorbet::Private::RealStdlib.real_object_id(mod)] = (Sorbet::Private::RealStdlib.real_instance_methods(mod, false) + Sorbet::Private::RealStdlib.real_private_instance_methods(mod, false)).to_set
105
+ end
106
+ end
107
+
108
+ def self.add_to_context(item)
109
+ # The stack can be empty because we start the :c_return TracePoint inside a 'require' call.
110
+ # In this case, it's okay to simply add something to the stack; it will be popped off when
111
+ # the :c_return is traced.
112
+ @context_stack << [] if @context_stack.empty?
113
+ @context_stack.last << item
114
+ end
115
+
116
+ def self.install_tracepoints
117
+ @class_tracepoint = TracePoint.new(:class) do |tp|
118
+ on_module_created(tp.self)
119
+ end
120
+ @c_call_tracepoint = TracePoint.new(:c_call) do |tp|
121
+
122
+ # older version of JRuby unfortunately returned a String
123
+ case tp.method_id.to_sym
124
+ when :require, :require_relative
125
+ @context_stack << []
126
+ end
127
+ end
128
+ @c_return_tracepoint = TracePoint.new(:c_return) do |tp|
129
+
130
+ # older version of JRuby unfortunately returned a String
131
+ method_id_sym = tp.method_id.to_sym
132
+ case method_id_sym
133
+ when :require, :require_relative
134
+ popped = @context_stack.pop
135
+
136
+ next if popped.empty?
137
+
138
+ path = $LOADED_FEATURES.last
139
+ if tp.return_value != true # intentional true check
140
+ next if popped.size == 1 && popped[0][:module].is_a?(LoadError)
141
+ # warn("Unexpected: constants or methods were defined when #{tp.method_id} didn't return true; adding to #{path} instead")
142
+ end
143
+
144
+ # raise 'Unexpected: constants or methods were defined without a file added to $LOADED_FEATURES' if path.nil?
145
+ # raise "Unexpected: #{path} is already defined in files" if files.key?(path)
146
+
147
+ @files[path] ||= []
148
+ @files[path] += popped
149
+
150
+ # popped.each { |item| item[:path] = path }
151
+ when :method_added, :singleton_method_added
152
+ begin
153
+ tp.disable
154
+
155
+ singleton = method_id_sym == :singleton_method_added
156
+ receiver = singleton ? Sorbet::Private::RealStdlib.real_singleton_class(tp.self) : tp.self
157
+
158
+ # JRuby the main Object is not a module
159
+ # so lets skip it, otherwise RealStdlib#real_instance_methods raises an exception since it expects one.
160
+ next unless receiver.is_a?(Module)
161
+
162
+ methods = Sorbet::Private::RealStdlib.real_instance_methods(receiver, false) + Sorbet::Private::RealStdlib.real_private_instance_methods(receiver, false)
163
+ set = @modules[Sorbet::Private::RealStdlib.real_object_id(receiver)] ||= Set.new
164
+ added = methods.find { |m| !set.include?(m) }
165
+ if added.nil?
166
+ # warn("Warning: could not find method added to #{tp.self} at #{tp.path}:#{tp.lineno}")
167
+ next
168
+ end
169
+ set << added
170
+
171
+ on_method_added(tp.self, added, singleton)
172
+ ensure
173
+ tp.enable
174
+ end
175
+ end
176
+ end
177
+ @class_tracepoint.enable
178
+ @c_call_tracepoint.enable
179
+ @c_return_tracepoint.enable
180
+ end
181
+
182
+ def self.disable_tracepoints
183
+ @class_tracepoint.disable
184
+ @c_call_tracepoint.disable
185
+ @c_return_tracepoint.disable
186
+ end
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,1249 @@
1
+ # frozen_string_literal: true
2
+ # typed: ignore
3
+
4
+ class Sorbet::Private::GemLoader
5
+ NO_GEM = "_unknown"
6
+
7
+ # A map defining the code to load a gem. By default any gem mentioned by
8
+ # Gemfile is loaded by its name, here are either overrides or things that
9
+ # Bundler misses.
10
+ GEM_LOADER = {
11
+ 'Ascii85' => proc do
12
+ my_require 'ascii85'
13
+ end,
14
+ 'aws-sdk-v1' => proc do
15
+ my_require 'aws-sdk-v1'
16
+ AWS.eager_autoload!
17
+ [
18
+ AWS::DynamoDB::Errors::InternalServerError,
19
+ AWS::DynamoDB::Errors::ProvisionedThroughputExceededException,
20
+ AWS::DynamoDB::Errors::ResourceInUseException,
21
+ AWS::DynamoDB::Errors::ResourceNotFoundException,
22
+ AWS::EC2::Errors::RequestLimitExceeded,
23
+ AWS::S3::Errors::AccessDenied,
24
+ AWS::S3::Errors::NoSuchBucket,
25
+ AWS::S3::Errors::NotFound,
26
+ ]
27
+ end,
28
+ 'aws-sdk-core' => proc do
29
+ my_require 'aws-sdk'
30
+ [
31
+ Aws::AssumeRoleCredentials,
32
+ Aws::Athena,
33
+ Aws::AutoScaling::Client,
34
+ Aws::AutoScaling::Errors::AlreadyExists,
35
+ Aws::AutoScaling::Errors::Throttling,
36
+ Aws::AutoScaling::Errors::ValidationError,
37
+ Aws::CloudFormation::Client,
38
+ Aws::CloudFormation::Errors::ValidationError,
39
+ Aws::CloudWatchLogs::Client,
40
+ Aws::Credentials,
41
+ Aws::DynamoDB::Client,
42
+ Aws::DynamoDB::Errors::ProvisionedThroughputExceededException,
43
+ Aws::EC2::Errors::RequestLimitExceeded,
44
+ Aws::ElasticLoadBalancing::Client,
45
+ Aws::Errors::ServiceError,
46
+ Aws::IAM::Client,
47
+ Aws::IAM::Errors::NoSuchEntity,
48
+ Aws::IAM::Resource,
49
+ Aws::InstanceProfileCredentials,
50
+ Aws::Lambda::Client,
51
+ Aws::Query::ParamList,
52
+ Aws::S3::Bucket,
53
+ Aws::S3::Client,
54
+ Aws::S3::Encryption::Client,
55
+ Aws::S3::Errors::InvalidRange,
56
+ Aws::S3::Errors::NoSuchKey,
57
+ Aws::S3::Errors::NotFound,
58
+ Aws::S3::Object,
59
+ Aws::S3::Resource,
60
+ Aws::SES::Client,
61
+ Aws::SES::Errors,
62
+ Aws::SES::Errors::AccessDenied,
63
+ Aws::SES::Errors::MessageRejected,
64
+ Aws::SES::Errors::ServiceError,
65
+ Aws::SES::Types,
66
+ Aws::SES::Types::SendEmailResponse,
67
+ Aws::SNS::Client,
68
+ Aws::SNS::MessageVerifier,
69
+ Aws::SQS::QueuePoller,
70
+ Aws::STS::Client,
71
+ Aws::STS::Errors::AccessDenied,
72
+ Seahorse::Client::NetworkingError,
73
+ Seahorse::Client::Response,
74
+ ]
75
+ end,
76
+ 'bloomfilter-rb' => proc do
77
+ my_require 'bloomfilter-rb'
78
+ end,
79
+ 'hashie' => proc do
80
+ my_require 'hashie'
81
+ [
82
+ Hashie::Mash,
83
+ ]
84
+ end,
85
+ 'hike' => proc do
86
+ my_require 'hike'
87
+ [
88
+ Hike::Trail,
89
+ ]
90
+ end,
91
+ 'http' => proc do
92
+ my_require 'http'
93
+ end,
94
+ 'http-form_data' => proc do
95
+ my_require 'http/form_data'
96
+ end,
97
+ 'http_parser.rb' => proc do
98
+ my_require 'http/parser'
99
+ end,
100
+ 'minitest' => proc do
101
+ my_require 'minitest'
102
+ my_require 'minitest/mock'
103
+ my_require 'minitest/spec'
104
+ my_require 'minitest/reporters'
105
+ end,
106
+ 'rack-test' => proc do
107
+ my_require 'rack/test'
108
+ end,
109
+ 'pagerduty-full' => proc do
110
+ my_require 'pagerduty/full'
111
+ end,
112
+ 'puma' => proc do
113
+ my_require 'puma'
114
+ my_require 'puma/configuration'
115
+ my_require 'puma/launcher'
116
+ my_require 'puma/server'
117
+ end,
118
+ 'term-ansicolor' => proc do
119
+ my_require 'term/ansicolor'
120
+ end,
121
+ 'rexml' => proc do
122
+ my_require "rexml/document"
123
+ my_require "rexml/streamlistener"
124
+ end,
125
+ 'rubyzip' => proc do
126
+ my_require "zip"
127
+ my_require 'zip/filesystem'
128
+ end,
129
+ 'nsq-ruby' => proc do
130
+ my_require 'nsq'
131
+ end,
132
+ 'mongo-ruby-driver' => proc do
133
+ my_require 'mongo'
134
+ end,
135
+ 'presto-client-ruby' => proc do
136
+ my_require 'presto-client'
137
+ end,
138
+ 'bcrypt-ruby' => proc do
139
+ my_require 'bcrypt'
140
+ end,
141
+ 'xml-simple' => proc do
142
+ my_require 'xmlsimple'
143
+ end,
144
+ 'sinatra-contrib' => proc do
145
+ # We can't my_require all of 'sinatra/contrib' since we put `raise` in them
146
+ my_require 'sinatra/content_for'
147
+ my_require 'sinatra/capture'
148
+ my_require 'sinatra/multi_route'
149
+ my_require 'sinatra/contrib/version'
150
+ end,
151
+ 'sqreen' => proc do
152
+ ENV['SQREEN_DISABLE'] = 'true'
153
+ my_require 'sqreen'
154
+ end,
155
+ 'thin-attach_socket' => proc do
156
+ my_require 'thin'
157
+ my_require 'thin/attach_socket'
158
+ end,
159
+ 'sinatra-partial' => proc do
160
+ my_require 'sinatra/partial'
161
+ end,
162
+ 'rack_csrf' => proc do
163
+ my_require 'rack/csrf'
164
+ end,
165
+ 'rack-flash3' => proc do
166
+ my_require 'rack-flash'
167
+ end,
168
+ 'google-api-client' => proc do
169
+ # There are lots more but this is all we use for now
170
+ my_require 'google/apis/calendar_v3'
171
+ my_require 'google/apis/drive_v3'
172
+ my_require 'google/apis/gmail_v1'
173
+ end,
174
+ 'concurrent-ruby' => proc do
175
+ my_require 'concurrent'
176
+ end,
177
+ 'cld2' => proc do
178
+ my_require 'cld'
179
+ end,
180
+ 'twitter_cldr' => proc do
181
+ my_require 'twitter_cldr'
182
+ [
183
+ TwitterCldr::Shared::Territories,
184
+ ]
185
+ end,
186
+ 'stackprof' => proc do
187
+ my_require 'stackprof'
188
+ [
189
+ StackProf::Report,
190
+ ]
191
+ end,
192
+ 'sprockets' => proc do
193
+ my_require 'sprockets'
194
+ [
195
+ Sprockets::Cache::FileStore,
196
+ Sprockets::Environment,
197
+ Sprockets::Manifest,
198
+ ]
199
+ end,
200
+ 'signet' => proc do
201
+ my_require 'signet'
202
+ my_require 'signet/oauth_2/client'
203
+ end,
204
+ 'roo' => proc do
205
+ my_require 'roo'
206
+ [
207
+ Roo::Spreadsheet,
208
+ ]
209
+ version = Bundler.load.specs['roo'][0].stub.version
210
+ if Gem::Requirement.create('<2.0.0').satisfied_by?(version)
211
+ [
212
+ Roo::Excel,
213
+ ]
214
+ end
215
+ end,
216
+ 'rack-protection' => proc do
217
+ my_require 'rack-protection'
218
+ [
219
+ Rack::Protection::FrameOptions,
220
+ ]
221
+ end,
222
+ 'rack' => proc do
223
+ my_require 'rack'
224
+ [
225
+ Rack::BodyProxy,
226
+ Rack::Cascade,
227
+ Rack::Chunked,
228
+ Rack::CommonLogger,
229
+ Rack::ConditionalGet,
230
+ Rack::Config,
231
+ Rack::ContentLength,
232
+ Rack::ContentType,
233
+ Rack::ETag,
234
+ Rack::Events,
235
+ Rack::File,
236
+ Rack::Files,
237
+ Rack::Deflater,
238
+ Rack::Directory,
239
+ Rack::ForwardRequest,
240
+ Rack::Handler,
241
+ Rack::Head,
242
+ Rack::Lint,
243
+ Rack::Lock,
244
+ Rack::Logger,
245
+ Rack::MediaType,
246
+ Rack::MethodOverride,
247
+ Rack::Mime,
248
+ Rack::NullLogger,
249
+ Rack::Recursive,
250
+ Rack::Reloader,
251
+ Rack::RewindableInput,
252
+ Rack::Runtime,
253
+ Rack::Sendfile,
254
+ Rack::Server,
255
+ Rack::ShowExceptions,
256
+ Rack::ShowStatus,
257
+ Rack::Static,
258
+ Rack::TempfileReaper,
259
+ Rack::URLMap,
260
+ Rack::Utils,
261
+ Rack::Multipart,
262
+ Rack::MockResponse,
263
+ Rack::Response,
264
+ Rack::Auth::Basic,
265
+ Rack::Auth::AbstractRequest,
266
+ Rack::Auth::AbstractHandler,
267
+ Rack::Auth::Digest::MD5,
268
+ Rack::Auth::Digest::Nonce,
269
+ Rack::Auth::Digest::Params,
270
+ Rack::Auth::Digest::Request,
271
+ Rack::Session::Cookie,
272
+ Rack::Session::Pool,
273
+ Rack::Session::Memcache,
274
+ Rack::Handler::CGI,
275
+ Rack::Handler::FastCGI,
276
+ Rack::Handler::WEBrick,
277
+ Rack::Handler::LSWS,
278
+ Rack::Handler::SCGI,
279
+ Rack::Handler::Thin,
280
+ Rack::Multipart::Generator,
281
+ Rack::Multipart::UploadedFile,
282
+ ]
283
+ end,
284
+ 'poncho' => proc do
285
+ [
286
+ Poncho::ClientError,
287
+ Poncho::JSONMethod,
288
+ Poncho::Resource,
289
+ Poncho::ValidationError,
290
+ ]
291
+ end,
292
+ 'parser' => proc do
293
+ my_require 'parser'
294
+ my_require 'parser/ruby24'
295
+ end,
296
+ 'net' => proc do
297
+ my_require 'net/dns'
298
+ my_require 'net/ftp'
299
+ my_require 'net/http'
300
+ my_require 'net/http/digest_auth'
301
+ my_require 'net/http/persistent'
302
+ my_require 'net/imap'
303
+ my_require 'net/protocol'
304
+ my_require 'net/sftp'
305
+ my_require 'net/smtp'
306
+ my_require 'net/ssh'
307
+ my_require 'net/ssh/proxy/http'
308
+ my_require 'rubyntlm'
309
+ end,
310
+ 'openssl' => proc do
311
+ my_require 'openssl'
312
+ [
313
+ OpenSSL::X509::Store,
314
+ ]
315
+ end,
316
+ 'mail' => proc do
317
+ my_require 'mail'
318
+ [
319
+ Mail::Address,
320
+ Mail::AddressList,
321
+ Mail::Parsers::AddressListsParser,
322
+ Mail::Parsers::ContentDispositionParser,
323
+ Mail::Parsers::ContentLocationParser,
324
+ Mail::Parsers::ContentTransferEncodingParser,
325
+ Mail::Parsers::ContentTypeParser,
326
+ Mail::Parsers::DateTimeParser,
327
+ Mail::Parsers::EnvelopeFromParser,
328
+ Mail::Parsers::MessageIdsParser,
329
+ Mail::Parsers::MimeVersionParser,
330
+ Mail::Parsers::PhraseListsParser,
331
+ Mail::Parsers::ReceivedParser,
332
+ ]
333
+ end,
334
+ 'kramdown' => proc do
335
+ my_require 'kramdown'
336
+ [
337
+ Kramdown::Converter::Html,
338
+ ]
339
+ end,
340
+ 'ice_cube' => proc do
341
+ my_require 'ice_cube'
342
+ [
343
+ IceCube::DailyRule,
344
+ IceCube::MonthlyRule,
345
+ IceCube::WeeklyRule,
346
+ IceCube::YearlyRule,
347
+ IceCube::Schedule,
348
+ ]
349
+ end,
350
+ 'i18n' => proc do
351
+ my_require 'i18n'
352
+ [
353
+ I18n::Backend,
354
+ I18n::Backend::Base,
355
+ I18n::Backend::InterpolationCompiler,
356
+ I18n::Backend::Cache,
357
+ I18n::Backend::CacheFile,
358
+ I18n::Backend::Cascade,
359
+ I18n::Backend::Chain,
360
+ I18n::Backend::Fallbacks,
361
+ I18n::Backend::Flatten,
362
+ I18n::Backend::Gettext,
363
+ I18n::Backend::KeyValue,
364
+ I18n::Backend::Memoize,
365
+ I18n::Backend::Metadata,
366
+ I18n::Backend::Pluralization,
367
+ I18n::Backend::Simple,
368
+ I18n::Backend::Transliterator,
369
+ I18n::Config,
370
+ I18n::Gettext,
371
+ I18n::Gettext::Helpers,
372
+ I18n::Locale,
373
+ I18n::Locale::Fallbacks,
374
+ I18n::Locale::Tag,
375
+ I18n::Locale::Tag::Parents,
376
+ I18n::Locale::Tag::Rfc4646,
377
+ I18n::Locale::Tag::Simple,
378
+ I18n::Tests,
379
+ I18n::Middleware,
380
+ ]
381
+ end,
382
+ 'http-cookie' => proc do
383
+ my_require 'http-cookie'
384
+ my_require 'http/cookie_jar'
385
+ my_require 'mechanize'
386
+ [
387
+ HTTP::CookieJar::AbstractSaver,
388
+ ]
389
+ end,
390
+ 'faraday' => proc do
391
+ my_require 'faraday'
392
+ [
393
+ Faraday::Request::Multipart,
394
+ Faraday::Request::UrlEncoded,
395
+ Faraday::Response::RaiseError,
396
+ ]
397
+ end,
398
+ 'escort' => proc do
399
+ my_require 'escort'
400
+ [
401
+ Escort::App,
402
+ Escort::Setup::Dsl::Options,
403
+ Escort::Trollop::Parser,
404
+ ]
405
+ end,
406
+ 'digest' => proc do
407
+ my_require 'digest'
408
+ [
409
+ Digest::SHA2,
410
+ ]
411
+ end,
412
+ 'coderay' => proc do
413
+ my_require 'coderay'
414
+ [
415
+ CodeRay::VERSION,
416
+ CodeRay::FileType,
417
+ CodeRay::Tokens,
418
+ CodeRay::TokensProxy,
419
+ CodeRay::TokenKinds,
420
+ CodeRay::PluginHost,
421
+ CodeRay::Plugin,
422
+ CodeRay::Scanners,
423
+ CodeRay::Scanners::Scanner,
424
+ CodeRay::Scanners::Java::BuiltinTypes,
425
+ CodeRay::Scanners::Ruby::Patterns,
426
+ CodeRay::Scanners::Ruby::StringState,
427
+ CodeRay::Encoders,
428
+ CodeRay::Encoders::Encoder,
429
+ CodeRay::Encoders::HTML::Output,
430
+ CodeRay::Encoders::HTML::CSS,
431
+ CodeRay::Encoders::HTML::Numbering,
432
+ CodeRay::Styles,
433
+ CodeRay::Styles::Style,
434
+ CodeRay::Duo,
435
+ CodeRay::WordList,
436
+ ]
437
+ end,
438
+ 'byebug' => proc do
439
+ my_require 'byebug'
440
+ my_require 'byebug/core'
441
+ end,
442
+ 'racc' => proc do
443
+ my_require 'parser'
444
+ end,
445
+ 'rbnacl' => proc do
446
+ my_require 'rbnacl/libsodium'
447
+ end,
448
+ 'double-bag-ftps' => proc do
449
+ my_require 'double_bag_ftps'
450
+ end,
451
+ 'livechat_client' => proc do
452
+ my_require 'livechat'
453
+ end,
454
+ 'nio4r' => proc do
455
+ my_require 'nio'
456
+ end,
457
+ 'rgl' => proc do
458
+ my_require 'rgl/adjacency'
459
+ my_require 'rgl/implicit'
460
+ my_require 'rgl/traversal'
461
+ my_require 'rgl/graph_iterator'
462
+ my_require 'rgl/edmonds_karp'
463
+ end,
464
+ 'redcarpet' => proc do
465
+ my_require 'redcarpet'
466
+ my_require 'redcarpet/render_strip'
467
+ end,
468
+ 'sequel' => proc do
469
+ my_require 'sequel'
470
+ my_require 'sequel/sql'
471
+ end,
472
+ 'sequel_pg' => proc do
473
+ # sequel_pg assumes that it was required by the adapter class in sequel
474
+ # (i.e., it's not mean to be required manually). But also, sequel lazily
475
+ # loads the adapter class depending on the scheme of the database being
476
+ # connected to. Since 'srb init' never only requires and never connects,
477
+ # we need to manually load the adapter class ourself, which will then
478
+ # transitively load sequel_pg
479
+ my_require 'sequel/adapters/postgres'
480
+ end,
481
+ 'will_paginate' => proc do
482
+ my_require 'will_paginate'
483
+ my_require 'will_paginate/collection'
484
+ end,
485
+ 'yard' => proc do
486
+ my_require 'yard'
487
+ [
488
+ YARD::CodeObjects::MethodObject,
489
+ YARD::Docstring,
490
+ YARD::Handlers::Ruby::Base,
491
+ YARD::Registry,
492
+ YARD::Tags::Library,
493
+ YARD::Tags::Tag,
494
+ ]
495
+ end,
496
+ 'mocha' => proc do
497
+ my_require 'minitest/spec' # mocha forces you to do this first
498
+ my_require 'mocha/setup'
499
+ end,
500
+ 'bundler-audit' => proc do
501
+ my_require 'bundler/audit'
502
+ end,
503
+ 'google-protobuf' => proc do
504
+ my_require 'google/protobuf'
505
+ end,
506
+ 'multipart-post' => proc do
507
+ my_require 'net/http/post/multipart'
508
+ end,
509
+ 'rdl' => proc do
510
+ # needed because this isn't required by default in the Gemfile
511
+ my_require 'rdl_disable'
512
+ end,
513
+ 'rss' => proc do
514
+ # needed because this isn't required our Gemfile but some of our gems use it
515
+ my_require 'rss'
516
+ end,
517
+ 'ruby-ole' => proc do
518
+ my_require 'ole/storage'
519
+ end,
520
+ 'ruby-rc4' => proc do
521
+ my_require 'rc4'
522
+ end,
523
+ 'ruby-prof' => proc do
524
+ my_require 'ruby-prof'
525
+ [
526
+ RubyProf::AbstractPrinter,
527
+ ]
528
+ end,
529
+ 'stylus-source' => proc do
530
+ my_require 'stylus'
531
+ end,
532
+ 'time-utils' => proc do
533
+ my_require 'time/utils'
534
+ my_require 'date/utils'
535
+ end,
536
+ 'thor' => proc do
537
+ my_require 'thor'
538
+ [
539
+ Thor::Actions,
540
+ Thor::Group,
541
+ ]
542
+ end,
543
+ 'unicode-display_width' => proc do
544
+ my_require 'unicode/display_width'
545
+ end,
546
+ 'simplecov-html' => proc do
547
+ my_require 'simplecov'
548
+ end,
549
+ 'thwait' => proc do
550
+ my_require 'thwait'
551
+ end,
552
+ 'matrix' => proc do
553
+ my_require 'matrix'
554
+ end,
555
+ 'zxcvbn-ruby' => proc do
556
+ my_require 'zxcvbn'
557
+ end,
558
+ 'elasticsearch-transport' => proc do
559
+ my_require 'elasticsearch'
560
+ end,
561
+ 'tzinfo' => proc do
562
+ my_require 'tzinfo'
563
+ my_require 'tzinfo/data'
564
+ TZInfo::Timezone.all.map(&:canonical_zone)
565
+ end,
566
+ 'pry-doc' => proc do
567
+ my_require 'pry'
568
+ my_require 'pry-doc'
569
+ end,
570
+ 'taxjar-ruby' => proc do
571
+ my_require 'taxjar'
572
+ end,
573
+ 'nokogiri' => proc do
574
+ my_require 'nokogiri'
575
+ my_require 'webrobots'
576
+ my_require 'html_truncator'
577
+ end,
578
+ 'actionpack' => proc do
579
+ my_require 'action_pack'
580
+ my_require 'action_controller/railtie'
581
+ [
582
+ ActionController::Base,
583
+ ActionController::API,
584
+ ActionController::Base,
585
+ ActionController::Metal,
586
+ ActionController::Middleware,
587
+ ActionController::Renderer,
588
+ ActionController::FormBuilder,
589
+ ActionController::TestCase,
590
+ ActionController::TemplateAssertions,
591
+ ActionController::ConditionalGet,
592
+ ActionController::ContentSecurityPolicy,
593
+ ActionController::Cookies,
594
+ ActionController::DataStreaming,
595
+ ActionController::DefaultHeaders,
596
+ ActionController::EtagWithTemplateDigest,
597
+ ActionController::EtagWithFlash,
598
+ ActionController::FeaturePolicy,
599
+ ActionController::Flash,
600
+ ActionController::ForceSSL,
601
+ ActionController::Head,
602
+ ActionController::Helpers,
603
+ ActionController::HttpAuthentication,
604
+ ActionController::BasicImplicitRender,
605
+ ActionController::ImplicitRender,
606
+ ActionController::Instrumentation,
607
+ ActionController::Logging,
608
+ ActionController::MimeResponds,
609
+ ActionController::ParamsWrapper,
610
+ ActionController::Redirecting,
611
+ ActionController::Renderers,
612
+ ActionController::Rendering,
613
+ ActionController::RequestForgeryProtection,
614
+ ActionController::Rescue,
615
+ ActionController::Streaming,
616
+ ActionController::StrongParameters,
617
+ ActionController::ParameterEncoding,
618
+ ActionController::Testing,
619
+ ActionController::UrlFor,
620
+ ActionDispatch::SystemTestCase
621
+ ]
622
+ end,
623
+ 'actionview' => proc do
624
+ my_require 'action_view'
625
+ my_require 'action_view/railtie'
626
+ [
627
+ ActionView::Base,
628
+ ActionView::Context,
629
+ ActionView::Digestor,
630
+ ActionView::Helpers,
631
+ ActionView::LookupContext,
632
+ ActionView::Layouts,
633
+ ActionView::PathSet,
634
+ ActionView::RecordIdentifier,
635
+ ActionView::Rendering,
636
+ ActionView::RoutingUrlFor,
637
+ ActionView::Template,
638
+ ActionView::Template::Error,
639
+ ActionView::Template::RawFile,
640
+ ActionView::Template::Handlers,
641
+ ActionView::Template::HTML,
642
+ ActionView::Template::Inline,
643
+ ActionView::Template::Sources,
644
+ ActionView::Template::Text,
645
+ ActionView::Template::Types,
646
+ ActionView::UnboundTemplate,
647
+ ActionView::ViewPaths,
648
+ ActionView::TestCase,
649
+ ActionView::CacheExpiry,
650
+ ]
651
+ end,
652
+ 'actiontext' => proc do
653
+ my_require 'action_text'
654
+ my_require 'action_text/engine'
655
+ [
656
+ ActionText::Attachable,
657
+ ActionText::Attachables::ContentAttachment,
658
+ ActionText::Attachables::MissingAttachable,
659
+ ActionText::Attachables::RemoteImage,
660
+ ActionText::AttachmentGallery,
661
+ ActionText::Attachment,
662
+ ActionText::Attachments::Caching,
663
+ ActionText::Attachments::Minification,
664
+ ActionText::Attachments::TrixConversion,
665
+ ActionText::Attribute,
666
+ ActionText::Content,
667
+ ActionText::Fragment,
668
+ ActionText::HtmlConversion,
669
+ ActionText::PlainTextConversion,
670
+ ActionText::Serialization,
671
+ ActionText::TrixAttachment,
672
+ ]
673
+ end,
674
+ 'actionmailbox' => proc do
675
+ my_require 'action_mailbox'
676
+ my_require 'action_mailbox/engine'
677
+ [
678
+ ActionMailbox::Base,
679
+ ActionMailbox::Router,
680
+ ActionMailbox::TestCase,
681
+ ]
682
+ end,
683
+ 'actioncable' => proc do
684
+ my_require 'action_cable'
685
+ my_require 'action_cable/engine'
686
+ [
687
+ ActionCable::Server,
688
+ ActionCable::Server::Base,
689
+ ActionCable::Server::Broadcasting,
690
+ ActionCable::Server::Connections,
691
+ ActionCable::Server::Configuration,
692
+ ActionCable::Server::Worker,
693
+ ActionCable::Connection,
694
+ ActionCable::Connection::Authorization,
695
+ ActionCable::Connection::Base,
696
+ ActionCable::Connection::ClientSocket,
697
+ ActionCable::Connection::Identification,
698
+ ActionCable::Connection::InternalChannel,
699
+ ActionCable::Connection::MessageBuffer,
700
+ ActionCable::Connection::Stream,
701
+ ActionCable::Connection::StreamEventLoop,
702
+ ActionCable::Connection::Subscriptions,
703
+ ActionCable::Connection::TaggedLoggerProxy,
704
+ ActionCable::Connection::TestCase,
705
+ ActionCable::Connection::WebSocket,
706
+ ActionCable::Channel,
707
+ ActionCable::Channel::Base,
708
+ ActionCable::Channel::Broadcasting,
709
+ ActionCable::Channel::Callbacks,
710
+ ActionCable::Channel::Naming,
711
+ ActionCable::Channel::PeriodicTimers,
712
+ ActionCable::Channel::Streams,
713
+ ActionCable::Channel::TestCase,
714
+ ActionCable::RemoteConnections,
715
+ ActionCable::SubscriptionAdapter,
716
+ ActionCable::SubscriptionAdapter::Base,
717
+ ActionCable::SubscriptionAdapter::Test,
718
+ ActionCable::SubscriptionAdapter::SubscriberMap,
719
+ ActionCable::SubscriptionAdapter::ChannelPrefix,
720
+ ActionCable::TestHelper,
721
+ ActionCable::TestCase,
722
+ ]
723
+ end,
724
+ 'actionmailer' => proc do
725
+ my_require 'action_mailer'
726
+ my_require 'action_mailer/railtie'
727
+ [
728
+ ActionMailer::Base,
729
+ ActionMailer::MessageDelivery,
730
+ ]
731
+ end,
732
+ 'activejob' => proc do
733
+ my_require 'active_job'
734
+ my_require 'active_job/railtie'
735
+ [
736
+ ActiveJob::Base,
737
+ ]
738
+ end,
739
+ 'activemodel' => proc do
740
+ my_require 'active_model'
741
+ my_require 'active_model/railtie'
742
+ end,
743
+ 'activesupport' => proc do
744
+ my_require 'active_support'
745
+ [
746
+ ActiveSupport::Concern,
747
+ ActiveSupport::ActionableError,
748
+ ActiveSupport::CurrentAttributes,
749
+ ActiveSupport::Dependencies,
750
+ ActiveSupport::DescendantsTracker,
751
+ ActiveSupport::ExecutionWrapper,
752
+ ActiveSupport::Executor,
753
+ ActiveSupport::FileUpdateChecker,
754
+ ActiveSupport::EventedFileUpdateChecker,
755
+ ActiveSupport::LogSubscriber,
756
+ ActiveSupport::Notifications,
757
+ ActiveSupport::Reloader,
758
+ ActiveSupport::BacktraceCleaner,
759
+ ActiveSupport::ProxyObject,
760
+ ActiveSupport::Benchmarkable,
761
+ ActiveSupport::Cache,
762
+ ActiveSupport::Cache::FileStore,
763
+ ActiveSupport::Cache::MemoryStore,
764
+ ActiveSupport::Cache::NullStore,
765
+ ActiveSupport::Cache::Strategy::LocalCache,
766
+ ActiveSupport::Cache::Strategy::LocalCache::Middleware,
767
+ ActiveSupport::Callbacks,
768
+ ActiveSupport::Configurable,
769
+ ActiveSupport::Deprecation,
770
+ ActiveSupport::Digest,
771
+ ActiveSupport::Gzip,
772
+ ActiveSupport::Inflector,
773
+ ActiveSupport::JSON,
774
+ ActiveSupport::KeyGenerator,
775
+ ActiveSupport::MessageEncryptor,
776
+ ActiveSupport::MessageVerifier,
777
+ ActiveSupport::Multibyte,
778
+ ActiveSupport::Multibyte::Chars,
779
+ ActiveSupport::Multibyte::Unicode,
780
+ ActiveSupport::NumberHelper,
781
+ ActiveSupport::NumberHelper::NumberConverter,
782
+ ActiveSupport::NumberHelper::RoundingHelper,
783
+ ActiveSupport::NumberHelper::NumberToRoundedConverter,
784
+ ActiveSupport::NumberHelper::NumberToDelimitedConverter,
785
+ ActiveSupport::NumberHelper::NumberToHumanConverter,
786
+ ActiveSupport::NumberHelper::NumberToHumanSizeConverter,
787
+ ActiveSupport::NumberHelper::NumberToPhoneConverter,
788
+ ActiveSupport::NumberHelper::NumberToCurrencyConverter,
789
+ ActiveSupport::NumberHelper::NumberToPercentageConverter,
790
+ ActiveSupport::OptionMerger,
791
+ ActiveSupport::OrderedHash,
792
+ ActiveSupport::OrderedOptions,
793
+ ActiveSupport::StringInquirer,
794
+ ActiveSupport::TaggedLogging,
795
+ ActiveSupport::XmlMini,
796
+ ActiveSupport::ArrayInquirer,
797
+ ActiveSupport::Duration,
798
+ ActiveSupport::Duration::ISO8601Parser,
799
+ ActiveSupport::Duration::ISO8601Serializer,
800
+ ActiveSupport::TimeWithZone,
801
+ ActiveSupport::TimeZone,
802
+ ActiveSupport::Rescuable,
803
+ ActiveSupport::SafeBuffer,
804
+ ActiveSupport::TestCase,
805
+ ]
806
+ end,
807
+ 'activerecord' => proc do
808
+ my_require 'active_record'
809
+ my_require 'active_record/railtie'
810
+ [
811
+ ActiveRecord::Schema,
812
+ ActiveRecord::Migration::Current,
813
+ ]
814
+ end,
815
+ 'activestorage' => proc do
816
+ my_require 'active_storage'
817
+ my_require 'active_storage/engine'
818
+ [
819
+ ActiveStorage::Attached,
820
+ ActiveStorage::Attached::Changes::CreateOne,
821
+ ActiveStorage::Attached::Changes::CreateMany,
822
+ ActiveStorage::Attached::Changes::CreateOneOfMany,
823
+ ActiveStorage::Attached::Changes::DeleteOne,
824
+ ActiveStorage::Attached::Changes::DeleteMany,
825
+ ActiveStorage::Service,
826
+ ActiveStorage::Service::Configurator,
827
+ ActiveStorage::Previewer,
828
+ ActiveStorage::Analyzer,
829
+ ActiveStorage::Transformers::Transformer,
830
+ ActiveStorage::Transformers::ImageProcessingTransformer,
831
+ ActiveStorage::Transformers::MiniMagickTransformer,
832
+ ]
833
+ end,
834
+ 'rdoc' => proc do
835
+ my_require 'rdoc'
836
+ [
837
+ RDoc::Options,
838
+ ]
839
+ end,
840
+ 'paul_revere' => proc do
841
+ my_require 'paul_revere'
842
+ [
843
+ Announcement,
844
+ ]
845
+ end,
846
+ 'clearance' => proc do
847
+ my_require 'clearance'
848
+ [
849
+ ClearanceMailer,
850
+ ]
851
+ end,
852
+ 'webmock' => proc do
853
+ my_require 'webmock'
854
+ WebMock.singleton_class.send(:define_method, :enable!) do
855
+ puts "\nWebMock.enable! is incompatible with Sorbet. Please don't unconditionally do it on requiring this file."
856
+ end
857
+ end,
858
+ 'codecov' => proc do
859
+ my_require 'simplecov'
860
+ my_require 'codecov'
861
+ end,
862
+ 'sparql' => proc do
863
+ my_require 'sparql'
864
+ [
865
+ SPARQL::Algebra,
866
+ SPARQL::Algebra::Aggregate,
867
+ SPARQL::Algebra::Evaluatable,
868
+ SPARQL::Algebra::Expression,
869
+ SPARQL::Algebra::Operator,
870
+ SPARQL::Algebra::Query,
871
+ SPARQL::Algebra::Update,
872
+ SPARQL::Client,
873
+ SPARQL::Grammar,
874
+ SPARQL::Grammar::Parser,
875
+ SPARQL::Grammar::Terminals,
876
+ SPARQL::Results,
877
+ SPARQL::VERSION,
878
+ ]
879
+ end,
880
+ 'sparql-client' => proc do
881
+ my_require 'sparql/client'
882
+ [
883
+ SPARQL::Client::Query,
884
+ SPARQL::Client::Repository,
885
+ SPARQL::Client::Update,
886
+ SPARQL::Client::VERSION,
887
+ ]
888
+ end,
889
+ 'selenium-webdriver' => proc do
890
+ my_require 'selenium/webdriver'
891
+ [
892
+ Selenium::WebDriver::Chrome,
893
+ Selenium::WebDriver::Chrome::Bridge,
894
+ Selenium::WebDriver::Chrome::Driver,
895
+ Selenium::WebDriver::Chrome::Profile,
896
+ Selenium::WebDriver::Chrome::Options,
897
+ Selenium::WebDriver::Chrome::Service,
898
+ Selenium::WebDriver::Edge,
899
+ Selenium::WebDriver::Firefox,
900
+ Selenium::WebDriver::Firefox::Extension,
901
+ Selenium::WebDriver::Firefox::ProfilesIni,
902
+ Selenium::WebDriver::Firefox::Profile,
903
+ Selenium::WebDriver::Firefox::Driver,
904
+ Selenium::WebDriver::Firefox::Options,
905
+ Selenium::WebDriver::Firefox::Service,
906
+ Selenium::WebDriver::IE,
907
+ Selenium::WebDriver::IE::Driver,
908
+ Selenium::WebDriver::IE::Options,
909
+ Selenium::WebDriver::IE::Service,
910
+ Selenium::WebDriver::Remote,
911
+ Selenium::WebDriver::Remote::Bridge,
912
+ Selenium::WebDriver::Remote::Driver,
913
+ Selenium::WebDriver::Remote::Response,
914
+ Selenium::WebDriver::Remote::Capabilities,
915
+ Selenium::WebDriver::Remote::Http::Common,
916
+ Selenium::WebDriver::Remote::Http::Default,
917
+ Selenium::WebDriver::Safari,
918
+ Selenium::WebDriver::Safari::Bridge,
919
+ Selenium::WebDriver::Safari::Driver,
920
+ Selenium::WebDriver::Safari::Options,
921
+ Selenium::WebDriver::Safari::Service,
922
+ Selenium::WebDriver::Support,
923
+ ]
924
+ end,
925
+ 'friendly_id' => proc do
926
+ my_require 'friendly_id'
927
+ [
928
+ FriendlyId::History,
929
+ FriendlyId::Slug,
930
+ FriendlyId::SimpleI18n,
931
+ FriendlyId::Reserved,
932
+ FriendlyId::Scoped,
933
+ FriendlyId::Slugged,
934
+ FriendlyId::Finders,
935
+ FriendlyId::SequentiallySlugged
936
+ ]
937
+ end,
938
+ 'rdf' => proc do
939
+ my_require 'rdf'
940
+ my_require 'rdf/ntriples'
941
+ [
942
+ RDF::Countable,
943
+ RDF::Durable,
944
+ RDF::Enumerable,
945
+ RDF::Indexable,
946
+ RDF::Mutable,
947
+ RDF::Queryable,
948
+ RDF::Readable,
949
+ RDF::TypeCheck,
950
+ RDF::Transactable,
951
+ RDF::Writable,
952
+ RDF::Graph,
953
+ RDF::IRI,
954
+ RDF::Literal,
955
+ RDF::Node,
956
+ RDF::Resource,
957
+ RDF::Statement,
958
+ RDF::URI,
959
+ RDF::Value,
960
+ RDF::Term,
961
+ RDF::List,
962
+ RDF::Format,
963
+ RDF::Reader,
964
+ RDF::ReaderError,
965
+ RDF::Writer,
966
+ RDF::WriterError,
967
+ RDF::NTriples,
968
+ RDF::NQuads,
969
+ RDF::Changeset,
970
+ RDF::Dataset,
971
+ RDF::Repository,
972
+ RDF::Transaction,
973
+ RDF::Query,
974
+ RDF::Query::Pattern,
975
+ RDF::Query::Solution,
976
+ RDF::Query::Solutions,
977
+ RDF::Query::Variable,
978
+ RDF::Query::HashPatternNormalizer,
979
+ RDF::Vocabulary,
980
+ RDF::StrictVocabulary,
981
+ RDF::Util,
982
+ RDF::Util::Aliasing,
983
+ RDF::Util::Cache,
984
+ RDF::Util::File,
985
+ RDF::Util::Logger,
986
+ RDF::Util::UUID,
987
+ RDF::Util::Coercions,
988
+ ]
989
+ end,
990
+ 'rspec-core' => proc do
991
+ my_require 'rspec/core'
992
+ [
993
+ RSpec::SharedContext,
994
+ RSpec::Core::ExampleStatusPersister,
995
+ RSpec::Core::Profiler,
996
+ RSpec::Core::DidYouMean,
997
+ RSpec::Core::Formatters::DocumentationFormatter,
998
+ RSpec::Core::Formatters::HtmlFormatter,
999
+ RSpec::Core::Formatters::FallbackMessageFormatter,
1000
+ RSpec::Core::Formatters::ProgressFormatter,
1001
+ RSpec::Core::Formatters::ProfileFormatter,
1002
+ RSpec::Core::Formatters::JsonFormatter,
1003
+ RSpec::Core::Formatters::BisectDRbFormatter,
1004
+ RSpec::Core::Formatters::ExceptionPresenter,
1005
+ RSpec::Core::Formatters::FailureListFormatter,
1006
+ ]
1007
+ end,
1008
+ 'rspec-mocks' => proc do
1009
+ my_require 'rspec/mocks'
1010
+ [
1011
+ RSpec::Mocks::AnyInstance,
1012
+ RSpec::Mocks::ExpectChain,
1013
+ RSpec::Mocks::StubChain,
1014
+ RSpec::Mocks::MarshalExtension,
1015
+ RSpec::Mocks::Matchers::HaveReceived,
1016
+ RSpec::Mocks::Matchers::Receive,
1017
+ RSpec::Mocks::Matchers::ReceiveMessageChain,
1018
+ RSpec::Mocks::Matchers::ReceiveMessages,
1019
+ ]
1020
+ end,
1021
+ 'rspec-support' => proc do
1022
+ my_require 'rspec/support'
1023
+ [
1024
+ RSpec::Support::Differ,
1025
+ ]
1026
+ end,
1027
+ 'rspec-expectations' => proc do
1028
+ my_require 'rspec/expectations'
1029
+ [
1030
+ RSpec::Expectations::BlockSnippetExtractor,
1031
+ RSpec::Expectations::FailureAggregator,
1032
+ RSpec::Matchers::BuiltIn::BeAKindOf,
1033
+ RSpec::Matchers::BuiltIn::BeAnInstanceOf,
1034
+ RSpec::Matchers::BuiltIn::BeBetween,
1035
+ RSpec::Matchers::BuiltIn::Be,
1036
+ RSpec::Matchers::BuiltIn::BeComparedTo,
1037
+ RSpec::Matchers::BuiltIn::BeFalsey,
1038
+ RSpec::Matchers::BuiltIn::BeNil,
1039
+ RSpec::Matchers::BuiltIn::BePredicate,
1040
+ RSpec::Matchers::BuiltIn::BeTruthy,
1041
+ RSpec::Matchers::BuiltIn::BeWithin,
1042
+ RSpec::Matchers::BuiltIn::Change,
1043
+ RSpec::Matchers::BuiltIn::Compound,
1044
+ RSpec::Matchers::BuiltIn::ContainExactly,
1045
+ RSpec::Matchers::BuiltIn::Cover,
1046
+ RSpec::Matchers::BuiltIn::EndWith,
1047
+ RSpec::Matchers::BuiltIn::Eq,
1048
+ RSpec::Matchers::BuiltIn::Eql,
1049
+ RSpec::Matchers::BuiltIn::Equal,
1050
+ RSpec::Matchers::BuiltIn::Exist,
1051
+ RSpec::Matchers::BuiltIn::Has,
1052
+ RSpec::Matchers::BuiltIn::HaveAttributes,
1053
+ RSpec::Matchers::BuiltIn::Include,
1054
+ RSpec::Matchers::BuiltIn::All,
1055
+ RSpec::Matchers::BuiltIn::Match,
1056
+ RSpec::Matchers::BuiltIn::NegativeOperatorMatcher,
1057
+ RSpec::Matchers::BuiltIn::OperatorMatcher,
1058
+ RSpec::Matchers::BuiltIn::Output,
1059
+ RSpec::Matchers::BuiltIn::PositiveOperatorMatcher,
1060
+ RSpec::Matchers::BuiltIn::RaiseError,
1061
+ RSpec::Matchers::BuiltIn::RespondTo,
1062
+ RSpec::Matchers::BuiltIn::Satisfy,
1063
+ RSpec::Matchers::BuiltIn::StartWith,
1064
+ RSpec::Matchers::BuiltIn::ThrowSymbol,
1065
+ RSpec::Matchers::BuiltIn::YieldControl,
1066
+ RSpec::Matchers::BuiltIn::YieldSuccessiveArgs,
1067
+ RSpec::Matchers::BuiltIn::YieldWithArgs,
1068
+ RSpec::Matchers::BuiltIn::YieldWithNoArgs,
1069
+ ]
1070
+ end,
1071
+ 'kaminari-core' => proc do
1072
+ my_require 'kaminari/core'
1073
+ end,
1074
+ 'kaminari-activerecord' => proc do
1075
+ my_require 'kaminari/activerecord'
1076
+ end,
1077
+ 'kaminari-actionview' => proc do
1078
+ my_require 'kaminari/actionview'
1079
+ end,
1080
+ 'sxp' => proc do
1081
+ my_require 'sxp'
1082
+ [
1083
+ SXP::Pair,
1084
+ SXP::List,
1085
+ SXP::Generator,
1086
+ SXP::Reader,
1087
+ SXP::Reader::Basic,
1088
+ SXP::Reader::Extended,
1089
+ SXP::Reader::Scheme,
1090
+ SXP::Reader::CommonLisp,
1091
+ SXP::Reader::SPARQL,
1092
+ ]
1093
+ end,
1094
+ 'ebnf' => proc do
1095
+ my_require 'ebnf'
1096
+ [
1097
+ EBNF::Base,
1098
+ EBNF::BNF,
1099
+ EBNF::LL1,
1100
+ EBNF::LL1::Lexer,
1101
+ EBNF::LL1::Parser,
1102
+ EBNF::LL1::Scanner,
1103
+ EBNF::Parser,
1104
+ EBNF::Rule,
1105
+ EBNF::Writer,
1106
+ EBNF::VERSION,
1107
+ ]
1108
+ end,
1109
+ 'doorkeeper' => proc do
1110
+ my_require 'doorkeeper'
1111
+ version = Bundler.load.specs['doorkeeper'][0].stub.version
1112
+ if Gem::Requirement.create('>=5.4.0').satisfied_by?(version)
1113
+ [
1114
+ Doorkeeper::Errors,
1115
+ Doorkeeper::OAuth,
1116
+ Doorkeeper::Rake,
1117
+ Doorkeeper::Request,
1118
+ Doorkeeper::Server,
1119
+ Doorkeeper::StaleRecordsCleaner,
1120
+ Doorkeeper::Validations,
1121
+ Doorkeeper::VERSION,
1122
+ Doorkeeper::AccessGrantMixin,
1123
+ Doorkeeper::AccessTokenMixin,
1124
+ Doorkeeper::ApplicationMixin,
1125
+ Doorkeeper::Helpers::Controller,
1126
+ Doorkeeper::Request::Strategy,
1127
+ Doorkeeper::Request::AuthorizationCode,
1128
+ Doorkeeper::Request::ClientCredentials,
1129
+ Doorkeeper::Request::Code,
1130
+ Doorkeeper::Request::Password,
1131
+ Doorkeeper::Request::RefreshToken,
1132
+ Doorkeeper::Request::Token,
1133
+ Doorkeeper::OAuth::BaseRequest,
1134
+ Doorkeeper::OAuth::AuthorizationCodeRequest,
1135
+ Doorkeeper::OAuth::BaseResponse,
1136
+ Doorkeeper::OAuth::CodeResponse,
1137
+ Doorkeeper::OAuth::Client,
1138
+ Doorkeeper::OAuth::ClientCredentialsRequest,
1139
+ Doorkeeper::OAuth::CodeRequest,
1140
+ Doorkeeper::OAuth::ErrorResponse,
1141
+ Doorkeeper::OAuth::Error,
1142
+ Doorkeeper::OAuth::InvalidTokenResponse,
1143
+ Doorkeeper::OAuth::InvalidRequestResponse,
1144
+ Doorkeeper::OAuth::ForbiddenTokenResponse,
1145
+ Doorkeeper::OAuth::NonStandard,
1146
+ Doorkeeper::OAuth::PasswordAccessTokenRequest,
1147
+ Doorkeeper::OAuth::PreAuthorization,
1148
+ Doorkeeper::OAuth::RefreshTokenRequest,
1149
+ Doorkeeper::OAuth::Scopes,
1150
+ Doorkeeper::OAuth::Token,
1151
+ Doorkeeper::OAuth::TokenIntrospection,
1152
+ Doorkeeper::OAuth::TokenRequest,
1153
+ Doorkeeper::OAuth::TokenResponse,
1154
+ Doorkeeper::OAuth::Authorization::Code,
1155
+ Doorkeeper::OAuth::Authorization::Context,
1156
+ Doorkeeper::OAuth::Authorization::Token,
1157
+ Doorkeeper::OAuth::Authorization::URIBuilder,
1158
+ Doorkeeper::OAuth::Client::Credentials,
1159
+ Doorkeeper::OAuth::ClientCredentials::Validator,
1160
+ Doorkeeper::OAuth::ClientCredentials::Creator,
1161
+ Doorkeeper::OAuth::ClientCredentials::Issuer,
1162
+ Doorkeeper::OAuth::Helpers::ScopeChecker,
1163
+ Doorkeeper::OAuth::Helpers::URIChecker,
1164
+ Doorkeeper::OAuth::Helpers::UniqueToken,
1165
+ Doorkeeper::OAuth::Hooks::Context,
1166
+ Doorkeeper::Models::Accessible,
1167
+ Doorkeeper::Models::Expirable,
1168
+ Doorkeeper::Models::Orderable,
1169
+ Doorkeeper::Models::Scopes,
1170
+ Doorkeeper::Models::Reusable,
1171
+ Doorkeeper::Models::ResourceOwnerable,
1172
+ Doorkeeper::Models::Revocable,
1173
+ Doorkeeper::Models::SecretStorable,
1174
+ Doorkeeper::Orm::ActiveRecord,
1175
+ Doorkeeper::Rails::Helpers,
1176
+ Doorkeeper::Rails::Routes,
1177
+ Doorkeeper::SecretStoring::Base,
1178
+ Doorkeeper::SecretStoring::Plain,
1179
+ Doorkeeper::SecretStoring::Sha256Hash,
1180
+ Doorkeeper::SecretStoring::BCrypt,
1181
+ ]
1182
+ end
1183
+ end,
1184
+ }
1185
+
1186
+ # This is so that the autoloader doesn't treat these as manditory requires
1187
+ # before loading this file
1188
+ def self.my_require(gem)
1189
+ require gem # rubocop:disable PrisonGuard/NoDynamicRequire
1190
+ end
1191
+
1192
+ def self.require_gem(gem)
1193
+ if gem == NO_GEM
1194
+ require_all_gems
1195
+ return
1196
+ end
1197
+ loader = GEM_LOADER[gem]
1198
+ if loader
1199
+ begin
1200
+ loader.call
1201
+ rescue NameError => e
1202
+ puts "NameError: #{e}"
1203
+ end
1204
+ else
1205
+ begin
1206
+ require gem # rubocop:disable PrisonGuard/NoDynamicRequire
1207
+ rescue NameError => e
1208
+ puts "NameError: #{e}"
1209
+ end
1210
+ end
1211
+ end
1212
+
1213
+ def self.require_all_gems
1214
+ require 'bundler/setup'
1215
+ require 'bundler/lockfile_parser'
1216
+
1217
+ specs = []
1218
+ lockfile_parser = Bundler::LockfileParser.new(File.read(Bundler.default_lockfile))
1219
+ # Do not load gems in Gemfile where require is false
1220
+ dependencies = lockfile_parser.dependencies.reject { |name, dep| dep.autorequire && dep.autorequire.empty? }
1221
+ required_dependency_names = dependencies.values.map(&:name)
1222
+ lockfile_parser.specs.each do |spec|
1223
+ # Only include the spec for a gem and it's dependencies if it's autorequired.
1224
+ if required_dependency_names.include?(spec.name)
1225
+ specs << spec
1226
+ specs << spec.dependencies
1227
+ end
1228
+ end
1229
+ specs.flatten!
1230
+ specs.uniq! { |spec| spec.name }
1231
+ specs = specs.to_set
1232
+
1233
+ specs.sort_by(&:name).each do |gemspec|
1234
+ begin
1235
+ require_gem(gemspec.name)
1236
+ rescue LoadError => e
1237
+ puts "LoadError: #{e}"
1238
+ rescue NameError => e
1239
+ puts "NameError: #{e}"
1240
+ end
1241
+ end
1242
+ begin
1243
+ Bundler.require
1244
+ rescue NameError => e
1245
+ puts "NameError: #{e}"
1246
+ end
1247
+ end
1248
+ end
1249
+ # rubocop:enable PrisonGuard/AutogenLoaderPreamble