orthoses-rails 0.8.0 → 1.0.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 +13 -65
- data/lib/generators/orthoses/rails/install_generator.rb +18 -0
- data/lib/orthoses/active_record/belongs_to.rb +15 -4
- data/lib/orthoses/active_record/enum.rb +5 -0
- data/lib/orthoses/active_record/generated_attribute_methods.rb +47 -55
- data/lib/orthoses/active_record/has_many.rb +15 -4
- data/lib/orthoses/active_record/has_one.rb +12 -2
- data/lib/orthoses/active_record/relation.rb +56 -0
- data/lib/orthoses/active_record.rb +36 -0
- data/lib/orthoses/active_support/delegation.rb +20 -9
- data/lib/orthoses/active_support/time_with_zone.rb +35 -28
- data/lib/orthoses/rails/application.rb +33 -0
- data/lib/orthoses/rails/version.rb +1 -1
- data/lib/orthoses/rails.rb +3 -2
- metadata +10 -47
- data/examples/rails/Gemfile +0 -16
- data/examples/rails/Gemfile.lock +0 -179
- data/examples/rails/Rakefile +0 -328
- data/examples/rails/config/database.yml +0 -8
- data/examples/rails/config/storage.yml +0 -3
- data/examples/rails/known_sig/actionpack/7.0/action_controller/metal.rbs +0 -4
- data/examples/rails/known_sig/activemodel/7.0/active_model/serialization.rbs +0 -4
- data/examples/rails/known_sig/activemodel/7.0/active_model/validations.rbs +0 -4
- data/examples/rails/known_sig/activerecord/6.0/_active_record_relation.rbs +0 -49
- data/examples/rails/known_sig/activerecord/6.0/_active_record_relation_class_methods.rbs +0 -45
- data/examples/rails/known_sig/activerecord/6.0/active_record/result.rbs +0 -5
- data/examples/rails/known_sig/activerecord/6.1/_active_record_relation.rbs +0 -49
- data/examples/rails/known_sig/activerecord/6.1/_active_record_relation_class_methods.rbs +0 -45
- data/examples/rails/known_sig/activerecord/6.1/active_record/result.rbs +0 -5
- data/examples/rails/known_sig/activerecord/7.0/_active_record_relation.rbs +0 -49
- data/examples/rails/known_sig/activerecord/7.0/_active_record_relation_class_methods.rbs +0 -45
- data/examples/rails/known_sig/activerecord/7.0/active_record/encryption/context.rbs +0 -9
- data/examples/rails/known_sig/activerecord/7.0/active_record/result.rbs +0 -5
- data/examples/rails/known_sig/activesupport/7.0/active_support/callbacks/callback_chain.rbs +0 -9
- data/examples/rails/known_sig/activesupport/7.0/active_support/duration.rbs +0 -4
- data/examples/rails/known_sig/activesupport/7.0/active_support/hash_with_indifferent_access.rbs +0 -6
- data/examples/rails/known_sig/activesupport/7.0/active_support/multibyte/chars.rbs +0 -7
- data/examples/rails/known_sig/activesupport/7.0/active_support/time_with_zone.rbs +0 -5
- data/examples/rails/known_sig/activesupport/7.0/active_support/time_zone.rbs +0 -3
- data/examples/rails/known_sig/activesupport/7.0/date.rbs +0 -6
- data/examples/rails/known_sig/activesupport/7.0/date_and_time/zones.rbs +0 -4
- data/examples/rails/known_sig/activesupport/7.0/hash_with_indifferent_access.rbs +0 -2
- data/examples/rails/known_sig/activesupport/7.0/integer.rbs +0 -9
- data/examples/rails/known_sig/activesupport/7.0/numeric.rbs +0 -15
- data/examples/rails/known_sig/activesupport/7.0/string.rbs +0 -4
- data/examples/rails/known_sig/activesupport/7.0/time.rbs +0 -46
- data/examples/rails/tasks/action_pack.rake +0 -141
- data/examples/rails/tasks/action_view.rake +0 -77
- data/examples/rails/tasks/active_job.rake +0 -99
- data/examples/rails/tasks/active_model.rake +0 -46
- data/examples/rails/tasks/active_record.rake +0 -88
- data/examples/rails/tasks/active_storage.rake +0 -94
- data/examples/rails/tasks/active_support.rake +0 -99
- data/examples/rails/tasks/railties.rake +0 -34
- data/orthoses-rails.gemspec +0 -36
@@ -1,77 +0,0 @@
|
|
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,99 +0,0 @@
|
|
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
|
@@ -1,46 +0,0 @@
|
|
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
|
@@ -1,88 +0,0 @@
|
|
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
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'rbs'
|
2
|
-
|
3
|
-
stdlib_dependencies = %w[time monitor singleton logger mutex_m json date benchmark digest forwardable did_you_mean openssl socket minitest]
|
4
|
-
gem_dependencies = %w[nokogiri]
|
5
|
-
rails_dependencies = %w[activesupport activemodel activejob activerecord]
|
6
|
-
|
7
|
-
VERSIONS.each do |version|
|
8
|
-
namespace version do
|
9
|
-
namespace :active_storage do
|
10
|
-
export = "export/activestorage/#{version}"
|
11
|
-
|
12
|
-
desc "export to #{export}"
|
13
|
-
task :export do
|
14
|
-
sh "rm -fr #{export}"
|
15
|
-
sh "mkdir -p #{export}"
|
16
|
-
|
17
|
-
# base
|
18
|
-
sh "cp -a out/#{version}/active_storage.rbs #{export}"
|
19
|
-
sh "cp -a out/#{version}/active_storage #{export}"
|
20
|
-
sh "rm #{export}/active_storage/engine.rbs"
|
21
|
-
decls = RBS::Parser.parse_signature(RBS::Buffer.new(
|
22
|
-
content: File.read("out/#{version}/active_record/base.rbs"),
|
23
|
-
name: "out/#{version}/active_record/base.rbs"
|
24
|
-
)).map do |decl|
|
25
|
-
decl.members.select! do |member|
|
26
|
-
case member
|
27
|
-
when RBS::AST::Members::Mixin
|
28
|
-
# Remove ActiveStorage
|
29
|
-
member.name.to_s.include?("ActiveStorage")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
decl
|
33
|
-
end
|
34
|
-
File.open("#{export}/active_record_base.rbs", "w+") do |f|
|
35
|
-
RBS::Writer.new(out: f).write(decls)
|
36
|
-
end
|
37
|
-
|
38
|
-
# TODO: remove after support action_controller
|
39
|
-
sh "rm -fr #{export}/active_storage/blobs"
|
40
|
-
sh "rm -fr #{export}/active_storage/representations"
|
41
|
-
Dir.glob("#{export}/active_storage/*_controller.rbs").each do |controller|
|
42
|
-
sh "rm -f #{controller}"
|
43
|
-
end
|
44
|
-
sh "rm -f #{export}/active_storage/streaming.rbs"
|
45
|
-
|
46
|
-
generate_test_script(
|
47
|
-
gem: :activestorage,
|
48
|
-
version: version,
|
49
|
-
export: export,
|
50
|
-
stdlib_dependencies: stdlib_dependencies,
|
51
|
-
gem_dependencies: gem_dependencies,
|
52
|
-
rails_dependencies: rails_dependencies,
|
53
|
-
)
|
54
|
-
|
55
|
-
Pathname(export).join('_test').join('test.rb').write(<<~RUBY)
|
56
|
-
# !!! GENERATED CODE !!!
|
57
|
-
# Please see generators/rails-generator
|
58
|
-
|
59
|
-
class User < ActiveRecord::Base
|
60
|
-
has_one_attached :one_image
|
61
|
-
has_many_attached :many_image
|
62
|
-
end
|
63
|
-
|
64
|
-
user = User.new
|
65
|
-
one = ActiveStorage::Attached::One.new("one_image", user)
|
66
|
-
one.url
|
67
|
-
RUBY
|
68
|
-
|
69
|
-
Pathname(export).join('_test').join('test.rbs').write(<<~RBS)
|
70
|
-
# !!! GENERATED CODE !!!
|
71
|
-
# Please see generators/rails-generator
|
72
|
-
|
73
|
-
class User < ActiveRecord::Base
|
74
|
-
end
|
75
|
-
RBS
|
76
|
-
end
|
77
|
-
|
78
|
-
desc "validate version=#{version} gem=active_storage"
|
79
|
-
task :validate do
|
80
|
-
stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
|
81
|
-
gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
|
82
|
-
rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
|
83
|
-
sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
|
84
|
-
end
|
85
|
-
|
86
|
-
desc "install to ../../../gems/activestorage/#{version}"
|
87
|
-
task :install do
|
88
|
-
install_to = File.expand_path("../../../gems/activestorage/#{version}", __dir__)
|
89
|
-
sh "rm -fr #{install_to}"
|
90
|
-
sh "cp -a #{export} #{install_to}"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
stdlib_dependencies = %w[benchmark date digest json logger monitor mutex_m pathname singleton time minitest]
|
2
|
-
gem_dependencies = %w[nokogiri]
|
3
|
-
rails_dependencies = %w[]
|
4
|
-
|
5
|
-
VERSIONS.each do |version|
|
6
|
-
namespace version do
|
7
|
-
namespace :active_support do
|
8
|
-
export = "export/activesupport/#{version}"
|
9
|
-
|
10
|
-
desc "export to #{export}"
|
11
|
-
task :export do
|
12
|
-
sh "rm -fr #{export}"
|
13
|
-
sh "mkdir -p #{export}"
|
14
|
-
|
15
|
-
# minimum
|
16
|
-
sh "cp -a out/#{version}/active_support.rbs #{export}"
|
17
|
-
sh "cp -a out/#{version}/active_support #{export}"
|
18
|
-
sh "rm #{export}/active_support/railtie.rbs"
|
19
|
-
|
20
|
-
# core_ext
|
21
|
-
%w[
|
22
|
-
array benchmark big_decimal class date date_and_time date_time digest
|
23
|
-
enumerable file hash integer kernel load_error marshal module name_error numeric
|
24
|
-
object pathname range regexp securerandom string symbol time uri
|
25
|
-
].each do |lib|
|
26
|
-
out = "out/#{version}/#{lib}"
|
27
|
-
sh "cp -a #{out} #{export}" if File.exist?(out)
|
28
|
-
sh "cp -a #{out}.rbs #{export}" if File.exist?("#{out}.rbs")
|
29
|
-
end
|
30
|
-
|
31
|
-
# 5.2
|
32
|
-
sh "cp -a out/#{version}/logger_silence.rbs #{export}" if File.exist?("out/#{version}/logger_silence.rbs")
|
33
|
-
|
34
|
-
Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
|
35
|
-
# !!! GENERATED CODE !!!
|
36
|
-
# Please see generators/rails-generator
|
37
|
-
|
38
|
-
module DRb
|
39
|
-
module DRbUndumped
|
40
|
-
end
|
41
|
-
end
|
42
|
-
module Concurrent
|
43
|
-
class Map
|
44
|
-
end
|
45
|
-
end
|
46
|
-
RBS
|
47
|
-
|
48
|
-
case version
|
49
|
-
when "6.0", "6.1"
|
50
|
-
sh "rm -fr #{export}/uri"
|
51
|
-
when "7.0"
|
52
|
-
# deprecated
|
53
|
-
sh "rm -fr #{export}/uri{,.rbs}"
|
54
|
-
end
|
55
|
-
|
56
|
-
generate_manifest(
|
57
|
-
export: export,
|
58
|
-
stdlib_dependencies: stdlib_dependencies
|
59
|
-
)
|
60
|
-
generate_test_script(
|
61
|
-
gem: :activesupport,
|
62
|
-
version: version,
|
63
|
-
export: export,
|
64
|
-
stdlib_dependencies: stdlib_dependencies,
|
65
|
-
gem_dependencies: gem_dependencies,
|
66
|
-
rails_dependencies: rails_dependencies,
|
67
|
-
)
|
68
|
-
|
69
|
-
Pathname(export).join('_test').join('test.rb').write(<<~'RUBY')
|
70
|
-
# !!! GENERATED CODE !!!
|
71
|
-
# Please see generators/rails-generator
|
72
|
-
|
73
|
-
require 'active_support/all'
|
74
|
-
|
75
|
-
# Test ActiveSupport::NumericWithFormat
|
76
|
-
42.to_s
|
77
|
-
42.to_s(:phone)
|
78
|
-
|
79
|
-
3.days.ago + 1.minute
|
80
|
-
RUBY
|
81
|
-
end
|
82
|
-
|
83
|
-
desc "validate version=#{version} gem=active_support"
|
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/activesupport/#{version}"
|
92
|
-
task :install do
|
93
|
-
install_to = File.expand_path("../../../gems/activesupport/#{version}", __dir__)
|
94
|
-
sh "rm -fr #{install_to}"
|
95
|
-
sh "cp -a #{export} #{install_to}"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,34 +0,0 @@
|
|
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
|
-
sh "cp -a out/#{version}/railties_mixin #{export}"
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "validate version=#{version} gem=railties"
|
19
|
-
task :validate do
|
20
|
-
stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
|
21
|
-
gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
|
22
|
-
rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
|
23
|
-
sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "install to ../../../gems/railties/#{version}"
|
27
|
-
task :install do
|
28
|
-
install_to = File.expand_path("../../../gems/railties/#{version}", __dir__)
|
29
|
-
sh "rm -fr #{install_to}"
|
30
|
-
sh "cp -a #{export} #{install_to}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/orthoses-rails.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/orthoses/rails/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "orthoses-rails"
|
7
|
-
spec.version = Orthoses::Rails::VERSION
|
8
|
-
spec.authors = ["ksss"]
|
9
|
-
spec.email = ["co000ri@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary = "Orthoses middleware collection for Ruby on Rails"
|
12
|
-
spec.description = "Orthoses middleware collection for Ruby on Rails"
|
13
|
-
spec.homepage = "https://github.com/ksss/orthoses-rails"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
-
spec.metadata["changelog_uri"] = spec.homepage
|
20
|
-
|
21
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
-
next true if (f == __FILE__)
|
24
|
-
next true if f.match?(%r{\A(?:bin|known_sig)/}) # dir
|
25
|
-
next true if f.match?(%r{\A\.(?:git)}) # git
|
26
|
-
next true if f.match?(%r{\A(?:rbs_collection|Steepfile|Rakefile|Gemfile)}) # top file
|
27
|
-
next true if f.match?(%r{_test\.rb\z}) # test
|
28
|
-
false
|
29
|
-
end
|
30
|
-
end
|
31
|
-
spec.bindir = "exe"
|
32
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
-
spec.require_paths = ["lib"]
|
34
|
-
|
35
|
-
spec.add_dependency "orthoses", "~> 1.0"
|
36
|
-
end
|