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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/exe/tapioca +6 -1
  3. data/lib/ruby_lsp/tapioca/addon.rb +1 -1
  4. data/lib/ruby_lsp/tapioca/server_addon.rb +10 -7
  5. data/lib/tapioca/bundler_ext/auto_require_hook.rb +1 -4
  6. data/lib/tapioca/cli.rb +3 -3
  7. data/lib/tapioca/commands/abstract_dsl.rb +3 -4
  8. data/lib/tapioca/commands/abstract_gem.rb +2 -3
  9. data/lib/tapioca/commands/annotations.rb +2 -2
  10. data/lib/tapioca/commands/check_shims.rb +2 -2
  11. data/lib/tapioca/commands/command.rb +4 -6
  12. data/lib/tapioca/commands/command_without_tracker.rb +1 -4
  13. data/lib/tapioca/commands/gem_generate.rb +1 -1
  14. data/lib/tapioca/dsl/compiler.rb +8 -10
  15. data/lib/tapioca/dsl/compilers/aasm.rb +1 -2
  16. data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +1 -2
  17. data/lib/tapioca/dsl/compilers/action_mailer.rb +1 -2
  18. data/lib/tapioca/dsl/compilers/action_text.rb +1 -2
  19. data/lib/tapioca/dsl/compilers/active_job.rb +1 -2
  20. data/lib/tapioca/dsl/compilers/active_model_attributes.rb +1 -4
  21. data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +1 -4
  22. data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +1 -10
  23. data/lib/tapioca/dsl/compilers/active_record_associations.rb +1 -2
  24. data/lib/tapioca/dsl/compilers/active_record_columns.rb +1 -2
  25. data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +2 -3
  26. data/lib/tapioca/dsl/compilers/active_record_enum.rb +1 -2
  27. data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +1 -1
  28. data/lib/tapioca/dsl/compilers/active_record_relations.rb +63 -91
  29. data/lib/tapioca/dsl/compilers/active_record_scope.rb +1 -2
  30. data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +1 -2
  31. data/lib/tapioca/dsl/compilers/active_record_store.rb +1 -2
  32. data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +1 -2
  33. data/lib/tapioca/dsl/compilers/active_resource.rb +1 -2
  34. data/lib/tapioca/dsl/compilers/active_storage.rb +1 -9
  35. data/lib/tapioca/dsl/compilers/active_support_concern.rb +1 -2
  36. data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +1 -2
  37. data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +1 -2
  38. data/lib/tapioca/dsl/compilers/config.rb +1 -2
  39. data/lib/tapioca/dsl/compilers/frozen_record.rb +1 -2
  40. data/lib/tapioca/dsl/compilers/graphql_input_object.rb +1 -2
  41. data/lib/tapioca/dsl/compilers/graphql_mutation.rb +1 -2
  42. data/lib/tapioca/dsl/compilers/identity_cache.rb +1 -2
  43. data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +1 -2
  44. data/lib/tapioca/dsl/compilers/kredis.rb +1 -4
  45. data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +1 -2
  46. data/lib/tapioca/dsl/compilers/protobuf.rb +1 -2
  47. data/lib/tapioca/dsl/compilers/rails_generators.rb +1 -2
  48. data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +1 -2
  49. data/lib/tapioca/dsl/compilers/smart_properties.rb +21 -18
  50. data/lib/tapioca/dsl/compilers/state_machines.rb +1 -2
  51. data/lib/tapioca/dsl/compilers/url_helpers.rb +1 -2
  52. data/lib/tapioca/dsl/pipeline.rb +2 -2
  53. data/lib/tapioca/gem/events.rb +2 -6
  54. data/lib/tapioca/gem/listeners/base.rb +1 -4
  55. data/lib/tapioca/helpers/cli_helper.rb +1 -4
  56. data/lib/tapioca/helpers/config_helper.rb +2 -5
  57. data/lib/tapioca/helpers/env_helper.rb +1 -4
  58. data/lib/tapioca/helpers/rbi_files_helper.rb +3 -6
  59. data/lib/tapioca/helpers/test/content.rb +1 -4
  60. data/lib/tapioca/helpers/test/dsl_compiler.rb +1 -4
  61. data/lib/tapioca/helpers/test/isolation.rb +2 -7
  62. data/lib/tapioca/helpers/test/template.rb +1 -4
  63. data/lib/tapioca/loaders/loader.rb +4 -6
  64. data/lib/tapioca/rbs/rewriter.rb +1 -1
  65. data/lib/tapioca/repo_index.rb +0 -2
  66. data/lib/tapioca/runtime/attached_class_of_legacy.rb +1 -4
  67. data/lib/tapioca/runtime/trackers/method_definition.rb +2 -2
  68. data/lib/tapioca/runtime/trackers/tracker.rb +1 -4
  69. data/lib/tapioca/sorbet_ext/name_patch.rb +1 -1
  70. data/lib/tapioca/version.rb +1 -1
  71. 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 Thor::Error, build_error_message(config_file, errors)
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 Thor::Error, error_messages.join("\n") if parse_errors.any?
131
+ Kernel.raise Tapioca::Error, error_messages.join("\n") if parse_errors.any?
135
132
  end
136
133
 
137
134
  private
@@ -4,12 +4,9 @@
4
4
  module Tapioca
5
5
  module Helpers
6
6
  module Test
7
+ # @requires_ancestor: Kernel
7
8
  module Content
8
9
  extend T::Sig
9
- extend T::Helpers
10
-
11
- requires_ancestor { Kernel }
12
-
13
10
  #: -> void
14
11
  def teardown
15
12
  super
@@ -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
- sig { abstract.void }
17
- def load; end
13
+ # @abstract
14
+ #: -> void
15
+ def load = raise NotImplementedError, "Abstract method called"
18
16
 
19
17
  private
20
18
 
@@ -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)/
@@ -4,8 +4,6 @@
4
4
  module Tapioca
5
5
  class RepoIndex
6
6
  extend T::Sig
7
- extend T::Generic
8
-
9
7
  class << self
10
8
  extend T::Sig
11
9
 
@@ -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)
@@ -4,12 +4,9 @@
4
4
  module Tapioca
5
5
  module Runtime
6
6
  module Trackers
7
+ # @abstract
7
8
  module Tracker
8
9
  extend T::Sig
9
- extend T::Helpers
10
-
11
- abstract!
12
-
13
10
  class << self
14
11
  extend T::Sig
15
12
 
@@ -16,7 +16,7 @@ module T
16
16
  def qualified_name_of(constant)
17
17
  name = NAME_METHOD.bind_call(constant)
18
18
  name = nil if name&.start_with?("#<")
19
- return if name.nil?
19
+ return "::T.untyped" if name.nil?
20
20
 
21
21
  if name.start_with?("::")
22
22
  name
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.17.3"
5
+ VERSION = "0.17.7"
6
6
  end
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.17.3
4
+ version: 0.17.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu