orthoses-rails 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/examples/rails/{gemfiles/Gemfile_6_0 → Gemfile} +4 -4
  3. data/examples/rails/{gemfiles/Gemfile_7_0.lock → Gemfile.lock} +80 -74
  4. data/examples/rails/Rakefile +53 -39
  5. data/examples/rails/known_sig/actionpack/7.0/action_controller/metal.rbs +4 -0
  6. data/examples/rails/known_sig/activemodel/7.0/active_model/serialization.rbs +4 -0
  7. data/examples/rails/known_sig/activemodel/7.0/active_model/validations.rbs +4 -0
  8. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation.rbs +49 -0
  9. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation_class_methods.rbs +45 -0
  10. data/examples/rails/known_sig/activerecord/6.0/active_record/result.rbs +5 -0
  11. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation.rbs +49 -0
  12. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation_class_methods.rbs +45 -0
  13. data/examples/rails/known_sig/activerecord/6.1/active_record/result.rbs +5 -0
  14. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation.rbs +49 -0
  15. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation_class_methods.rbs +45 -0
  16. data/examples/rails/known_sig/activerecord/7.0/active_record/encryption/context.rbs +9 -0
  17. data/examples/rails/known_sig/activerecord/7.0/active_record/result.rbs +5 -0
  18. data/examples/rails/known_sig/activesupport/7.0/active_support/callbacks/callback_chain.rbs +9 -0
  19. data/examples/rails/known_sig/activesupport/7.0/active_support/duration.rbs +4 -0
  20. data/examples/rails/known_sig/activesupport/7.0/active_support/hash_with_indifferent_access.rbs +6 -0
  21. data/examples/rails/known_sig/activesupport/7.0/active_support/multibyte/chars.rbs +7 -0
  22. data/examples/rails/known_sig/activesupport/7.0/active_support/time_with_zone.rbs +5 -0
  23. data/examples/rails/known_sig/activesupport/7.0/active_support/time_zone.rbs +3 -0
  24. data/examples/rails/known_sig/activesupport/7.0/date.rbs +6 -0
  25. data/examples/rails/known_sig/activesupport/7.0/date_and_time/zones.rbs +4 -0
  26. data/examples/rails/known_sig/activesupport/7.0/hash_with_indifferent_access.rbs +2 -0
  27. data/examples/rails/known_sig/activesupport/7.0/integer.rbs +9 -0
  28. data/examples/rails/known_sig/activesupport/7.0/numeric.rbs +15 -0
  29. data/examples/rails/known_sig/activesupport/7.0/string.rbs +4 -0
  30. data/examples/rails/known_sig/activesupport/7.0/time.rbs +76 -0
  31. data/examples/rails/tasks/action_pack.rake +141 -0
  32. data/examples/rails/tasks/action_view.rake +77 -0
  33. data/examples/rails/tasks/active_job.rake +5 -1
  34. data/examples/rails/tasks/active_model.rake +1 -1
  35. data/examples/rails/tasks/active_record.rake +7 -2
  36. data/examples/rails/tasks/active_storage.rake +1 -1
  37. data/examples/rails/tasks/active_support.rake +7 -0
  38. data/examples/rails/tasks/railties.rake +37 -0
  39. data/lib/orthoses/active_model/has_secure_password.rb +2 -10
  40. data/lib/orthoses/active_record/delegated_type.rb +2 -8
  41. data/lib/orthoses/active_record/enum.rb +2 -2
  42. data/lib/orthoses/active_record/generated_attribute_methods.rb +1 -0
  43. data/lib/orthoses/active_record/scope.rb +2 -2
  44. data/lib/orthoses/active_support/class_attribute.rb +3 -10
  45. data/lib/orthoses/active_support/configurable.rb +3 -2
  46. data/lib/orthoses/active_support/delegation.rb +6 -14
  47. data/lib/orthoses/active_support/mattr_accessor.rb +4 -12
  48. data/lib/orthoses/active_support.rb +0 -15
  49. data/lib/orthoses/rails/version.rb +1 -1
  50. data/lib/orthoses/rails.rb +1 -0
  51. data/lib/orthoses/railties/mixin.rb +107 -0
  52. data/lib/orthoses/railties.rb +3 -0
  53. data/orthoses-rails.gemspec +1 -1
  54. metadata +38 -11
  55. data/examples/rails/gemfiles/Gemfile_6_0.lock +0 -172
  56. data/examples/rails/gemfiles/Gemfile_6_1 +0 -15
  57. data/examples/rails/gemfiles/Gemfile_6_1.lock +0 -173
  58. data/examples/rails/gemfiles/Gemfile_7_0 +0 -15
