tapioca 0.4.0 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +26 -1
- data/README.md +16 -0
- data/Rakefile +16 -4
- data/lib/tapioca.rb +6 -2
- data/lib/tapioca/cli.rb +25 -3
- data/lib/tapioca/compilers/dsl/action_controller_helpers.rb +130 -0
- data/lib/tapioca/compilers/dsl/action_mailer.rb +65 -0
- data/lib/tapioca/compilers/dsl/active_record_associations.rb +267 -0
- data/lib/tapioca/compilers/dsl/active_record_columns.rb +404 -0
- data/lib/tapioca/compilers/dsl/active_record_enum.rb +112 -0
- data/lib/tapioca/compilers/dsl/active_record_identity_cache.rb +212 -0
- data/lib/tapioca/compilers/dsl/active_record_scope.rb +100 -0
- data/lib/tapioca/compilers/dsl/active_record_typed_store.rb +168 -0
- data/lib/tapioca/compilers/dsl/active_resource.rb +140 -0
- data/lib/tapioca/compilers/dsl/active_support_current_attributes.rb +126 -0
- data/lib/tapioca/compilers/dsl/base.rb +165 -0
- data/lib/tapioca/compilers/dsl/frozen_record.rb +96 -0
- data/lib/tapioca/compilers/dsl/protobuf.rb +144 -0
- data/lib/tapioca/compilers/dsl/smart_properties.rb +173 -0
- data/lib/tapioca/compilers/dsl/state_machines.rb +378 -0
- data/lib/tapioca/compilers/dsl/url_helpers.rb +160 -0
- data/lib/tapioca/compilers/dsl_compiler.rb +121 -0
- data/lib/tapioca/compilers/requires_compiler.rb +67 -0
- data/lib/tapioca/compilers/symbol_table/symbol_generator.rb +195 -32
- data/lib/tapioca/config.rb +11 -6
- data/lib/tapioca/config_builder.rb +19 -9
- data/lib/tapioca/constant_locator.rb +1 -0
- data/lib/tapioca/core_ext/class.rb +23 -0
- data/lib/tapioca/gemfile.rb +32 -9
- data/lib/tapioca/generator.rb +200 -24
- data/lib/tapioca/loader.rb +30 -9
- data/lib/tapioca/version.rb +1 -1
- metadata +31 -40
data/lib/tapioca/loader.rb
CHANGED
@@ -24,6 +24,24 @@ module Tapioca
|
|
24
24
|
load_rails_engines
|
25
25
|
end
|
26
26
|
|
27
|
+
sig { params(environment_load: T::Boolean, eager_load: T::Boolean).void }
|
28
|
+
def load_rails(environment_load: false, eager_load: false)
|
29
|
+
return unless File.exist?("config/application.rb")
|
30
|
+
|
31
|
+
safe_require("rails")
|
32
|
+
|
33
|
+
silence_deprecations
|
34
|
+
|
35
|
+
safe_require("rails/generators/test_case")
|
36
|
+
if environment_load
|
37
|
+
safe_require("./config/environment")
|
38
|
+
else
|
39
|
+
safe_require("./config/application")
|
40
|
+
end
|
41
|
+
|
42
|
+
eager_load_rails_app if eager_load
|
43
|
+
end
|
44
|
+
|
27
45
|
private
|
28
46
|
|
29
47
|
sig { returns(Tapioca::Gemfile) }
|
@@ -80,15 +98,18 @@ module Tapioca
|
|
80
98
|
end
|
81
99
|
|
82
100
|
sig { void }
|
83
|
-
def
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
101
|
+
def eager_load_rails_app
|
102
|
+
if Object.const_defined?("ActiveSupport")
|
103
|
+
Object.const_get("ActiveSupport").run_load_hooks(
|
104
|
+
:before_eager_load,
|
105
|
+
Object.const_get("Rails").application
|
106
|
+
)
|
107
|
+
end
|
108
|
+
if Object.const_defined?("Zeitwerk::Loader")
|
109
|
+
zeitwerk_loader = Object.const_get("Zeitwerk::Loader")
|
110
|
+
zeitwerk_loader.eager_load_all
|
111
|
+
end
|
112
|
+
Object.const_get("Rails").autoloaders.each(&:eager_load)
|
92
113
|
end
|
93
114
|
|
94
115
|
sig { void }
|
data/lib/tapioca/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapioca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ufuk Kayserilioglu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: pry
|
@@ -56,55 +56,27 @@ dependencies:
|
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
59
|
+
name: parlour
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: 2.1.0
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: bundler
|
74
|
-
requirement: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - "~>"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '1.17'
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - "~>"
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '1.17'
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: pry-byebug
|
88
|
-
requirement: !ruby/object:Gem::Requirement
|
89
|
-
requirements:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '0'
|
93
|
-
type: :development
|
94
|
-
prerelease: false
|
95
|
-
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '0'
|
71
|
+
version: 2.1.0
|
100
72
|
- !ruby/object:Gem::Dependency
|
101
|
-
name:
|
73
|
+
name: spoom
|
102
74
|
requirement: !ruby/object:Gem::Requirement
|
103
75
|
requirements:
|
104
76
|
- - ">="
|
105
77
|
- !ruby/object:Gem::Version
|
106
78
|
version: '0'
|
107
|
-
type: :
|
79
|
+
type: :runtime
|
108
80
|
prerelease: false
|
109
81
|
version_requirements: !ruby/object:Gem::Requirement
|
110
82
|
requirements:
|
@@ -112,19 +84,19 @@ dependencies:
|
|
112
84
|
- !ruby/object:Gem::Version
|
113
85
|
version: '0'
|
114
86
|
- !ruby/object:Gem::Dependency
|
115
|
-
name:
|
87
|
+
name: thor
|
116
88
|
requirement: !ruby/object:Gem::Requirement
|
117
89
|
requirements:
|
118
90
|
- - ">="
|
119
91
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
121
|
-
type: :
|
92
|
+
version: 0.19.2
|
93
|
+
type: :runtime
|
122
94
|
prerelease: false
|
123
95
|
version_requirements: !ruby/object:Gem::Requirement
|
124
96
|
requirements:
|
125
97
|
- - ">="
|
126
98
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
99
|
+
version: 0.19.2
|
128
100
|
description:
|
129
101
|
email:
|
130
102
|
- ruby@shopify.com
|
@@ -139,6 +111,24 @@ files:
|
|
139
111
|
- exe/tapioca
|
140
112
|
- lib/tapioca.rb
|
141
113
|
- lib/tapioca/cli.rb
|
114
|
+
- lib/tapioca/compilers/dsl/action_controller_helpers.rb
|
115
|
+
- lib/tapioca/compilers/dsl/action_mailer.rb
|
116
|
+
- lib/tapioca/compilers/dsl/active_record_associations.rb
|
117
|
+
- lib/tapioca/compilers/dsl/active_record_columns.rb
|
118
|
+
- lib/tapioca/compilers/dsl/active_record_enum.rb
|
119
|
+
- lib/tapioca/compilers/dsl/active_record_identity_cache.rb
|
120
|
+
- lib/tapioca/compilers/dsl/active_record_scope.rb
|
121
|
+
- lib/tapioca/compilers/dsl/active_record_typed_store.rb
|
122
|
+
- lib/tapioca/compilers/dsl/active_resource.rb
|
123
|
+
- lib/tapioca/compilers/dsl/active_support_current_attributes.rb
|
124
|
+
- lib/tapioca/compilers/dsl/base.rb
|
125
|
+
- lib/tapioca/compilers/dsl/frozen_record.rb
|
126
|
+
- lib/tapioca/compilers/dsl/protobuf.rb
|
127
|
+
- lib/tapioca/compilers/dsl/smart_properties.rb
|
128
|
+
- lib/tapioca/compilers/dsl/state_machines.rb
|
129
|
+
- lib/tapioca/compilers/dsl/url_helpers.rb
|
130
|
+
- lib/tapioca/compilers/dsl_compiler.rb
|
131
|
+
- lib/tapioca/compilers/requires_compiler.rb
|
142
132
|
- lib/tapioca/compilers/sorbet.rb
|
143
133
|
- lib/tapioca/compilers/symbol_table/symbol_generator.rb
|
144
134
|
- lib/tapioca/compilers/symbol_table/symbol_loader.rb
|
@@ -147,6 +137,7 @@ files:
|
|
147
137
|
- lib/tapioca/config.rb
|
148
138
|
- lib/tapioca/config_builder.rb
|
149
139
|
- lib/tapioca/constant_locator.rb
|
140
|
+
- lib/tapioca/core_ext/class.rb
|
150
141
|
- lib/tapioca/gemfile.rb
|
151
142
|
- lib/tapioca/generator.rb
|
152
143
|
- lib/tapioca/loader.rb
|
@@ -164,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
155
|
requirements:
|
165
156
|
- - ">="
|
166
157
|
- !ruby/object:Gem::Version
|
167
|
-
version: 2.
|
158
|
+
version: '2.4'
|
168
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
160
|
requirements:
|
170
161
|
- - ">="
|