tapioca 0.17.5 → 0.17.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/tapioca +6 -1
- data/lib/ruby_lsp/tapioca/addon.rb +1 -1
- data/lib/ruby_lsp/tapioca/server_addon.rb +1 -0
- data/lib/tapioca/cli.rb +1 -1
- data/lib/tapioca/commands/abstract_dsl.rb +2 -2
- data/lib/tapioca/commands/abstract_gem.rb +1 -1
- data/lib/tapioca/commands/annotations.rb +1 -1
- data/lib/tapioca/commands/check_shims.rb +2 -2
- data/lib/tapioca/commands/gem_generate.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +9 -1
- data/lib/tapioca/dsl/pipeline.rb +2 -2
- data/lib/tapioca/helpers/config_helper.rb +1 -1
- data/lib/tapioca/helpers/rbi_files_helper.rb +1 -1
- data/lib/tapioca/rbs/rewriter.rb +1 -1
- data/lib/tapioca/runtime/trackers/method_definition.rb +2 -2
- data/lib/tapioca/sorbet_ext/name_patch.rb +1 -1
- data/lib/tapioca/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d003e839857cc260e7b1ab86fd4a48d93efc53e4a43ac9ccac6c85d9a89e63a1
|
4
|
+
data.tar.gz: 900f2d0369802b0fac34f60c04e3c238cd68e439c1d6d60f4b9ed5d8c82770f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2f68a283b2499203877730fb5f981ed1e6c09c686a6c3e59297bea18361b5dd2d1831581f7b3edce6cf38936819544feeeebe59b1747520738542b0ae606ffe
|
7
|
+
data.tar.gz: '09769a8ab2aac1763cadecd013c9979c58d750c052f94c26eccfcbbd0a7ca07e0cb027c18e3737e90b90e85d4bebfca2fb4e8e559fdd9c4a0dd472ce5e59ee77'
|
data/exe/tapioca
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.
|
4
|
+
RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.27")
|
5
5
|
|
6
6
|
begin
|
7
7
|
# The Tapioca add-on depends on the Rails add-on to add a runtime component to the runtime server. We can allow the
|
@@ -20,6 +20,7 @@ module RubyLsp
|
|
20
20
|
# Load DSL extensions and compilers ahead of time, so that we don't have to pay the price of invoking
|
21
21
|
# `Gem.find_files` on every execution, which is quite expensive
|
22
22
|
with_notification_wrapper("load_compilers_and_extensions", "Loading DSL compilers") do
|
23
|
+
::Tapioca::Dsl::Compiler.extend(T::Generic)
|
23
24
|
@loader = ::Tapioca::Loaders::Dsl.new(
|
24
25
|
tapioca_path: ::Tapioca::TAPIOCA_DIR,
|
25
26
|
eager_load: false,
|
data/lib/tapioca/cli.rb
CHANGED
@@ -353,7 +353,7 @@ module Tapioca
|
|
353
353
|
default: {}
|
354
354
|
def annotations
|
355
355
|
if !options[:netrc] && options[:netrc_file]
|
356
|
-
raise
|
356
|
+
raise Tapioca::Error, set_color("Options `--no-netrc` and `--netrc-file` can't be used together", :bold, :red)
|
357
357
|
end
|
358
358
|
|
359
359
|
command = Commands::Annotations.new(
|
@@ -160,7 +160,7 @@ module Tapioca
|
|
160
160
|
remove_file(filename) if File.file?(filename)
|
161
161
|
end
|
162
162
|
|
163
|
-
raise
|
163
|
+
raise Tapioca::Error, ""
|
164
164
|
end
|
165
165
|
|
166
166
|
processable_constants
|
@@ -295,7 +295,7 @@ module Tapioca
|
|
295
295
|
build_error_for_files(cause, diff_for_cause.map(&:first))
|
296
296
|
end.join("\n")
|
297
297
|
|
298
|
-
raise
|
298
|
+
raise Tapioca::Error, <<~ERROR
|
299
299
|
#{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
|
300
300
|
#{set_color("`#{default_command(command)}`", :green, :bold)}
|
301
301
|
#{set_color("Once it is complete, be sure to commit and push any changes", :green)}
|
@@ -201,7 +201,7 @@ module Tapioca
|
|
201
201
|
build_error_for_files(cause, diff_for_cause.map(&:first))
|
202
202
|
end.join("\n")
|
203
203
|
|
204
|
-
raise
|
204
|
+
raise Tapioca::Error, <<~ERROR
|
205
205
|
#{set_color("RBI files are out-of-date. In your development environment, please run:", :green)}
|
206
206
|
#{set_color("`#{default_command(command)}`", :green, :bold)}
|
207
207
|
#{set_color("Once it is complete, be sure to commit and push any changes", :green)}
|
@@ -85,7 +85,7 @@ module Tapioca
|
|
85
85
|
end
|
86
86
|
|
87
87
|
if indexes.empty?
|
88
|
-
raise
|
88
|
+
raise Tapioca::Error, set_color("Can't fetch annotations without sources (no index fetched)", :bold, :red)
|
89
89
|
end
|
90
90
|
|
91
91
|
indexes
|
@@ -49,7 +49,7 @@ module Tapioca
|
|
49
49
|
result = sorbet("--no-config --print=payload-sources:#{payload_path}")
|
50
50
|
|
51
51
|
unless result.status
|
52
|
-
raise
|
52
|
+
raise Tapioca::Error, <<~ERROR
|
53
53
|
"Sorbet failed to dump payload"
|
54
54
|
#{result.err}
|
55
55
|
ERROR
|
@@ -87,7 +87,7 @@ module Tapioca
|
|
87
87
|
"\nPlease remove the duplicated definitions from #{@shim_rbi_dir} and #{@todo_rbi_file}", :red
|
88
88
|
)
|
89
89
|
|
90
|
-
raise
|
90
|
+
raise Tapioca::Error, messages.join("\n")
|
91
91
|
end
|
92
92
|
|
93
93
|
say("\nNo duplicates found in shim RBIs", :green)
|
@@ -58,7 +58,7 @@ module Tapioca
|
|
58
58
|
if gem.nil?
|
59
59
|
next if @lsp_addon
|
60
60
|
|
61
|
-
raise
|
61
|
+
raise Tapioca::Error, set_color("Error: Cannot find gem '#{gem_name}'", :red)
|
62
62
|
end
|
63
63
|
|
64
64
|
gems.concat(gem_dependencies(gem)) if @include_dependencies
|
@@ -116,7 +116,7 @@ module Tapioca
|
|
116
116
|
mod.create_method(
|
117
117
|
"build_#{role}",
|
118
118
|
parameters: [create_rest_param("args", type: "T.untyped")],
|
119
|
-
return_type: "T.any(#{types.join(", ")})",
|
119
|
+
return_type: types.size == 1 ? types.first : "T.any(#{types.join(", ")})",
|
120
120
|
)
|
121
121
|
end
|
122
122
|
|
@@ -836,7 +836,15 @@ module Tapioca
|
|
836
836
|
end
|
837
837
|
end
|
838
838
|
when :ids
|
839
|
-
|
839
|
+
if constant.table_exists?
|
840
|
+
primary_key_type = constant.type_for_attribute(constant.primary_key)
|
841
|
+
type = Tapioca::Dsl::Helpers::ActiveModelTypeHelper.type_for(primary_key_type)
|
842
|
+
type = RBIHelper.as_non_nilable_type(type)
|
843
|
+
create_common_method("ids", return_type: "T::Array[#{type}]")
|
844
|
+
else
|
845
|
+
create_common_method("ids", return_type: "Array")
|
846
|
+
end
|
847
|
+
|
840
848
|
when :pick, :pluck
|
841
849
|
create_common_method(
|
842
850
|
method_name,
|
data/lib/tapioca/dsl/pipeline.rb
CHANGED
@@ -60,7 +60,7 @@ module Tapioca
|
|
60
60
|
No classes/modules can be matched for RBI generation.
|
61
61
|
Please check that the requested classes/modules include processable DSL methods.
|
62
62
|
ERROR
|
63
|
-
raise
|
63
|
+
raise Tapioca::Error, ""
|
64
64
|
end
|
65
65
|
|
66
66
|
if defined?(::ActiveRecord::Base) && constants_to_process.any? { |c| ::ActiveRecord::Base > c }
|
@@ -82,7 +82,7 @@ module Tapioca
|
|
82
82
|
report_error(msg)
|
83
83
|
end
|
84
84
|
|
85
|
-
raise
|
85
|
+
raise Tapioca::Error, ""
|
86
86
|
end
|
87
87
|
|
88
88
|
result.compact
|
@@ -128,7 +128,7 @@ module Tapioca
|
|
128
128
|
update_gem_rbis_strictnesses(redef_errors, gem_dir)
|
129
129
|
end
|
130
130
|
|
131
|
-
Kernel.raise
|
131
|
+
Kernel.raise Tapioca::Error, error_messages.join("\n") if parse_errors.any?
|
132
132
|
end
|
133
133
|
|
134
134
|
private
|
data/lib/tapioca/rbs/rewriter.rb
CHANGED
@@ -43,7 +43,7 @@ Module.include(T::Sig)
|
|
43
43
|
# Trigger the source transformation for each Ruby file being loaded.
|
44
44
|
RequireHooks.source_transform(patterns: ["**/*.rb"]) do |path, source|
|
45
45
|
# The source is most likely nil since no `source_transform` hook was triggered before this one.
|
46
|
-
source ||= File.read(path)
|
46
|
+
source ||= File.read(path, encoding: "UTF-8")
|
47
47
|
|
48
48
|
# For performance reasons, we only rewrite files that use Sorbet.
|
49
49
|
if source =~ /^\s*#\s*typed: (ignore|false|true|strict|strong|__STDLIB_INTERNAL)/
|
@@ -53,12 +53,12 @@ end
|
|
53
53
|
class Module
|
54
54
|
prepend(Module.new do
|
55
55
|
def singleton_method_added(method_name)
|
56
|
-
Tapioca::Runtime::Trackers::MethodDefinition.register(method_name, singleton_class, caller_locations)
|
56
|
+
Tapioca::Runtime::Trackers::MethodDefinition.register(method_name, singleton_class, Kernel.caller_locations)
|
57
57
|
super
|
58
58
|
end
|
59
59
|
|
60
60
|
def method_added(method_name)
|
61
|
-
Tapioca::Runtime::Trackers::MethodDefinition.register(method_name, self, caller_locations)
|
61
|
+
Tapioca::Runtime::Trackers::MethodDefinition.register(method_name, self, Kernel.caller_locations)
|
62
62
|
super
|
63
63
|
end
|
64
64
|
end)
|
data/lib/tapioca/version.rb
CHANGED