tapioca 0.2.8 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +25 -1
- data/README.md +23 -2
- data/Rakefile +15 -4
- data/lib/tapioca.rb +15 -9
- data/lib/tapioca/cli.rb +41 -12
- data/lib/tapioca/compilers/dsl/action_controller_helpers.rb +129 -0
- data/lib/tapioca/compilers/dsl/action_mailer.rb +65 -0
- data/lib/tapioca/compilers/dsl/active_record_associations.rb +285 -0
- data/lib/tapioca/compilers/dsl/active_record_columns.rb +387 -0
- data/lib/tapioca/compilers/dsl/active_record_enum.rb +112 -0
- data/lib/tapioca/compilers/dsl/active_record_identity_cache.rb +213 -0
- data/lib/tapioca/compilers/dsl/active_record_scope.rb +100 -0
- data/lib/tapioca/compilers/dsl/active_record_typed_store.rb +170 -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 +83 -0
- data/lib/tapioca/compilers/dsl_compiler.rb +121 -0
- data/lib/tapioca/compilers/requires_compiler.rb +67 -0
- data/lib/tapioca/compilers/sorbet.rb +34 -0
- data/lib/tapioca/compilers/symbol_table/symbol_generator.rb +210 -50
- data/lib/tapioca/compilers/symbol_table/symbol_loader.rb +3 -17
- data/lib/tapioca/compilers/todos_compiler.rb +32 -0
- data/lib/tapioca/config.rb +42 -0
- data/lib/tapioca/config_builder.rb +75 -0
- data/lib/tapioca/constant_locator.rb +1 -0
- data/lib/tapioca/core_ext/class.rb +23 -0
- data/lib/tapioca/gemfile.rb +44 -9
- data/lib/tapioca/generator.rb +248 -70
- data/lib/tapioca/loader.rb +20 -9
- data/lib/tapioca/sorbet_config_parser.rb +77 -0
- data/lib/tapioca/version.rb +1 -1
- metadata +33 -51
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,8 @@ module Tapioca
|
|
80
98
|
end
|
81
99
|
|
82
100
|
sig { void }
|
83
|
-
def
|
84
|
-
|
85
|
-
|
86
|
-
safe_require("rails")
|
87
|
-
|
88
|
-
silence_deprecations
|
89
|
-
|
90
|
-
safe_require("rails/generators/test_case")
|
91
|
-
safe_require("./config/application")
|
101
|
+
def eager_load_rails_app
|
102
|
+
Object.const_get("Rails").autoloaders.each(&:eager_load)
|
92
103
|
end
|
93
104
|
|
94
105
|
sig { void }
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Tapioca
|
5
|
+
class SorbetConfig
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
sig { returns(T::Array[String]) }
|
9
|
+
attr_reader :paths, :ignore
|
10
|
+
|
11
|
+
sig { void }
|
12
|
+
def initialize
|
13
|
+
@paths = T.let([], T::Array[String])
|
14
|
+
@ignore = T.let([], T::Array[String])
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
extend T::Sig
|
19
|
+
|
20
|
+
sig { params(sorbet_config_path: String).returns(SorbetConfig) }
|
21
|
+
def parse_file(sorbet_config_path)
|
22
|
+
parse_string(File.read(sorbet_config_path))
|
23
|
+
end
|
24
|
+
|
25
|
+
sig { params(sorbet_config: String).returns(SorbetConfig) }
|
26
|
+
def parse_string(sorbet_config)
|
27
|
+
config = SorbetConfig.new
|
28
|
+
ignore = T.let(false, T::Boolean)
|
29
|
+
skip = T.let(false, T::Boolean)
|
30
|
+
sorbet_config.each_line do |line|
|
31
|
+
line = line.strip
|
32
|
+
case line
|
33
|
+
when /^--ignore$/
|
34
|
+
ignore = true
|
35
|
+
next
|
36
|
+
when /^--ignore=/
|
37
|
+
config.ignore << parse_option(line)
|
38
|
+
next
|
39
|
+
when /^--file$/
|
40
|
+
next
|
41
|
+
when /^--file=/
|
42
|
+
config.paths << parse_option(line)
|
43
|
+
next
|
44
|
+
when /^--dir$/
|
45
|
+
next
|
46
|
+
when /^--dir=/
|
47
|
+
config.paths << parse_option(line)
|
48
|
+
next
|
49
|
+
when /^--.*=/
|
50
|
+
next
|
51
|
+
when /^--/
|
52
|
+
skip = true
|
53
|
+
when /^-.*=?/
|
54
|
+
next
|
55
|
+
else
|
56
|
+
if ignore
|
57
|
+
config.ignore << line
|
58
|
+
ignore = false
|
59
|
+
elsif skip
|
60
|
+
skip = false
|
61
|
+
else
|
62
|
+
config.paths << line
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
config
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
sig { params(line: String).returns(String) }
|
72
|
+
def parse_option(line)
|
73
|
+
T.must(line.split("=").last).strip
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
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.2
|
4
|
+
version: 0.4.2
|
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-08-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: pry
|
@@ -56,75 +56,33 @@ 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'
|
71
|
+
version: 2.1.0
|
86
72
|
- !ruby/object:Gem::Dependency
|
87
|
-
name:
|
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'
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: rspec
|
102
|
-
requirement: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: '0'
|
107
|
-
type: :development
|
108
|
-
prerelease: false
|
109
|
-
version_requirements: !ruby/object:Gem::Requirement
|
110
|
-
requirements:
|
111
|
-
- - ">="
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '0'
|
114
|
-
- !ruby/object:Gem::Dependency
|
115
|
-
name: sorbet
|
73
|
+
name: thor
|
116
74
|
requirement: !ruby/object:Gem::Requirement
|
117
75
|
requirements:
|
118
76
|
- - ">="
|
119
77
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
121
|
-
type: :
|
78
|
+
version: 0.19.2
|
79
|
+
type: :runtime
|
122
80
|
prerelease: false
|
123
81
|
version_requirements: !ruby/object:Gem::Requirement
|
124
82
|
requirements:
|
125
83
|
- - ">="
|
126
84
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
85
|
+
version: 0.19.2
|
128
86
|
description:
|
129
87
|
email:
|
130
88
|
- ruby@shopify.com
|
@@ -139,13 +97,37 @@ files:
|
|
139
97
|
- exe/tapioca
|
140
98
|
- lib/tapioca.rb
|
141
99
|
- lib/tapioca/cli.rb
|
100
|
+
- lib/tapioca/compilers/dsl/action_controller_helpers.rb
|
101
|
+
- lib/tapioca/compilers/dsl/action_mailer.rb
|
102
|
+
- lib/tapioca/compilers/dsl/active_record_associations.rb
|
103
|
+
- lib/tapioca/compilers/dsl/active_record_columns.rb
|
104
|
+
- lib/tapioca/compilers/dsl/active_record_enum.rb
|
105
|
+
- lib/tapioca/compilers/dsl/active_record_identity_cache.rb
|
106
|
+
- lib/tapioca/compilers/dsl/active_record_scope.rb
|
107
|
+
- lib/tapioca/compilers/dsl/active_record_typed_store.rb
|
108
|
+
- lib/tapioca/compilers/dsl/active_resource.rb
|
109
|
+
- lib/tapioca/compilers/dsl/active_support_current_attributes.rb
|
110
|
+
- lib/tapioca/compilers/dsl/base.rb
|
111
|
+
- lib/tapioca/compilers/dsl/frozen_record.rb
|
112
|
+
- lib/tapioca/compilers/dsl/protobuf.rb
|
113
|
+
- lib/tapioca/compilers/dsl/smart_properties.rb
|
114
|
+
- lib/tapioca/compilers/dsl/state_machines.rb
|
115
|
+
- lib/tapioca/compilers/dsl/url_helpers.rb
|
116
|
+
- lib/tapioca/compilers/dsl_compiler.rb
|
117
|
+
- lib/tapioca/compilers/requires_compiler.rb
|
118
|
+
- lib/tapioca/compilers/sorbet.rb
|
142
119
|
- lib/tapioca/compilers/symbol_table/symbol_generator.rb
|
143
120
|
- lib/tapioca/compilers/symbol_table/symbol_loader.rb
|
144
121
|
- lib/tapioca/compilers/symbol_table_compiler.rb
|
122
|
+
- lib/tapioca/compilers/todos_compiler.rb
|
123
|
+
- lib/tapioca/config.rb
|
124
|
+
- lib/tapioca/config_builder.rb
|
145
125
|
- lib/tapioca/constant_locator.rb
|
126
|
+
- lib/tapioca/core_ext/class.rb
|
146
127
|
- lib/tapioca/gemfile.rb
|
147
128
|
- lib/tapioca/generator.rb
|
148
129
|
- lib/tapioca/loader.rb
|
130
|
+
- lib/tapioca/sorbet_config_parser.rb
|
149
131
|
- lib/tapioca/version.rb
|
150
132
|
homepage: https://github.com/Shopify/tapioca
|
151
133
|
licenses:
|