@@ -0,0 +1,49 @@
1
+ interface _ActiveRecord_Relation[Model, PrimaryKey]
2
+ def all: () -> self
3
+ def ids: () -> Array[PrimaryKey]
4
+ def none: () -> self
5
+ def pluck: (Symbol | String column) -> Array[untyped]
6
+ | (*Symbol | String columns) -> Array[Array[untyped]]
7
+ def where: (*untyped) -> self
8
+ def not: (*untyped) -> self
9
+ def exists?: (*untyped) -> bool
10
+ def order: (*untyped) -> self
11
+ def group: (*Symbol | String) -> untyped
12
+ def distinct: () -> self
13
+ def or: (self) -> self
14
+ def merge: (self) -> self
15
+ def joins: (*String | Symbol) -> self
16
+ | (Hash[untyped, untyped]) -> self
17
+ def left_joins: (*String | Symbol) -> self
18
+ | (Hash[untyped, untyped]) -> self
19
+ def left_outer_joins: (*String | Symbol) -> self
20
+ | (Hash[untyped, untyped]) -> self
21
+ def includes: (*String | Symbol) -> self
22
+ | (Hash[untyped, untyped]) -> self
23
+ def eager_load: (*String | Symbol) -> self
24
+ | (Hash[untyped, untyped]) -> self
25
+ def preload: (*String | Symbol) -> self
26
+ | (Hash[untyped, untyped]) -> self
27
+ def find_by: (*untyped) -> Model?
28
+ def find_by!: (*untyped) -> Model
29
+ def find: (PrimaryKey id) -> Model
30
+ | (Array[PrimaryKey]) -> Array[Model]
31
+ | (*PrimaryKey) -> Array[Model]
32
+ | () { (Model) -> boolish } -> Model?
33
+ def first: () -> Model?
34
+ | (Integer count) -> Array[Model]
35
+ def first!: () -> Model
36
+ def last: () -> Model?
37
+ | (Integer count) -> Array[Model]
38
+ def last!: () -> Model
39
+ def limit: (Integer | Arel::Nodes::SqlLiteral | nil) -> self
40
+ def limit!: (Integer | Arel::Nodes::SqlLiteral | nil) -> self
41
+ def find_each: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (Model) -> void } -> nil
42
+ def find_in_batches: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (self) -> void } -> nil
43
+ def destroy_all: () -> untyped
44
+ def delete_all: () -> untyped
45
+ def update_all: (*untyped) -> untyped
46
+ def each: () { (Model) -> void } -> self
47
+ def select: (*Symbol | String) -> self
48
+ | () { (Model) -> boolish } -> Array[Model]
49
+ end
@@ -0,0 +1,45 @@
1
+ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey]
2
+ def all: () -> Relation
3
+ def ids: () -> Array[PrimaryKey]
4
+ def none: () -> Relation
5
+ def pluck: (Symbol | String column) -> Array[untyped]
6
+ | (*Symbol | String columns) -> Array[Array[untyped]]
7
+ def where: (*untyped) -> Relation
8
+ def exists?: (*untyped) -> bool
9
+ def order: (*untyped) -> Relation
10
+ def group: (*Symbol | String) -> untyped
11
+ def distinct: () -> self
12
+ def or: (Relation) -> Relation
13
+ def merge: (Relation) -> Relation
14
+ def joins: (*String | Symbol) -> self
15
+ | (Hash[untyped, untyped]) -> self
16
+ def left_joins: (*String | Symbol) -> self
17
+ | (Hash[untyped, untyped]) -> self
18
+ def left_outer_joins: (*String | Symbol) -> self
19
+ | (Hash[untyped, untyped]) -> self
20
+ def includes: (*String | Symbol) -> self
21
+ | (Hash[untyped, untyped]) -> self
22
+ def eager_load: (*String | Symbol) -> self
23
+ | (Hash[untyped, untyped]) -> self
24
+ def preload: (*String | Symbol) -> self
25
+ | (Hash[untyped, untyped]) -> self
26
+ def find_by: (*untyped) -> Model?
27
+ def find_by!: (*untyped) -> Model
28
+ def find: (PrimaryKey id) -> Model
29
+ | (Array[PrimaryKey]) -> Array[Model]
30
+ | (*PrimaryKey) -> Array[Model]
31
+ def first: () -> Model?
32
+ | (Integer count) -> Array[Model]
33
+ def first!: () -> Model
34
+ def last: () -> Model?
35
+ | (Integer count) -> Array[Model]
36
+ def last!: () -> Model
37
+ def limit: (Integer | Arel::Nodes::SqlLiteral | nil) -> Relation
38
+ def find_each: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (Model) -> void } -> nil
39
+ def find_in_batches: (?batch_size: Integer, ?start: Integer, ?finish: Integer, ?error_on_ignore: bool) { (self) -> void } -> nil
40
+ def destroy_all: () -> untyped
41
+ def delete_all: () -> untyped
42
+ def update_all: (*untyped) -> untyped
43
+ def select: (*Symbol | String) -> Relation
44
+ | () { (Model) -> boolish } -> Array[Model]
45
+ end
@@ -0,0 +1,9 @@
1
+ # attr_accessor in #each
2
+ class ActiveRecord::Encryption::Context
3
+ attr_accessor key_provider: untyped
4
+ attr_accessor key_generator: untyped
5
+ attr_accessor cipher: untyped
6
+ attr_accessor message_serializer: untyped
7
+ attr_accessor encryptor: untyped
8
+ attr_accessor frozen_encryption: untyped
9
+ end
@@ -0,0 +1,5 @@
1
+ class ActiveRecord::Result
2
+ include Enumerable[Hash[String, untyped]]
3
+ def each: () -> Enumerator[Hash[String, untyped], Array[Hash[String, untyped]]]
4
+ | () { (Hash[String, untyped]) -> void } -> Array[Hash[String, untyped]]
5
+ 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,4 @@
1
+ class ActiveSupport::Duration
2
+ def since: (?untyped time) -> ::ActiveSupport::TimeWithZone
3
+ def ago: (?untyped time) -> ::ActiveSupport::TimeWithZone
4
+ end
@@ -0,0 +1,6 @@
1
+ module ActiveSupport
2
+ class HashWithIndifferentAccess[K, V] < ::Hash[K, V]
3
+ def []=: (K key, V value) -> untyped
4
+ def []: (K key) -> V
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module ActiveSupport
2
+ module Multibyte
3
+ class Chars
4
+ attr_reader wrapped_string: ::String
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class ActiveSupport::TimeWithZone
2
+ def +: (ActiveSupport::Duration other) -> self
3
+ def -: (self other) -> Float
4
+ | (ActiveSupport::Duration other) -> self
5
+ end
@@ -0,0 +1,3 @@
1
+ class ActiveSupport::TimeZone
2
+ def now: () -> ActiveSupport::TimeWithZone
3
+ end
@@ -0,0 +1,6 @@
1
+ class Date
2
+ def +: (ActiveSupport::Duration other) -> self
3
+ | ...
4
+ def -: (ActiveSupport::Duration other) -> self
5
+ | ...
6
+ end
@@ -0,0 +1,4 @@
1
+ module DateAndTime::Zones
2
+ def in_time_zone: (?(ActiveSupport::TimeZone | String) zone) -> ::ActiveSupport::TimeWithZone
3
+ | (false? zone) -> ::Time
4
+ end
@@ -0,0 +1,2 @@
1
+ class HashWithIndifferentAccess[K, V] < ActiveSupport::HashWithIndifferentAccess[K, V]
2
+ end
@@ -0,0 +1,9 @@
1
+ class Integer < ::Numeric
2
+ # 2.months # => 2 months
3
+ def months: () -> ActiveSupport::Duration
4
+
5
+ # Returns a Duration instance matching the number of years provided.
6
+ #
7
+ # 2.years # => 2 years
8
+ def years: () -> ActiveSupport::Duration
9
+ end
@@ -0,0 +1,15 @@
1
+ class Numeric
2
+ def kilobytes: () -> self
3
+ def megabytes: () -> self
4
+ def gigabytes: () -> self
5
+ def terabytes: () -> self
6
+ def petabytes: () -> self
7
+ def exabytes: () -> self
8
+ def seconds: () -> ActiveSupport::Duration
9
+ def minutes: () -> ActiveSupport::Duration
10
+ def hours: () -> ActiveSupport::Duration
11
+ def days: () -> ActiveSupport::Duration
12
+ def weeks: () -> ActiveSupport::Duration
13
+ def fortnights: () -> ActiveSupport::Duration
14
+ def in_milliseconds: () -> self
15
+ end
@@ -0,0 +1,4 @@
1
+ class String
2
+ def in_time_zone: (?(ActiveSupport::TimeZone | String) zone) -> ::ActiveSupport::TimeWithZone
3
+ | (false? zone) -> ::Time
4
+ end
@@ -0,0 +1,76 @@
1
+ module DateAndTime
2
+ module Calculations
3
+ end
4
+ module Zones
5
+ end
6
+ module Compatibility
7
+ end
8
+ end
9
+ module ActiveSupport
10
+ class TimeZone
11
+ end
12
+ class Duration
13
+ end
14
+ end
15
+
16
+ class Time
17
+ include DateAndTime::Calculations
18
+
19
+ # Returns <tt>Time.zone.now</tt> when <tt>Time.zone</tt> or <tt>config.time_zone</tt> are set, otherwise just returns <tt>Time.now</tt>.
20
+ def self.current: () -> ActiveSupport::TimeWithZone # strictly `(ActiveSupport::TimeWithZone | Time)` but it's inconvenient
21
+ def self.zone: () -> ActiveSupport::TimeZone # strictly `ActiveSupport::TimeWithZone?` but it's inconvenient
22
+
23
+ def ago: (untyped other) -> self
24
+ def advance: (untyped options) -> self
25
+ def change: (untyped options) -> self
26
+ def in_time_zone: (?(ActiveSupport::TimeZone | String) new_zone) -> ::ActiveSupport::TimeWithZone
27
+ | (false? zone) -> ::Time
28
+ def +: (ActiveSupport::Duration other) -> self
29
+ | ...
30
+ def -: (ActiveSupport::Duration other) -> self
31
+ | ...
32
+ alias at_beginning_of_day beginning_of_day
33
+ alias at_beginning_of_hour beginning_of_hour
34
+ alias at_beginning_of_minute beginning_of_minute
35
+ alias at_end_of_day end_of_day
36
+ alias at_end_of_hour end_of_hour
37
+ alias at_end_of_minute end_of_minute
38
+ alias at_midday middle_of_day
39
+ alias at_middle_of_day middle_of_day
40
+ alias at_midnight beginning_of_day
41
+ alias at_noon middle_of_day
42
+ def beginning_of_day: () -> self
43
+ def beginning_of_hour: () -> self
44
+ def beginning_of_minute: () -> self
45
+ def compare_with_coercion: (untyped other) -> (-1 | 0 | 1 | nil)
46
+ def compare_without_coercion: (untyped other) -> (-1 | 0 | 1 | nil)
47
+ def end_of_day: () -> self
48
+ def end_of_hour: () -> self
49
+ def end_of_minute: () -> self
50
+ def eql_with_coercion: (untyped other) -> bool
51
+ def eql_without_coercion: (untyped other) -> bool
52
+ alias midday middle_of_day
53
+ def middle_of_day: () -> self
54
+ alias midnight beginning_of_day
55
+ def minus_with_coercion: (Time | self arg0) -> Float
56
+ | (Numeric arg0) -> self
57
+ def minus_with_duration: (Time | self arg0) -> Float
58
+ | (Numeric arg0) -> self
59
+ def minus_without_coercion: (Time | self arg0) -> Float
60
+ | (Numeric arg0) -> self
61
+ def minus_without_duration: (Time | self arg0) -> Float
62
+ | (Numeric arg0) -> self
63
+ def next_day: () -> self
64
+ def next_month: () -> self
65
+ def next_year: () -> self
66
+ alias noon middle_of_day
67
+ def plus_without_duration: (Time | self arg0) -> Float
68
+ | (Numeric arg0) -> self
69
+ def prev_day: () -> self
70
+ def prev_month: () -> self
71
+ def prev_year: () -> self
72
+ def seconds_since_midnight: () -> Float
73
+ def seconds_until_end_of_day: () -> Integer
74
+ def sec_fraction: () -> (Integer | Rational)
75
+ def to_default_s: () -> String
76
+ end
@@ -0,0 +1,141 @@
1
+ stdlib_dependencies = %w[benchmark date digest json logger monitor mutex_m pathname singleton time minitest securerandom ipaddr did_you_mean]
2
+ gem_dependencies = %w[nokogiri i18n rack rails-dom-testing]
3
+ rails_dependencies = %w[activesupport actionview]
4
+
5
+ VERSIONS.each do |version|
6
+ namespace version do
7
+ namespace :action_pack do
8
+ export = "export/actionpack/#{version}"
9
+
10
+ desc "export to #{export}"
11
+ task :export do
12
+ sh "rm -fr #{export}"
13
+ sh "mkdir -p #{export}"
14
+
15
+ sh "cp -a out/#{version}/action_pack.rbs #{export}"
16
+ sh "cp -a out/#{version}/action_pack #{export}"
17
+ sh "cp -a out/#{version}/action_controller.rbs #{export}"
18
+ sh "cp -a out/#{version}/action_controller #{export}"
19
+ sh "cp -a out/#{version}/action_dispatch.rbs #{export}"
20
+ sh "cp -a out/#{version}/action_dispatch #{export}"
21
+ sh "cp -a out/#{version}/abstract_controller.rbs #{export}"
22
+ sh "cp -a out/#{version}/abstract_controller #{export}"
23
+ sh "cp -a out/#{version}/mime.rbs #{export}"
24
+ sh "cp -a out/#{version}/mime #{export}"
25
+
26
+ sh "rm #{export}/action_controller/railtie.rbs"
27
+ sh "rm #{export}/action_dispatch/railtie.rbs"
28
+
29
+ Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
30
+ # !!! GENERATED CODE !!!
31
+ # Please see generators/rails-generator
32
+
33
+ class Ripper
34
+ end
35
+
36
+ class Delegator
37
+ end
38
+
39
+ class SimpleDelegator < ::Delegator
40
+ end
41
+
42
+ class ActionDispatch::Cookies::CookieJar
43
+ def to_h: () -> Hash[untyped, untyped]
44
+ end
45
+
46
+ module Rack
47
+ module Cache
48
+ class EntityStore
49
+ end
50
+ class MetaStore
51
+ end
52
+ end
53
+ module Session
54
+ class Dalli
55
+ end
56
+ end
57
+ module Test
58
+ class UploadedFile
59
+ end
60
+ end
61
+ end
62
+
63
+ module Rails
64
+ module Dom
65
+ module Testing
66
+ module Assertions
67
+ include Rails::Dom::Testing::Assertions::SelectorAssertions
68
+
69
+ include Rails::Dom::Testing::Assertions::DomAssertions
70
+
71
+ extend ActiveSupport::Concern
72
+
73
+ module DomAssertions
74
+ public
75
+
76
+ def assert_dom_equal: (untyped expected, untyped actual, ?untyped message) -> untyped
77
+
78
+ def assert_dom_not_equal: (untyped expected, untyped actual, ?untyped message) -> untyped
79
+
80
+ private
81
+
82
+ def fragment: (untyped text) -> untyped
83
+ end
84
+
85
+ module SelectorAssertions
86
+ include Rails::Dom::Testing::Assertions::SelectorAssertions::CountDescribable
87
+
88
+ public
89
+
90
+ def assert_select: (*untyped args) { (*untyped) -> untyped } -> untyped
91
+
92
+ def assert_select_email: () { (*untyped) -> untyped } -> untyped
93
+
94
+ def assert_select_encoded: (?untyped element) { (*untyped) -> untyped } -> untyped
95
+
96
+ def css_select: (*untyped args) -> untyped
97
+
98
+ private
99
+
100
+ def assert_size_match!: (untyped size, untyped equals, untyped css_selector, ?untyped message) -> untyped
101
+
102
+ def document_root_element: () -> untyped
103
+
104
+ def nest_selection: (untyped selection) { (untyped) -> untyped } -> untyped
105
+
106
+ def nodeset: (untyped node) -> untyped
107
+
108
+ module CountDescribable
109
+ extend ActiveSupport::Concern
110
+
111
+ private
112
+
113
+ def count_description: (untyped min, untyped max, untyped count) -> untyped
114
+
115
+ def pluralize_element: (untyped quantity) -> untyped
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
122
+ RBS
123
+ end
124
+
125
+ desc "validate version=#{version} gem=action_pack"
126
+ task :validate do
127
+ stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
128
+ gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
129
+ rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
130
+ sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
131
+ end
132
+
133
+ desc "install to ../../../gems/actionpack/#{version}"
134
+ task :install do
135
+ install_to = File.expand_path("../../../gems/actionpack/#{version}", __dir__)
136
+ sh "rm -fr #{install_to}"
137
+ sh "cp -a #{export} #{install_to}"
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,77 @@
1
+ stdlib_dependencies = %w[benchmark date digest json logger monitor mutex_m pathname singleton time minitest did_you_mean]
2
+ gem_dependencies = %w[nokogiri i18n rack]
3
+ rails_dependencies = %w[activesupport]
4
+
5
+ VERSIONS.each do |version|
6
+ namespace version do
7
+ namespace :action_view do
8
+ export = "export/actionview/#{version}"
9
+
10
+ desc "export to #{export}"
11
+ task :export do
12
+ sh "rm -fr #{export}"
13
+ sh "mkdir -p #{export}"
14
+
15
+ sh "cp -a out/#{version}/action_view.rbs #{export}"
16
+ sh "cp -a out/#{version}/action_view #{export}"
17
+ sh "cp -a out/#{version}/erubi.rbs #{export}"
18
+ sh "cp -a out/#{version}/erubi #{export}"
19
+ sh "rm #{export}/action_view/railtie.rbs"
20
+ sh "rm -fr #{export}/action_view/test_case"
21
+ sh "rm #{export}/action_view/test_case.rbs"
22
+
23
+ File.open("out/#{version}/action_view/partial_renderer.rbs") do |r|
24
+ File.open("#{export}/action_view/partial_renderer.rbs", "w+") do |w|
25
+ outs = r.each_line.select do |line|
26
+ !line.include?("prepend ActiveRecord::Railties::CollectionCacheAssociationLoading")
27
+ end
28
+ w.puts(outs)
29
+ end
30
+ end
31
+
32
+ File.open("out/#{version}/action_view/routing_url_for.rbs") do |r|
33
+ File.open("#{export}/action_view/routing_url_for.rbs", "w+") do |w|
34
+ outs = r.each_line.select do |line|
35
+ !line.include?("include ActionDispatch::Routing::UrlFor")
36
+ end
37
+ w.puts(outs)
38
+ end
39
+ end
40
+
41
+ Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
42
+ # !!! GENERATED CODE !!!
43
+ # Please see generators/rails-generator
44
+
45
+ class Ripper
46
+ end
47
+
48
+ class Delegator
49
+ end
50
+
51
+ class SimpleDelegator < ::Delegator
52
+ end
53
+
54
+ module ERB
55
+ module Util
56
+ end
57
+ end
58
+ RBS
59
+ end
60
+
61
+ desc "validate version=#{version} gem=action_view"
62
+ task :validate do
63
+ stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
64
+ gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
65
+ rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
66
+ sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
67
+ end
68
+
69
+ desc "install to ../../../gems/actionview/#{version}"
70
+ task :install do
71
+ install_to = File.expand_path("../../../gems/actionview/#{version}", __dir__)
72
+ sh "rm -fr #{install_to}"
73
+ sh "cp -a #{export} #{install_to}"
74
+ end
75
+ end
76
+ end
77
+ end
@@ -1,4 +1,4 @@
1
- stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest]
1
+ stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest minitest]
2
2
  gem_dependencies = %w[nokogiri]
