orthoses-rails 0.1.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -0
- data/examples/rails/Rakefile +373 -0
- data/examples/rails/known_sig/action_cable/connection/test_cookie_jar.rbs +2 -0
- data/examples/rails/known_sig/action_controller/metal.rbs +4 -0
- data/examples/rails/known_sig/action_dispatch/cookies/cookie_jar.rbs +3 -0
- data/examples/rails/known_sig/action_dispatch/response.rbs +4 -0
- data/examples/rails/patch/drb/drb_undumped.rbs +2 -0
- data/examples/rails/patch/drb.rbs +2 -0
- data/examples/rails/patch/erubi/engine.rbs +4 -0
- data/examples/rails/patch/erubi.rbs +2 -0
- data/examples/rails/patch/minitest/kernel.rbs +44 -0
- data/examples/rails/patch/minitest/minitest/abstract_reporter.rbs +49 -0
- data/examples/rails/patch/minitest/minitest/assertion.rbs +16 -0
- data/examples/rails/patch/minitest/minitest/assertions.rbs +545 -0
- data/examples/rails/patch/minitest/minitest/backtrace_filter.rbs +16 -0
- data/examples/rails/patch/minitest/minitest/bench_spec.rbs +101 -0
- data/examples/rails/patch/minitest/minitest/benchmark.rbs +258 -0
- data/examples/rails/patch/minitest/minitest/composite_reporter.rbs +25 -0
- data/examples/rails/patch/minitest/minitest/expectations.rbs +21 -0
- data/examples/rails/patch/minitest/minitest/guard.rbs +64 -0
- data/examples/rails/patch/minitest/minitest/mock.rbs +60 -0
- data/examples/rails/patch/minitest/minitest/parallel/executor.rbs +42 -0
- data/examples/rails/patch/minitest/minitest/parallel/test/class_methods.rbs +6 -0
- data/examples/rails/patch/minitest/minitest/parallel/test.rbs +3 -0
- data/examples/rails/patch/minitest/minitest/parallel.rbs +2 -0
- data/examples/rails/patch/minitest/minitest/pride_io.rbs +54 -0
- data/examples/rails/patch/minitest/minitest/pride_lol.rbs +17 -0
- data/examples/rails/patch/minitest/minitest/progress_reporter.rbs +11 -0
- data/examples/rails/patch/minitest/minitest/reportable.rbs +51 -0
- data/examples/rails/patch/minitest/minitest/reporter.rbs +5 -0
- data/examples/rails/patch/minitest/minitest/result.rbs +28 -0
- data/examples/rails/patch/minitest/minitest/runnable.rbs +131 -0
- data/examples/rails/patch/minitest/minitest/skip.rbs +6 -0
- data/examples/rails/patch/minitest/minitest/spec/dsl/instance_methods.rbs +48 -0
- data/examples/rails/patch/minitest/minitest/spec/dsl.rbs +125 -0
- data/examples/rails/patch/minitest/minitest/spec.rbs +10 -0
- data/examples/rails/patch/minitest/minitest/statistics_reporter.rbs +76 -0
- data/examples/rails/patch/minitest/minitest/summary_reporter.rbs +26 -0
- data/examples/rails/patch/minitest/minitest/test/lifecycle_hooks.rbs +92 -0
- data/examples/rails/patch/minitest/minitest/test.rbs +76 -0
- data/examples/rails/patch/minitest/minitest/unexpected_error.rbs +10 -0
- data/examples/rails/patch/minitest/minitest/unit/test_case.rbs +3 -0
- data/examples/rails/patch/minitest/minitest/unit.rbs +5 -0
- data/examples/rails/patch/minitest/minitest.rbs +966 -0
- data/examples/rails/patch/pg/simple_decoder.rbs +4 -0
- data/examples/rails/patch/pg.rbs +2 -0
- data/examples/rails/patch/qc/queue.rbs +2 -0
- data/examples/rails/patch/qc.rbs +2 -0
- data/examples/rails/patch/que/job.rbs +2 -0
- data/examples/rails/patch/que.rbs +2 -0
- data/examples/rails/patch/rack/cache/entity_store.rbs +2 -0
- data/examples/rails/patch/rack/cache/meta_store.rbs +2 -0
- data/examples/rails/patch/rack/cache.rbs +2 -0
- data/examples/rails/patch/rack/session/dalli.rbs +2 -0
- data/examples/rails/patch/rack/session.rbs +2 -0
- data/examples/rails/patch/rboc.rbs +2 -0
- data/examples/rails/patch/rdoc/generator/sdoc.rbs +3 -0
- data/examples/rails/patch/rdoc/generator.rbs +2 -0
- data/examples/rails/patch/rdoc/task.rbs +2 -0
- data/examples/rails/patch/ripper.rbs +2 -0
- data/examples/rails/patch/sidekiq/worker.rbs +2 -0
- data/examples/rails/patch/sidekiq.rbs +2 -0
- data/examples/rails/patch/sneakers/worker.rbs +2 -0
- data/examples/rails/patch/sneakers.rbs +2 -0
- data/examples/rails/patch/sucker_punch/job.rbs +2 -0
- data/examples/rails/patch/sucker_punch.rbs +2 -0
- data/examples/rails/patch/thor/actions/create_file.rbs +2 -0
- data/examples/rails/patch/thor/actions.rbs +2 -0
- data/examples/rails/patch/thor/error.rbs +2 -0
- data/examples/rails/patch/thor/group.rbs +2 -0
- data/examples/rails/patch/thor.rbs +2 -0
- data/lib/orthoses/active_model/has_secure_password.rb +24 -13
- data/lib/orthoses/active_model/known_sig/7.0/serialization.rbs +4 -0
- data/lib/orthoses/active_model/known_sig/7.0/validations.rbs +4 -0
- data/lib/orthoses/active_model/known_sig.rb +21 -0
- data/lib/orthoses/active_model.rb +4 -0
- data/lib/orthoses/active_record/belongs_to.rb +10 -4
- data/lib/orthoses/active_record/generated_attribute_methods.rb +6 -4
- data/lib/orthoses/active_record/has_many.rb +6 -6
- data/lib/orthoses/active_record/has_one.rb +5 -4
- data/lib/orthoses/active_record/known_sig/6.0/result.rbs +5 -0
- data/lib/orthoses/active_record/known_sig/6.1/result.rbs +5 -0
- data/lib/orthoses/active_record/known_sig/7.0/encryption/context.rbs +9 -0
- data/lib/orthoses/active_record/known_sig/7.0/result.rbs +5 -0
- data/lib/orthoses/active_record/known_sig.rb +21 -0
- data/lib/orthoses/active_record/query_methods.rb +32 -0
- data/lib/orthoses/active_record.rb +8 -0
- data/lib/orthoses/active_support/class_attribute.rb +30 -17
- data/lib/orthoses/active_support/configurable.rb +36 -0
- data/lib/orthoses/active_support/delegation.rb +158 -0
- data/lib/orthoses/active_support/known_sig/7.0/active_support/callbacks/callback_chain.rbs +9 -0
- data/lib/orthoses/active_support/known_sig/7.0/active_support/hash_with_indifferent_access.rbs +6 -0
- data/lib/orthoses/active_support/known_sig/7.0/active_support/multibyte/chars.rbs +7 -0
- data/lib/orthoses/active_support/known_sig/7.0/hash_with_indifferent_access.rbs +2 -0
- data/lib/orthoses/active_support/known_sig/{time.rbs → 7.0/time.rbs} +4 -0
- data/lib/orthoses/active_support/known_sig.rb +21 -0
- data/lib/orthoses/active_support/mattr_accessor.rb +21 -14
- data/lib/orthoses/active_support/time_with_zone.rb +13 -15
- data/lib/orthoses/active_support.rb +24 -0
- data/lib/orthoses/rails/known_sig_helper.rb +22 -0
- data/lib/orthoses/rails/version.rb +1 -1
- data/lib/orthoses/rails.rb +4 -11
- data/orthoses-rails.gemspec +2 -2
- metadata +97 -9
- data/lib/orthoses/active_support/concern.rb +0 -22
- data/lib/orthoses/active_support/known_sig/active_support/time_with_zone.rbs +0 -4
@@ -0,0 +1,158 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Orthoses
|
4
|
+
module ActiveSupport
|
5
|
+
class Delegation
|
6
|
+
def initialize(loader)
|
7
|
+
@loader = loader
|
8
|
+
end
|
9
|
+
|
10
|
+
# def delegate(*methods, to: nil, prefix: nil, allow_nil: nil, private: nil)
|
11
|
+
# def delegate_missing_to(target, allow_nil: nil)
|
12
|
+
def call
|
13
|
+
target_method = begin
|
14
|
+
::Module.method(:delegate)
|
15
|
+
rescue NameError => err
|
16
|
+
Orthoses.logger.warn("Run `require 'active_support/core_ext/module/delegation'` and retry because #{err}")
|
17
|
+
require 'active_support/core_ext/module/delegation'
|
18
|
+
retry
|
19
|
+
end
|
20
|
+
delegate = CallTracer.new
|
21
|
+
store = delegate.trace(target_method) do
|
22
|
+
@loader.call
|
23
|
+
end
|
24
|
+
|
25
|
+
resource = Resource.new(store)
|
26
|
+
|
27
|
+
delegate.captures.each do |capture|
|
28
|
+
receiver_name = Utils.module_name(capture.method.receiver) or next
|
29
|
+
receiver_content = store[receiver_name]
|
30
|
+
case capture.argument[:to]
|
31
|
+
when Module
|
32
|
+
to_module_name = Utils.module_name(capture.argument[:to]) or next
|
33
|
+
capture.argument[:methods].each do |arg|
|
34
|
+
if sig = resource.build_signature(to_module_name, arg, :singleton, false)
|
35
|
+
receiver_content << "# defined by `delegate` to: #{to_module_name}"
|
36
|
+
receiver_content << sig
|
37
|
+
else
|
38
|
+
Orthoses.logger.warn("[ActiveSupport::Delegation] Ignore #{arg.inspect}")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
to_name = capture.argument[:to].to_s.to_sym
|
43
|
+
tag, to_return_type = resource.find(receiver_name, to_name, :instance, false)
|
44
|
+
raise "bug" if tag == :multi
|
45
|
+
if to_return_type.nil?
|
46
|
+
Orthoses.logger.warn("[ActiveSupport::Delegation] Ignore #{capture.argument.inspect}")
|
47
|
+
next
|
48
|
+
end
|
49
|
+
if to_return_type.instance_of?(RBS::Types::Bases::Any)
|
50
|
+
capture.argument[:methods].each do |method|
|
51
|
+
receiver_content << "# defined by `delegate` to: :#{to_name}(#{to_return_type})"
|
52
|
+
receiver_content << "def #{method}: (*untyped, **untyped) -> untyped"
|
53
|
+
end
|
54
|
+
else
|
55
|
+
to_typename = to_return_type.name.relative!.to_s
|
56
|
+
capture.argument[:methods].each do |method|
|
57
|
+
if sig = resource.build_signature(to_typename, method, :instance, true)
|
58
|
+
receiver_content << "# defined by `delegate` to: :#{to_name}(#{to_return_type})"
|
59
|
+
receiver_content << sig
|
60
|
+
else
|
61
|
+
Orthoses.logger.warn("[ActiveSupport::Delegation] Ignore #{method.inspect}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
store
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
class Resource
|
74
|
+
def initialize(store)
|
75
|
+
@store = store
|
76
|
+
env = Orthoses::Utils.rbs_environment(collection: true)
|
77
|
+
@definition_builder = RBS::DefinitionBuilder.new(env: env)
|
78
|
+
end
|
79
|
+
|
80
|
+
def find(mod_name, name, kind, argument)
|
81
|
+
typename = TypeName(mod_name).absolute!
|
82
|
+
|
83
|
+
if definition_method = build_definition(typename, kind)&.methods&.[](name)
|
84
|
+
return [:multi, definition_method.defs.map(&:type)]
|
85
|
+
end
|
86
|
+
resolve_type_by_name(@store[mod_name].to_decl.members, name, kind, argument)
|
87
|
+
end
|
88
|
+
|
89
|
+
def build_definition(typename, kind)
|
90
|
+
case kind
|
91
|
+
when :instance
|
92
|
+
@definition_builder.build_instance(typename)
|
93
|
+
when :singleton
|
94
|
+
@definition_builder.build_singleton(typename)
|
95
|
+
else
|
96
|
+
raise "big"
|
97
|
+
end
|
98
|
+
rescue RuntimeError => e
|
99
|
+
if e.message.match?(/\AUnknown name for/)
|
100
|
+
nil
|
101
|
+
else
|
102
|
+
raise
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def build_signature(mod_name, name, kind, argument)
|
107
|
+
tag, type = find(mod_name, name, kind, argument)
|
108
|
+
case tag
|
109
|
+
when :single
|
110
|
+
"def #{name}: () -> #{type}"
|
111
|
+
when :multi
|
112
|
+
"def #{name}: #{type.join(' | ')}"
|
113
|
+
else
|
114
|
+
nil
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def resolve_type_by_name(members, name, kind, argument)
|
121
|
+
members.each do |member|
|
122
|
+
case member
|
123
|
+
when RBS::AST::Members::MethodDefinition
|
124
|
+
next unless member.name == name && member.kind == kind
|
125
|
+
if argument
|
126
|
+
return [:multi, member.types]
|
127
|
+
else
|
128
|
+
type = member.types.find do |method_type|
|
129
|
+
method_type.type.required_positionals.empty? && method_type.type.required_keywords.empty?
|
130
|
+
end
|
131
|
+
next unless type
|
132
|
+
return [:single, type.type.return_type]
|
133
|
+
end
|
134
|
+
when RBS::AST::Members::Var
|
135
|
+
next unless member.name == name
|
136
|
+
return [:single, member.type]
|
137
|
+
when RBS::AST::Declarations::Constant
|
138
|
+
next unless member.name.to_s.to_sym == name
|
139
|
+
return [:single, member.type]
|
140
|
+
when RBS::AST::Members::Attribute
|
141
|
+
next unless member.name == name && member.kind == kind
|
142
|
+
return [:single, member.type]
|
143
|
+
when RBS::AST::Members::Alias
|
144
|
+
next unless member.new_name == name && member.kind == kind
|
145
|
+
return resolve_type_by_name(members, member.old_name, kind, argument)
|
146
|
+
when RBS::AST::Members::Mixin, RBS::AST::Members::LocationOnly
|
147
|
+
next
|
148
|
+
else
|
149
|
+
binding.irb
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
nil
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module ActiveSupport
|
2
|
+
module Callbacks
|
3
|
+
class CallbackChain
|
4
|
+
include Enumerable[::ActiveSupport::Callbacks::Callback]
|
5
|
+
def each: () -> Enumerator[::ActiveSupport::Callbacks::Callback, Array[::ActiveSupport::Callbacks::Callback]]
|
6
|
+
| () { (::ActiveSupport::Callbacks::Callback) -> void } -> Array[::ActiveSupport::Callbacks::Callback]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Orthoses
|
4
|
+
module ActiveSupport
|
5
|
+
class KnownSig
|
6
|
+
include Orthoses::Rails::KnownSigHelper
|
7
|
+
|
8
|
+
def initialize(loader)
|
9
|
+
@loader = loader
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
@loader.call.tap do |store|
|
14
|
+
paths = best_version_paths(::ActiveSupport::VERSION::STRING, __dir__)
|
15
|
+
env = Content::Environment.load_from_paths(paths)
|
16
|
+
env.write_to(store: store)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,46 +16,53 @@ module Orthoses
|
|
16
16
|
mattr_reader = Orthoses::CallTracer.new
|
17
17
|
mattr_writer = Orthoses::CallTracer.new
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
mattr_writer.trace(::Module.instance_method(:mattr_writer)) do
|
19
|
+
store = mattr_reader.trace(target_method(:mattr_reader)) do
|
20
|
+
mattr_writer.trace(target_method(:mattr_writer)) do
|
22
21
|
@loader.call
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
mattr_reader.
|
27
|
-
base = method.receiver
|
25
|
+
mattr_reader.captures.each do |capture|
|
26
|
+
base = Orthoses::Utils.module_name(capture.method.receiver) || next
|
28
27
|
methods = []
|
29
|
-
argument[:syms].each do |sym|
|
28
|
+
capture.argument[:syms].each do |sym|
|
30
29
|
next unless @if.nil? || @if.call(method, sym)
|
31
30
|
|
32
31
|
methods << "def self.#{sym}: () -> untyped"
|
33
|
-
if argument[:instance_reader] && argument[:instance_accessor]
|
32
|
+
if capture.argument[:instance_reader] && capture.argument[:instance_accessor]
|
34
33
|
methods << "def #{sym}: () -> untyped"
|
35
34
|
end
|
36
35
|
end
|
37
36
|
next if methods.empty?
|
38
37
|
|
39
|
-
|
38
|
+
store[base].concat(methods)
|
40
39
|
end
|
41
40
|
|
42
|
-
mattr_writer.
|
43
|
-
base = method.receiver
|
41
|
+
mattr_writer.captures.each do |capture|
|
42
|
+
base = Orthoses::Utils.module_name(capture.method.receiver) || next
|
44
43
|
methods = []
|
45
|
-
argument[:syms].each do |sym|
|
44
|
+
capture.argument[:syms].each do |sym|
|
46
45
|
next unless @if.nil? || @if.call(method, sym)
|
47
46
|
|
48
47
|
methods << "def self.#{sym}=: (untyped val) -> untyped"
|
49
|
-
if argument[:instance_writer] && argument[:instance_accessor]
|
48
|
+
if capture.argument[:instance_writer] && capture.argument[:instance_accessor]
|
50
49
|
methods << "def #{sym}=: (untyped val) -> untyped"
|
51
50
|
end
|
52
51
|
end
|
53
52
|
next if methods.empty?
|
54
53
|
|
55
|
-
|
54
|
+
store[base].concat(methods)
|
56
55
|
end
|
57
56
|
|
58
|
-
|
57
|
+
store
|
58
|
+
end
|
59
|
+
|
60
|
+
def target_method(name)
|
61
|
+
::Module.instance_method(name)
|
62
|
+
rescue NameError => err
|
63
|
+
Orthoses.logger.warn("Run `require 'active_support/core_ext/module/attribute_accessors'` and retry because #{err}")
|
64
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
65
|
+
retry
|
59
66
|
end
|
60
67
|
end
|
61
68
|
end
|
@@ -7,18 +7,13 @@ module Orthoses
|
|
7
7
|
@loader = loader
|
8
8
|
end
|
9
9
|
|
10
|
-
LOAD_PATHS = [
|
11
|
-
File.expand_path("known_sig/time.rbs", __dir__),
|
12
|
-
File.expand_path("known_sig/active_support/time_with_zone.rbs", __dir__),
|
13
|
-
]
|
14
|
-
|
15
10
|
# Time <= (known Time)
|
16
11
|
# TimeWithZone <= (known TimeWithZone, known Time, core Time)
|
17
12
|
def call
|
18
|
-
store =
|
13
|
+
store = @loader.call
|
19
14
|
|
20
15
|
time_with_zone_store = store["ActiveSupport::TimeWithZone"]
|
21
|
-
each_line_from_core_time_definition do |line|
|
16
|
+
each_line_from_core_time_definition(store) do |line|
|
22
17
|
time_with_zone_store << line
|
23
18
|
end
|
24
19
|
|
@@ -35,15 +30,18 @@ module Orthoses
|
|
35
30
|
localtime
|
36
31
|
]
|
37
32
|
|
38
|
-
def each_line_from_core_time_definition
|
33
|
+
def each_line_from_core_time_definition(store)
|
39
34
|
type_name_time = TypeName("::Time")
|
40
|
-
|
41
|
-
env
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
35
|
+
env = Utils.rbs_environment(collection: true, cache: false)
|
36
|
+
env << store["Time"].to_decl
|
37
|
+
env << store["DateAndTime"].to_decl
|
38
|
+
env << store["DateAndTime::Zones"].to_decl
|
39
|
+
env << store["DateAndTime::Calculations"].to_decl
|
40
|
+
env << store["DateAndTime::Compatibility"].to_decl
|
41
|
+
env << store["ActiveSupport"].to_decl
|
42
|
+
env << store["ActiveSupport::TimeZone"].to_decl
|
43
|
+
env << store["ActiveSupport::Duration"].to_decl
|
44
|
+
env << store["ActiveSupport::TimeWithZone"].to_decl
|
47
45
|
|
48
46
|
builder = RBS::DefinitionBuilder.new(env: env.resolve_type_names)
|
49
47
|
one_ancestors = builder.ancestor_builder.one_instance_ancestors(type_name_time)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'active_support/class_attribute'
|
4
|
+
require_relative 'active_support/configurable'
|
5
|
+
require_relative 'active_support/delegation'
|
6
|
+
require_relative 'active_support/mattr_accessor'
|
7
|
+
require_relative 'active_support/time_with_zone'
|
8
|
+
require_relative 'active_support/known_sig'
|
9
|
+
|
10
|
+
module Orthoses
|
11
|
+
module ActiveSupport
|
12
|
+
# Interface for adding middleware in bulk.
|
13
|
+
# Orthoses::ActiveSupport.each do |middleware, **args|
|
14
|
+
# use middleware, **args
|
15
|
+
# end
|
16
|
+
def self.each
|
17
|
+
yield ClassAttribute
|
18
|
+
yield Delegation
|
19
|
+
yield MattrAccessor
|
20
|
+
yield TimeWithZone
|
21
|
+
yield KnownSig
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Orthoses
|
4
|
+
module Rails
|
5
|
+
module KnownSigHelper
|
6
|
+
def best_version_paths(current, base_dir)
|
7
|
+
best_version = find_best_version(current, base_dir)
|
8
|
+
Dir.glob("#{File.expand_path("known_sig", base_dir)}/#{best_version}/**/*.rbs")
|
9
|
+
end
|
10
|
+
|
11
|
+
def find_best_version(current, base_dir)
|
12
|
+
current_v = Gem::Version.new(current)
|
13
|
+
versions = version_dir(base_dir)
|
14
|
+
versions.reverse.bsearch { |v| v <= current_v } || versions.first
|
15
|
+
end
|
16
|
+
|
17
|
+
def version_dir(base_dir)
|
18
|
+
Dir.glob("#{File.expand_path("known_sig", base_dir)}/*").map(&File.method(:basename)).sort
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/orthoses/rails.rb
CHANGED
@@ -3,15 +3,8 @@
|
|
3
3
|
require 'orthoses'
|
4
4
|
|
5
5
|
require_relative "rails/version"
|
6
|
+
require_relative "rails/known_sig_helper"
|
6
7
|
|
7
|
-
require_relative 'active_model
|
8
|
-
|
9
|
-
require_relative '
|
10
|
-
require_relative 'active_record/has_many'
|
11
|
-
require_relative 'active_record/has_one'
|
12
|
-
require_relative 'active_record/belongs_to'
|
13
|
-
|
14
|
-
require_relative 'active_support/class_attribute'
|
15
|
-
require_relative 'active_support/concern'
|
16
|
-
require_relative 'active_support/mattr_accessor'
|
17
|
-
require_relative 'active_support/time_with_zone'
|
8
|
+
require_relative 'active_model'
|
9
|
+
require_relative 'active_record'
|
10
|
+
require_relative 'active_support'
|
data/orthoses-rails.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["ksss"]
|
9
9
|
spec.email = ["co000ri@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "Orthoses
|
11
|
+
spec.summary = "Orthoses middleware collection for Ruby on Rails"
|
12
12
|
spec.description = "Orthoses middleware collection for Ruby on Rails"
|
13
13
|
spec.homepage = "https://github.com/ksss/orthoses-rails"
|
14
14
|
spec.license = "MIT"
|
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
spec.add_dependency "orthoses"
|
35
|
+
spec.add_dependency "orthoses", ">= 0.8"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthoses-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: orthoses
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.8'
|
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: '0'
|
26
|
+
version: '0.8'
|
27
27
|
description: Orthoses middleware collection for Ruby on Rails
|
28
28
|
email:
|
29
29
|
- co000ri@gmail.com
|
@@ -34,19 +34,107 @@ files:
|
|
34
34
|
- CODE_OF_CONDUCT.md
|
35
35
|
- LICENSE.txt
|
36
36
|
- README.md
|
37
|
+
- examples/rails/Rakefile
|
38
|
+
- examples/rails/known_sig/action_cable/connection/test_cookie_jar.rbs
|
39
|
+
- examples/rails/known_sig/action_controller/metal.rbs
|
40
|
+
- examples/rails/known_sig/action_dispatch/cookies/cookie_jar.rbs
|
41
|
+
- examples/rails/known_sig/action_dispatch/response.rbs
|
42
|
+
- examples/rails/patch/drb.rbs
|
43
|
+
- examples/rails/patch/drb/drb_undumped.rbs
|
44
|
+
- examples/rails/patch/erubi.rbs
|
45
|
+
- examples/rails/patch/erubi/engine.rbs
|
46
|
+
- examples/rails/patch/minitest/kernel.rbs
|
47
|
+
- examples/rails/patch/minitest/minitest.rbs
|
48
|
+
- examples/rails/patch/minitest/minitest/abstract_reporter.rbs
|
49
|
+
- examples/rails/patch/minitest/minitest/assertion.rbs
|
50
|
+
- examples/rails/patch/minitest/minitest/assertions.rbs
|
51
|
+
- examples/rails/patch/minitest/minitest/backtrace_filter.rbs
|
52
|
+
- examples/rails/patch/minitest/minitest/bench_spec.rbs
|
53
|
+
- examples/rails/patch/minitest/minitest/benchmark.rbs
|
54
|
+
- examples/rails/patch/minitest/minitest/composite_reporter.rbs
|
55
|
+
- examples/rails/patch/minitest/minitest/expectations.rbs
|
56
|
+
- examples/rails/patch/minitest/minitest/guard.rbs
|
57
|
+
- examples/rails/patch/minitest/minitest/mock.rbs
|
58
|
+
- examples/rails/patch/minitest/minitest/parallel.rbs
|
59
|
+
- examples/rails/patch/minitest/minitest/parallel/executor.rbs
|
60
|
+
- examples/rails/patch/minitest/minitest/parallel/test.rbs
|
61
|
+
- examples/rails/patch/minitest/minitest/parallel/test/class_methods.rbs
|
62
|
+
- examples/rails/patch/minitest/minitest/pride_io.rbs
|
63
|
+
- examples/rails/patch/minitest/minitest/pride_lol.rbs
|
64
|
+
- examples/rails/patch/minitest/minitest/progress_reporter.rbs
|
65
|
+
- examples/rails/patch/minitest/minitest/reportable.rbs
|
66
|
+
- examples/rails/patch/minitest/minitest/reporter.rbs
|
67
|
+
- examples/rails/patch/minitest/minitest/result.rbs
|
68
|
+
- examples/rails/patch/minitest/minitest/runnable.rbs
|
69
|
+
- examples/rails/patch/minitest/minitest/skip.rbs
|
70
|
+
- examples/rails/patch/minitest/minitest/spec.rbs
|
71
|
+
- examples/rails/patch/minitest/minitest/spec/dsl.rbs
|
72
|
+
- examples/rails/patch/minitest/minitest/spec/dsl/instance_methods.rbs
|
73
|
+
- examples/rails/patch/minitest/minitest/statistics_reporter.rbs
|
74
|
+
- examples/rails/patch/minitest/minitest/summary_reporter.rbs
|
75
|
+
- examples/rails/patch/minitest/minitest/test.rbs
|
76
|
+
- examples/rails/patch/minitest/minitest/test/lifecycle_hooks.rbs
|
77
|
+
- examples/rails/patch/minitest/minitest/unexpected_error.rbs
|
78
|
+
- examples/rails/patch/minitest/minitest/unit.rbs
|
79
|
+
- examples/rails/patch/minitest/minitest/unit/test_case.rbs
|
80
|
+
- examples/rails/patch/pg.rbs
|
81
|
+
- examples/rails/patch/pg/simple_decoder.rbs
|
82
|
+
- examples/rails/patch/qc.rbs
|
83
|
+
- examples/rails/patch/qc/queue.rbs
|
84
|
+
- examples/rails/patch/que.rbs
|
85
|
+
- examples/rails/patch/que/job.rbs
|
86
|
+
- examples/rails/patch/rack/cache.rbs
|
87
|
+
- examples/rails/patch/rack/cache/entity_store.rbs
|
88
|
+
- examples/rails/patch/rack/cache/meta_store.rbs
|
89
|
+
- examples/rails/patch/rack/session.rbs
|
90
|
+
- examples/rails/patch/rack/session/dalli.rbs
|
91
|
+
- examples/rails/patch/rboc.rbs
|
92
|
+
- examples/rails/patch/rdoc/generator.rbs
|
93
|
+
- examples/rails/patch/rdoc/generator/sdoc.rbs
|
94
|
+
- examples/rails/patch/rdoc/task.rbs
|
95
|
+
- examples/rails/patch/ripper.rbs
|
96
|
+
- examples/rails/patch/sidekiq.rbs
|
97
|
+
- examples/rails/patch/sidekiq/worker.rbs
|
98
|
+
- examples/rails/patch/sneakers.rbs
|
99
|
+
- examples/rails/patch/sneakers/worker.rbs
|
100
|
+
- examples/rails/patch/sucker_punch.rbs
|
101
|
+
- examples/rails/patch/sucker_punch/job.rbs
|
102
|
+
- examples/rails/patch/thor.rbs
|
103
|
+
- examples/rails/patch/thor/actions.rbs
|
104
|
+
- examples/rails/patch/thor/actions/create_file.rbs
|
105
|
+
- examples/rails/patch/thor/error.rbs
|
106
|
+
- examples/rails/patch/thor/group.rbs
|
37
107
|
- lib/orthoses-rails.rb
|
108
|
+
- lib/orthoses/active_model.rb
|
38
109
|
- lib/orthoses/active_model/has_secure_password.rb
|
110
|
+
- lib/orthoses/active_model/known_sig.rb
|
111
|
+
- lib/orthoses/active_model/known_sig/7.0/serialization.rbs
|
112
|
+
- lib/orthoses/active_model/known_sig/7.0/validations.rbs
|
113
|
+
- lib/orthoses/active_record.rb
|
39
114
|
- lib/orthoses/active_record/belongs_to.rb
|
40
115
|
- lib/orthoses/active_record/generated_attribute_methods.rb
|
41
116
|
- lib/orthoses/active_record/has_many.rb
|
42
117
|
- lib/orthoses/active_record/has_one.rb
|
118
|
+
- lib/orthoses/active_record/known_sig.rb
|
119
|
+
- lib/orthoses/active_record/known_sig/6.0/result.rbs
|
120
|
+
- lib/orthoses/active_record/known_sig/6.1/result.rbs
|
121
|
+
- lib/orthoses/active_record/known_sig/7.0/encryption/context.rbs
|
122
|
+
- lib/orthoses/active_record/known_sig/7.0/result.rbs
|
123
|
+
- lib/orthoses/active_record/query_methods.rb
|
124
|
+
- lib/orthoses/active_support.rb
|
43
125
|
- lib/orthoses/active_support/class_attribute.rb
|
44
|
-
- lib/orthoses/active_support/
|
45
|
-
- lib/orthoses/active_support/
|
46
|
-
- lib/orthoses/active_support/known_sig
|
126
|
+
- lib/orthoses/active_support/configurable.rb
|
127
|
+
- lib/orthoses/active_support/delegation.rb
|
128
|
+
- lib/orthoses/active_support/known_sig.rb
|
129
|
+
- lib/orthoses/active_support/known_sig/7.0/active_support/callbacks/callback_chain.rbs
|
130
|
+
- lib/orthoses/active_support/known_sig/7.0/active_support/hash_with_indifferent_access.rbs
|
131
|
+
- lib/orthoses/active_support/known_sig/7.0/active_support/multibyte/chars.rbs
|
132
|
+
- lib/orthoses/active_support/known_sig/7.0/hash_with_indifferent_access.rbs
|
133
|
+
- lib/orthoses/active_support/known_sig/7.0/time.rbs
|
47
134
|
- lib/orthoses/active_support/mattr_accessor.rb
|
48
135
|
- lib/orthoses/active_support/time_with_zone.rb
|
49
136
|
- lib/orthoses/rails.rb
|
137
|
+
- lib/orthoses/rails/known_sig_helper.rb
|
50
138
|
- lib/orthoses/rails/version.rb
|
51
139
|
- orthoses-rails.gemspec
|
52
140
|
- sig/orthoses/rails.rbs
|
@@ -72,8 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
160
|
- !ruby/object:Gem::Version
|
73
161
|
version: '0'
|
74
162
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
163
|
+
rubygems_version: 3.3.7
|
76
164
|
signing_key:
|
77
165
|
specification_version: 4
|
78
|
-
summary: Orthoses
|
166
|
+
summary: Orthoses middleware collection for Ruby on Rails
|
79
167
|
test_files: []
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Orthoses
|
4
|
-
module ActiveSupport
|
5
|
-
class Concern
|
6
|
-
def initialize(loader)
|
7
|
-
@loader = loader
|
8
|
-
end
|
9
|
-
|
10
|
-
def call
|
11
|
-
extended = CallTracer.new
|
12
|
-
result = extended.trace(::ActiveSupport::Concern.method(:extended)) do
|
13
|
-
@loader.call
|
14
|
-
end
|
15
|
-
extended.result.each do |method, argument|
|
16
|
-
result[argument[:base].to_s] << "extend ActiveSupport::Concern"
|
17
|
-
end
|
18
|
-
result
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|