tapioca 0.17.3 → 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 +10 -7
- data/lib/tapioca/bundler_ext/auto_require_hook.rb +1 -4
- data/lib/tapioca/cli.rb +3 -3
- data/lib/tapioca/commands/abstract_dsl.rb +3 -4
- data/lib/tapioca/commands/abstract_gem.rb +2 -3
- data/lib/tapioca/commands/annotations.rb +2 -2
- data/lib/tapioca/commands/check_shims.rb +2 -2
- data/lib/tapioca/commands/command.rb +4 -6
- data/lib/tapioca/commands/command_without_tracker.rb +1 -4
- data/lib/tapioca/commands/gem_generate.rb +1 -1
- data/lib/tapioca/dsl/compiler.rb +8 -10
- data/lib/tapioca/dsl/compilers/aasm.rb +1 -2
- data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -2
- data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -2
- data/lib/tapioca/dsl/compilers/action_text.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_job.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +1 -4
- data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +1 -10
- data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_columns.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +2 -3
- data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +63 -91
- data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_resource.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_storage.rb +1 -9
- data/lib/tapioca/dsl/compilers/active_support_concern.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -2
- data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +1 -2
- data/lib/tapioca/dsl/compilers/config.rb +1 -2
- data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -2
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -2
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -2
- data/lib/tapioca/dsl/compilers/identity_cache.rb +1 -2
- data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +1 -2
- data/lib/tapioca/dsl/compilers/kredis.rb +1 -4
- data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +1 -2
- data/lib/tapioca/dsl/compilers/protobuf.rb +1 -2
- data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -2
- data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -2
- data/lib/tapioca/dsl/compilers/smart_properties.rb +21 -18
- data/lib/tapioca/dsl/compilers/state_machines.rb +1 -2
- data/lib/tapioca/dsl/compilers/url_helpers.rb +1 -2
- data/lib/tapioca/dsl/pipeline.rb +2 -2
- data/lib/tapioca/gem/events.rb +2 -6
- data/lib/tapioca/gem/listeners/base.rb +1 -4
- data/lib/tapioca/helpers/cli_helper.rb +1 -4
- data/lib/tapioca/helpers/config_helper.rb +2 -5
- data/lib/tapioca/helpers/env_helper.rb +1 -4
- data/lib/tapioca/helpers/rbi_files_helper.rb +3 -6
- data/lib/tapioca/helpers/test/content.rb +1 -4
- data/lib/tapioca/helpers/test/dsl_compiler.rb +1 -4
- data/lib/tapioca/helpers/test/isolation.rb +2 -7
- data/lib/tapioca/helpers/test/template.rb +1 -4
- data/lib/tapioca/loaders/loader.rb +4 -6
- data/lib/tapioca/rbs/rewriter.rb +1 -1
- data/lib/tapioca/repo_index.rb +0 -2
- data/lib/tapioca/runtime/attached_class_of_legacy.rb +1 -4
- data/lib/tapioca/runtime/trackers/method_definition.rb +2 -2
- data/lib/tapioca/runtime/trackers/tracker.rb +1 -4
- data/lib/tapioca/sorbet_ext/name_patch.rb +1 -1
- data/lib/tapioca/version.rb +1 -1
- metadata +1 -1
@@ -2,12 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Tapioca
|
5
|
+
# @requires_ancestor: Thor
|
5
6
|
module ConfigHelper
|
6
7
|
extend T::Sig
|
7
|
-
extend T::Helpers
|
8
|
-
|
9
|
-
requires_ancestor { Thor }
|
10
|
-
|
11
8
|
#: String
|
12
9
|
attr_reader :command_name
|
13
10
|
|
@@ -86,7 +83,7 @@ module Tapioca
|
|
86
83
|
end.compact
|
87
84
|
|
88
85
|
unless errors.empty?
|
89
|
-
raise
|
86
|
+
raise Tapioca::Error, build_error_message(config_file, errors)
|
90
87
|
end
|
91
88
|
ensure
|
92
89
|
@validating_config = false
|
@@ -2,12 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Tapioca
|
5
|
+
# @requires_ancestor: Thor
|
5
6
|
module EnvHelper
|
6
7
|
extend T::Sig
|
7
|
-
extend T::Helpers
|
8
|
-
|
9
|
-
requires_ancestor { Thor }
|
10
|
-
|
11
8
|
#: (Hash[Symbol, untyped] options) -> void
|
12
9
|
def set_environment(options) # rubocop:disable Naming/AccessorMethodName
|
13
10
|
ENV["RAILS_ENV"] = ENV["RACK_ENV"] = options[:environment]
|
@@ -2,13 +2,10 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Tapioca
|
5
|
+
# @requires_ancestor: Thor::Shell
|
6
|
+
# @requires_ancestor: SorbetHelper
|
5
7
|
module RBIFilesHelper
|
6
8
|
extend T::Sig
|
7
|
-
extend T::Helpers
|
8
|
-
|
9
|
-
requires_ancestor { Thor::Shell }
|
10
|
-
requires_ancestor { SorbetHelper }
|
11
|
-
|
12
9
|
#: (RBI::Index index, String kind, String file) -> void
|
13
10
|
def index_rbi(index, kind, file)
|
14
11
|
return unless File.exist?(file)
|
@@ -131,7 +128,7 @@ module Tapioca
|
|
131
128
|
update_gem_rbis_strictnesses(redef_errors, gem_dir)
|
132
129
|
end
|
133
130
|
|
134
|
-
Kernel.raise
|
131
|
+
Kernel.raise Tapioca::Error, error_messages.join("\n") if parse_errors.any?
|
135
132
|
end
|
136
133
|
|
137
134
|
private
|
@@ -10,16 +10,13 @@ require "tapioca/helpers/sorbet_helper"
|
|
10
10
|
module Tapioca
|
11
11
|
module Helpers
|
12
12
|
module Test
|
13
|
+
# @requires_ancestor: Kernel
|
13
14
|
module DslCompiler
|
14
15
|
extend T::Sig
|
15
|
-
extend T::Helpers
|
16
|
-
|
17
16
|
include Isolation
|
18
17
|
include Content
|
19
18
|
include Template
|
20
19
|
|
21
|
-
requires_ancestor { Kernel }
|
22
|
-
|
23
20
|
#: (singleton(Tapioca::Dsl::Compiler) compiler_class) -> void
|
24
21
|
def use_dsl_compiler(compiler_class)
|
25
22
|
@context = CompilerContext.new(compiler_class) #: CompilerContext?
|
@@ -28,12 +28,9 @@ module Tapioca
|
|
28
28
|
Marshal.load(serialized)
|
29
29
|
end
|
30
30
|
|
31
|
+
# @requires_ancestor: Kernel
|
31
32
|
module Forking
|
32
33
|
extend T::Sig
|
33
|
-
extend T::Helpers
|
34
|
-
|
35
|
-
requires_ancestor { Kernel }
|
36
|
-
|
37
34
|
#: ?{ (?) -> untyped } -> String
|
38
35
|
def run_in_isolation(&_blk)
|
39
36
|
read, write = IO.pipe
|
@@ -73,11 +70,9 @@ module Tapioca
|
|
73
70
|
end
|
74
71
|
end
|
75
72
|
|
73
|
+
# @requires_ancestor: Kernel
|
76
74
|
module Subprocess
|
77
75
|
extend T::Sig
|
78
|
-
extend T::Helpers
|
79
|
-
|
80
|
-
requires_ancestor { Kernel }
|
81
76
|
|
82
77
|
ORIG_ARGV = ARGV.dup #: Array[String]
|
83
78
|
|
@@ -4,12 +4,9 @@
|
|
4
4
|
module Tapioca
|
5
5
|
module Helpers
|
6
6
|
module Test
|
7
|
+
# @requires_ancestor: Kernel
|
7
8
|
module Template
|
8
9
|
extend T::Sig
|
9
|
-
extend T::Helpers
|
10
|
-
|
11
|
-
requires_ancestor { Kernel }
|
12
|
-
|
13
10
|
ERB_SUPPORTS_KVARGS = ::ERB.instance_method(:initialize).parameters.assoc(:key) #: [Symbol, Symbol]?
|
14
11
|
|
15
12
|
#: (String selector) -> bool
|
@@ -3,18 +3,16 @@
|
|
3
3
|
|
4
4
|
module Tapioca
|
5
5
|
module Loaders
|
6
|
+
# @abstract
|
6
7
|
class Loader
|
7
8
|
extend T::Sig
|
8
|
-
extend T::Helpers
|
9
|
-
|
10
9
|
include Thor::Base
|
11
10
|
include CliHelper
|
12
11
|
include Tapioca::GemHelper
|
13
12
|
|
14
|
-
abstract
|
15
|
-
|
16
|
-
|
17
|
-
def load; end
|
13
|
+
# @abstract
|
14
|
+
#: -> void
|
15
|
+
def load = raise NotImplementedError, "Abstract method called"
|
18
16
|
|
19
17
|
private
|
20
18
|
|
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)/
|
data/lib/tapioca/repo_index.rb
CHANGED
@@ -7,12 +7,9 @@ module Tapioca
|
|
7
7
|
# older than 3.2. Because the Class#attached_object method is not
|
8
8
|
# available, it implements finding the attached class of a singleton
|
9
9
|
# class by iterating through ObjectSpace.
|
10
|
+
# @requires_ancestor: Tapioca::Runtime::Reflection
|
10
11
|
module AttachedClassOf
|
11
12
|
extend T::Sig
|
12
|
-
extend T::Helpers
|
13
|
-
|
14
|
-
requires_ancestor { Tapioca::Runtime::Reflection }
|
15
|
-
|
16
13
|
#: (Class singleton_class) -> Module?
|
17
14
|
def attached_class_of(singleton_class)
|
18
15
|
# https://stackoverflow.com/a/36622320/98634
|
@@ -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