3
3
  rails_dependencies = %w[activesupport]
4
4
 
@@ -24,6 +24,10 @@ VERSIONS.each do |version|
24
24
  class Job
25
25
  end
26
26
  end
27
+ module Qu
28
+ class Job
29
+ end
30
+ end
27
31
  RBS
28
32
 
29
33
  generate_test_script(
@@ -1,4 +1,4 @@
1
- stdlib_dependencies = %w[benchmark date digest forwardable json logger monitor mutex_m singleton time]
1
+ stdlib_dependencies = %w[benchmark date digest forwardable json logger monitor mutex_m singleton time minitest]
2
2
  gem_dependencies = %w[nokogiri]
3
3
  rails_dependencies = %w[activesupport]
4
4
 
@@ -1,6 +1,6 @@
1
- stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest forwardable did_you_mean openssl socket]
1
+ stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest forwardable did_you_mean openssl socket minitest]
2
2
  gem_dependencies = %w[nokogiri]
3
- rails_dependencies = %w[activesupport activemodel activejob]
3
+ rails_dependencies = %w[activesupport activemodel]
4
4
 
5
5
  VERSIONS.each do |version|
6
6
  namespace version do
@@ -17,7 +17,12 @@ VERSIONS.each do |version|
17
17
  sh "cp -a out/#{version}/arel #{export}"
