orthoses-rails 0.4.0 → 0.7.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 +31 -39
- data/examples/rails/Gemfile +16 -0
- data/examples/rails/Gemfile.lock +178 -0
- data/examples/rails/Rakefile +149 -193
- data/examples/rails/config/database.yml +8 -0
- data/examples/rails/config/storage.yml +3 -0
- data/examples/rails/known_sig/actionpack/7.0/action_controller/metal.rbs +4 -0
- data/{lib/orthoses/active_model/known_sig/7.0 → examples/rails/known_sig/activemodel/7.0/active_model}/serialization.rbs +0 -0
- data/{lib/orthoses/active_model/known_sig/7.0 → examples/rails/known_sig/activemodel/7.0/active_model}/validations.rbs +0 -0
- data/examples/rails/known_sig/activerecord/6.0/_active_record_relation.rbs +49 -0
- data/examples/rails/known_sig/activerecord/6.0/_active_record_relation_class_methods.rbs +45 -0
- data/{lib/orthoses/active_record/known_sig/6.0 → examples/rails/known_sig/activerecord/6.0/active_record}/result.rbs +0 -0
- data/examples/rails/known_sig/activerecord/6.1/_active_record_relation.rbs +49 -0
- data/examples/rails/known_sig/activerecord/6.1/_active_record_relation_class_methods.rbs +45 -0
- data/{lib/orthoses/active_record/known_sig/6.1 → examples/rails/known_sig/activerecord/6.1/active_record}/result.rbs +0 -0
- data/examples/rails/known_sig/activerecord/7.0/_active_record_relation.rbs +49 -0
- data/examples/rails/known_sig/activerecord/7.0/_active_record_relation_class_methods.rbs +45 -0
- data/{lib/orthoses/active_record/known_sig/7.0 → examples/rails/known_sig/activerecord/7.0/active_record}/encryption/context.rbs +0 -0
- data/{lib/orthoses/active_record/known_sig/7.0 → examples/rails/known_sig/activerecord/7.0/active_record}/result.rbs +0 -0
- data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/active_support/callbacks/callback_chain.rbs +0 -0
- data/examples/rails/known_sig/activesupport/7.0/active_support/duration.rbs +4 -0
- data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/active_support/hash_with_indifferent_access.rbs +0 -0
- data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/active_support/multibyte/chars.rbs +0 -0
- data/examples/rails/known_sig/activesupport/7.0/active_support/time_with_zone.rbs +5 -0
- data/examples/rails/known_sig/activesupport/7.0/active_support/time_zone.rbs +3 -0
- data/examples/rails/known_sig/activesupport/7.0/date.rbs +6 -0
- data/examples/rails/known_sig/activesupport/7.0/date_and_time/zones.rbs +4 -0
- data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/hash_with_indifferent_access.rbs +0 -0
- data/examples/rails/known_sig/activesupport/7.0/integer.rbs +9 -0
- data/examples/rails/known_sig/activesupport/7.0/numeric.rbs +15 -0
- data/examples/rails/known_sig/activesupport/7.0/string.rbs +4 -0
- data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/time.rbs +8 -0
- data/examples/rails/tasks/action_pack.rake +141 -0
- data/examples/rails/tasks/action_view.rake +77 -0
- data/examples/rails/tasks/active_job.rake +99 -0
- data/examples/rails/tasks/active_model.rake +46 -0
- data/examples/rails/tasks/active_record.rake +88 -0
- data/examples/rails/tasks/active_storage.rake +94 -0
- data/examples/rails/tasks/active_support.rake +99 -0
- data/examples/rails/tasks/railties.rake +37 -0
- data/lib/orthoses/active_model/has_secure_password.rb +2 -10
- data/lib/orthoses/active_model.rb +0 -1
- data/lib/orthoses/active_record/delegated_type.rb +44 -0
- data/lib/orthoses/active_record/enum.rb +77 -0
- data/lib/orthoses/active_record/generated_attribute_methods.rb +1 -0
- data/lib/orthoses/active_record/scope.rb +63 -0
- data/lib/orthoses/active_record.rb +3 -1
- data/lib/orthoses/active_support/class_attribute.rb +3 -10
- data/lib/orthoses/active_support/configurable.rb +3 -2
- data/lib/orthoses/active_support/delegation.rb +11 -19
- data/lib/orthoses/active_support/mattr_accessor.rb +4 -12
- data/lib/orthoses/active_support/time_with_zone.rb +21 -3
- data/lib/orthoses/active_support.rb +0 -17
- data/lib/orthoses/rails/version.rb +1 -1
- data/lib/orthoses/rails.rb +1 -1
- data/lib/orthoses/railties/mixin.rb +107 -0
- data/lib/orthoses/railties.rb +3 -0
- data/orthoses-rails.gemspec +1 -1
- metadata +48 -89
- data/examples/rails/known_sig/action_cable/connection/test_cookie_jar.rbs +0 -2
- data/examples/rails/known_sig/action_controller/metal.rbs +0 -4
- data/examples/rails/known_sig/action_dispatch/cookies/cookie_jar.rbs +0 -3
- data/examples/rails/known_sig/action_dispatch/response.rbs +0 -4
- data/examples/rails/patch/drb/drb_undumped.rbs +0 -2
- data/examples/rails/patch/drb.rbs +0 -2
- data/examples/rails/patch/erubi/engine.rbs +0 -4
- data/examples/rails/patch/erubi.rbs +0 -2
- data/examples/rails/patch/minitest/kernel.rbs +0 -44
- data/examples/rails/patch/minitest/minitest/abstract_reporter.rbs +0 -49
- data/examples/rails/patch/minitest/minitest/assertion.rbs +0 -16
- data/examples/rails/patch/minitest/minitest/assertions.rbs +0 -545
- data/examples/rails/patch/minitest/minitest/backtrace_filter.rbs +0 -16
- data/examples/rails/patch/minitest/minitest/bench_spec.rbs +0 -101
- data/examples/rails/patch/minitest/minitest/benchmark.rbs +0 -258
- data/examples/rails/patch/minitest/minitest/composite_reporter.rbs +0 -25
- data/examples/rails/patch/minitest/minitest/expectations.rbs +0 -21
- data/examples/rails/patch/minitest/minitest/guard.rbs +0 -64
- data/examples/rails/patch/minitest/minitest/mock.rbs +0 -60
- data/examples/rails/patch/minitest/minitest/parallel/executor.rbs +0 -42
- data/examples/rails/patch/minitest/minitest/parallel/test/class_methods.rbs +0 -6
- data/examples/rails/patch/minitest/minitest/parallel/test.rbs +0 -3
- data/examples/rails/patch/minitest/minitest/parallel.rbs +0 -2
- data/examples/rails/patch/minitest/minitest/pride_io.rbs +0 -54
- data/examples/rails/patch/minitest/minitest/pride_lol.rbs +0 -17
- data/examples/rails/patch/minitest/minitest/progress_reporter.rbs +0 -11
- data/examples/rails/patch/minitest/minitest/reportable.rbs +0 -51
- data/examples/rails/patch/minitest/minitest/reporter.rbs +0 -5
- data/examples/rails/patch/minitest/minitest/result.rbs +0 -28
- data/examples/rails/patch/minitest/minitest/runnable.rbs +0 -131
- data/examples/rails/patch/minitest/minitest/skip.rbs +0 -6
- data/examples/rails/patch/minitest/minitest/spec/dsl/instance_methods.rbs +0 -48
- data/examples/rails/patch/minitest/minitest/spec/dsl.rbs +0 -125
- data/examples/rails/patch/minitest/minitest/spec.rbs +0 -10
- data/examples/rails/patch/minitest/minitest/statistics_reporter.rbs +0 -76
- data/examples/rails/patch/minitest/minitest/summary_reporter.rbs +0 -26
- data/examples/rails/patch/minitest/minitest/test/lifecycle_hooks.rbs +0 -92
- data/examples/rails/patch/minitest/minitest/test.rbs +0 -76
- data/examples/rails/patch/minitest/minitest/unexpected_error.rbs +0 -10
- data/examples/rails/patch/minitest/minitest/unit/test_case.rbs +0 -3
- data/examples/rails/patch/minitest/minitest/unit.rbs +0 -5
- data/examples/rails/patch/minitest/minitest.rbs +0 -966
- data/examples/rails/patch/pg/simple_decoder.rbs +0 -4
- data/examples/rails/patch/pg.rbs +0 -2
- data/examples/rails/patch/qc/queue.rbs +0 -2
- data/examples/rails/patch/qc.rbs +0 -2
- data/examples/rails/patch/que/job.rbs +0 -2
- data/examples/rails/patch/que.rbs +0 -2
- data/examples/rails/patch/rack/cache/entity_store.rbs +0 -2
- data/examples/rails/patch/rack/cache/meta_store.rbs +0 -2
- data/examples/rails/patch/rack/cache.rbs +0 -2
- data/examples/rails/patch/rack/session/dalli.rbs +0 -2
- data/examples/rails/patch/rack/session.rbs +0 -2
- data/examples/rails/patch/rboc.rbs +0 -2
- data/examples/rails/patch/rdoc/generator/sdoc.rbs +0 -3
- data/examples/rails/patch/rdoc/generator.rbs +0 -2
- data/examples/rails/patch/rdoc/task.rbs +0 -2
- data/examples/rails/patch/ripper.rbs +0 -2
- data/examples/rails/patch/sidekiq/worker.rbs +0 -2
- data/examples/rails/patch/sidekiq.rbs +0 -2
- data/examples/rails/patch/sneakers/worker.rbs +0 -2
- data/examples/rails/patch/sneakers.rbs +0 -2
- data/examples/rails/patch/sucker_punch/job.rbs +0 -2
- data/examples/rails/patch/sucker_punch.rbs +0 -2
- data/examples/rails/patch/thor/actions/create_file.rbs +0 -2
- data/examples/rails/patch/thor/actions.rbs +0 -2
- data/examples/rails/patch/thor/error.rbs +0 -2
- data/examples/rails/patch/thor/group.rbs +0 -2
- data/examples/rails/patch/thor.rbs +0 -2
- data/lib/orthoses/active_model/known_sig.rb +0 -21
- data/lib/orthoses/active_record/known_sig.rb +0 -21
- data/lib/orthoses/active_support/known_sig.rb +0 -21
- data/lib/orthoses/rails/known_sig_helper.rb +0 -22
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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
|
data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/time.rbs
RENAMED
@@ -15,6 +15,14 @@ end
|
|
15
15
|
|
16
16
|
class Time
|
17
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
|
18
26
|
def in_time_zone: (?(ActiveSupport::TimeZone | String) new_zone) -> ::ActiveSupport::TimeWithZone
|
19
27
|
| (false? zone) -> ::Time
|
20
28
|
def +: (ActiveSupport::Duration other) -> self
|
@@ -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
|
@@ -0,0 +1,99 @@
|
|
1
|
+
stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest minitest]
|
2
|
+
gem_dependencies = %w[nokogiri]
|
3
|
+
rails_dependencies = %w[activesupport]
|
4
|
+
|
5
|
+
VERSIONS.each do |version|
|
6
|
+
namespace version do
|
7
|
+
namespace :active_job do
|
8
|
+
export = "export/activejob/#{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}/active_job.rbs #{export}"
|
16
|
+
sh "cp -a out/#{version}/active_job #{export}"
|
17
|
+
sh "rm #{export}/active_job/railtie.rbs"
|
18
|
+
|
19
|
+
Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
|
20
|
+
# !!! GENERATED CODE !!!
|
21
|
+
# Please see generators/rails-generator
|
22
|
+
|
23
|
+
module Que
|
24
|
+
class Job
|
25
|
+
end
|
26
|
+
end
|
27
|
+
module Qu
|
28
|
+
class Job
|
29
|
+
end
|
30
|
+
end
|
31
|
+
RBS
|
32
|
+
|
33
|
+
generate_test_script(
|
34
|
+
gem: :activejob,
|
35
|
+
version: version,
|
36
|
+
export: export,
|
37
|
+
stdlib_dependencies: stdlib_dependencies,
|
38
|
+
gem_dependencies: gem_dependencies,
|
39
|
+
rails_dependencies: rails_dependencies,
|
40
|
+
)
|
41
|
+
|
42
|
+
Pathname(export).join('_test').join('test.rb').write(<<~RUBY)
|
43
|
+
# !!! GENERATED CODE !!!
|
44
|
+
# Please see generators/rails-generator
|
45
|
+
|
46
|
+
class SendMessageJob < ActiveJob::Base
|
47
|
+
queue_as :default
|
48
|
+
self.queue_adapter = :sidekiq
|
49
|
+
|
50
|
+
before_enqueue do |job|
|
51
|
+
# before enqueued
|
52
|
+
end
|
53
|
+
|
54
|
+
around_perform :around_task
|
55
|
+
|
56
|
+
def perform(*args)
|
57
|
+
# Do something later
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def around_task
|
63
|
+
# Do something before
|
64
|
+
# yield
|
65
|
+
# Do something after
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
SendMessageJob.perform_now
|
70
|
+
SendMessageJob.set(queue: :another_queue).perform_later(flag: false)
|
71
|
+
RUBY
|
72
|
+
|
73
|
+
Pathname(export).join('_test').join('test.rbs').write(<<~RBS)
|
74
|
+
# !!! GENERATED CODE !!!
|
75
|
+
# Please see generators/rails-generator
|
76
|
+
|
77
|
+
class SendMessageJob < ActiveJob::Base
|
78
|
+
def perform: (*untyped) -> void
|
79
|
+
end
|
80
|
+
RBS
|
81
|
+
end
|
82
|
+
|
83
|
+
desc "validate version=#{version} gem=active_job"
|
84
|
+
task :validate do
|
85
|
+
stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
|
86
|
+
gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
|
87
|
+
rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
|
88
|
+
sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
|
89
|
+
end
|
90
|
+
|
91
|
+
desc "install to ../../../gems/activejob/#{version}"
|
92
|
+
task :install do
|
93
|
+
install_to = File.expand_path("../../../gems/activejob/#{version}", __dir__)
|
94
|
+
sh "rm -fr #{install_to}"
|
95
|
+
sh "cp -a #{export} #{install_to}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
stdlib_dependencies = %w[benchmark date digest forwardable json logger monitor mutex_m singleton time minitest]
|
2
|
+
gem_dependencies = %w[nokogiri]
|
3
|
+
rails_dependencies = %w[activesupport]
|
4
|
+
|
5
|
+
VERSIONS.each do |version|
|
6
|
+
namespace version do
|
7
|
+
namespace :active_model do
|
8
|
+
export = "export/activemodel/#{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}/active_model.rbs #{export}"
|
16
|
+
sh "cp -a out/#{version}/active_model #{export}"
|
17
|
+
sh "rm #{export}/active_model/railtie.rbs"
|
18
|
+
|
19
|
+
Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
|
20
|
+
# !!! GENERATED CODE !!!
|
21
|
+
# Please see generators/rails-generator
|
22
|
+
|
23
|
+
class Delegator
|
24
|
+
end
|
25
|
+
class SimpleDelegator < Delegator
|
26
|
+
end
|
27
|
+
RBS
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "validate version=#{version} gem=active_model"
|
31
|
+
task :validate do
|
32
|
+
stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
|
33
|
+
gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
|
34
|
+
rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
|
35
|
+
sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "install to ../../../gems/activemodel/#{version}"
|
39
|
+
task :install do
|
40
|
+
install_to = File.expand_path("../../../gems/activemodel/#{version}", __dir__)
|
41
|
+
sh "rm -fr #{install_to}"
|
42
|
+
sh "cp -a #{export} #{install_to}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest forwardable did_you_mean openssl socket minitest]
|
2
|
+
gem_dependencies = %w[nokogiri]
|
3
|
+
rails_dependencies = %w[activesupport activemodel]
|
4
|
+
|
5
|
+
VERSIONS.each do |version|
|
6
|
+
namespace version do
|
7
|
+
namespace :active_record do
|
8
|
+
export = "export/activerecord/#{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}/active_record.rbs #{export}"
|
16
|
+
sh "cp -a out/#{version}/active_record #{export}"
|
17
|
+
sh "cp -a out/#{version}/arel #{export}"
|
18
|
+
sh "cp -a out/#{version}/arel.rbs #{export}"
|
19
|
+
sh "cp -a out/#{version}/_active_record_relation.rbs #{export}"
|
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
|
+
|
26
|
+
sh "cat out/#{version}/active_record/base.rbs | grep -v ActiveStorage > #{export}/active_record/base.rbs"
|
27
|
+
|
28
|
+
Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
|
29
|
+
# !!! GENERATED CODE !!!
|
30
|
+
# Please see generators/rails-generator
|
31
|
+
|
32
|
+
module PG
|
33
|
+
class SimpleDecoder
|
34
|
+
end
|
35
|
+
end
|
36
|
+
module GlobalID
|
37
|
+
module Identification
|
38
|
+
end
|
39
|
+
module FixtureSet
|
40
|
+
end
|
41
|
+
end
|
42
|
+
RBS
|
43
|
+
|
44
|
+
generate_test_script(
|
45
|
+
gem: :activerecord,
|
46
|
+
version: version,
|
47
|
+
export: export,
|
48
|
+
stdlib_dependencies: stdlib_dependencies,
|
49
|
+
gem_dependencies: gem_dependencies,
|
50
|
+
rails_dependencies: rails_dependencies,
|
51
|
+
)
|
52
|
+
|
53
|
+
Pathname(export).join('_test').join('test.rb').write(<<~RUBY)
|
54
|
+
# !!! GENERATED CODE !!!
|
55
|
+
# Please see generators/rails-generator
|
56
|
+
|
57
|
+
class User < ActiveRecord::Base
|
58
|
+
end
|
59
|
+
|
60
|
+
user = User.new
|
61
|
+
RUBY
|
62
|
+
|
63
|
+
Pathname(export).join('_test').join('test.rbs').write(<<~RBS)
|
64
|
+
# !!! GENERATED CODE !!!
|
65
|
+
# Please see generators/rails-generator
|
66
|
+
|
67
|
+
class User < ActiveRecord::Base
|
68
|
+
end
|
69
|
+
RBS
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "validate version=#{version} gem=active_record"
|
73
|
+
task :validate do
|
74
|
+
stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
|
75
|
+
gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
|
76
|
+
rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
|
77
|
+
sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
|
78
|
+
end
|
79
|
+
|
80
|
+
desc "install to ../../../gems/activerecord/#{version}"
|
81
|
+
task :install do
|
82
|
+
install_to = File.expand_path("../../../gems/activerecord/#{version}", __dir__)
|
83
|
+
sh "rm -fr #{install_to}"
|
84
|
+
sh "cp -a #{export} #{install_to}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|