18
18
  sh "cp -a out/#{version}/arel.rbs #{export}"
19
19
  sh "cp -a out/#{version}/_active_record_relation.rbs #{export}"
20
+
20
21
  sh "rm #{export}/active_record/railtie.rbs"
22
+ sh "rm -fr #{export}/active_record/connection_adapters" # FIXME
23
+ sh "rm -fr #{export}/active_record/migration/compatibility" # FIXME
24
+ sh "rm -f #{export}/active_record/destroy_association_async_job.rbs" # move to railties
25
+
21
26
  sh "cat out/#{version}/active_record/base.rbs | grep -v ActiveStorage > #{export}/active_record/base.rbs"
22
27
 
23
28
  Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
@@ -1,6 +1,6 @@
1
1
  require 'rbs'
2
2
 
3
- stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest forwardable did_you_mean openssl socket]
3
+ stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest forwardable did_you_mean openssl socket minitest]
4
4
  gem_dependencies = %w[nokogiri]
5
5
  rails_dependencies = %w[activesupport activemodel activejob activerecord]
6
6
 
@@ -28,6 +28,9 @@ VERSIONS.each do |version|
28
28
  sh "cp -a #{out}.rbs #{export}" if File.exist?("#{out}.rbs")
29
29
  end
30
30
 
31
+ # 5.2
32
+ sh "cp -a out/#{version}/logger_silence.rbs #{export}" if File.exist?("out/#{version}/logger_silence.rbs")
33
+
31
34
  Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
32
35
  # !!! GENERATED CODE !!!
33
36
  # Please see generators/rails-generator
@@ -50,6 +53,10 @@ VERSIONS.each do |version|
50
53
  sh "rm -fr #{export}/uri{,.rbs}"
51
54
  end
52
55
 
56
+ generate_manifest(
57
+ export: export,
58
+ stdlib_dependencies: stdlib_dependencies
59
+ )
53
60
  generate_test_script(
54
61
  gem: :activesupport,
55
62
  version: version,
@@ -0,0 +1,37 @@
1
+ stdlib_dependencies = %w[benchmark date digest json logger monitor mutex_m pathname singleton time minitest securerandom ipaddr did_you_mean forwardable openssl socket]
2
+ gem_dependencies = %w[nokogiri i18n rack rails-dom-testing]
3
+ rails_dependencies = %w[actionpack actionview activejob activemodel activerecord activestorage activesupport]
4
+
5
+ VERSIONS.each do |version|
6
+ namespace version do
7
+ namespace :railties do
8
+ export = "export/railties/#{version}"
9
+
10
+ desc "export to #{export}"
11
+ task :export do
12
+ sh "rm -fr #{export}"
13
+ sh "mkdir -p #{export}"
14
+
15
+ if File.exist?("out/#{version}/active_record/destroy_association_async_job.rbs")
16
+ sh "mkdir -p #{export}/active_record"
17
+ sh "cp out/#{version}/active_record/destroy_association_async_job.rbs #{export}/active_record/destroy_association_async_job.rbs"
18
+ end
19
+ end
20
+
21
+ desc "validate version=#{version} gem=railties"
22
+ task :validate do
23
+ stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
24
+ gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
25
+ rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
26
+ sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
27
+ end
28
+
29
+ desc "install to ../../../gems/railties/#{version}"
30
+ task :install do
31
+ install_to = File.expand_path("../../../gems/railties/#{version}", __dir__)
32
+ sh "rm -fr #{install_to}"
33
+ sh "cp -a #{export} #{install_to}"
34
+ end
35
+ end
36
+ end
37
+ end
@@ -13,17 +13,9 @@ module Orthoses
13
13
  end
14
14
 
15
15
  def call
16
- target_method = begin
17
- ::ActiveModel::SecurePassword::ClassMethods.instance_method(:has_secure_password)
18
- rescue NameError => err
19
- Orthoses.logger.warn("Run `require 'active_support/concern'; require 'active_model/secure_password'` and retry because #{err}")
20
- require 'active_support/concern'
21
- require 'active_model/secure_password'
22
- retry
23
- end
24
- call_tracer = Orthoses::CallTracer.new
16
+ call_tracer = CallTracer::Lazy.new
25
17
 
26
- store = call_tracer.trace(target_method) do
18
+ store = call_tracer.trace('ActiveModel::SecurePassword::ClassMethods#has_secure_password') do
27
19
  @loader.call
28
20
  end
29
21
 
@@ -12,14 +12,8 @@ module Orthoses
12
12
  end
13
13
 
14
14
  def call
15
- target = begin
16
- ::ActiveRecord::DelegatedType.instance_method(:delegated_type)
17
- rescue NameError
18
- Orthoses.logger.warn("[ActiveRecord::DelegatedType] Skip since `delegated_type' is not implemented")
19
- return @loader.call
20
- end
21
- delegated_type = CallTracer.new
22
- store = delegated_type.trace(target) do
15
+ delegated_type = CallTracer::Lazy.new
16
+ store = delegated_type.trace('ActiveRecord::DelegatedType#delegated_type') do
23
17
  @loader.call
24
18
  end
25
19