boba 0.1.5 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1a24d2252ed9eb33a76c1c41c91fbfcc55d1d6e19e98961f596ac290532bd79
4
- data.tar.gz: 2ddb912bbb1b5009a6c2b4d77ee14369ed6355ad479b36c365be25b1fa26effd
3
+ metadata.gz: 63c47fee7660d2248135eb4b850664f22fb6ada8a21154f0c0854e441d4e956a
4
+ data.tar.gz: 516e3f237a09e382f50ed4d345441b22f1a6db37708f3f07e6f16144f6ed7f50
5
5
  SHA512:
6
- metadata.gz: 999ccb4621fcddf7e37f9b7a3d921620410f4cebede0cc1833d3fb674f596b447e30e84e1459701deff389a70b40ba80a7f8d61129b6af20b0e69d2d131d1c82
7
- data.tar.gz: 73201802ffa626d966c1ea17677dfe741874c4a62057702e3cfe5dded02dd82e2e18cddea3678df03fa79ea64e7bebad81ba5e691dadc10058af8cdaaa9cd00d
6
+ metadata.gz: f65bb7c5e6182f46d9c514e1adf192aebcbce33e6e5dda4eaacab6e06f8fa0f0f7ba51c4afb7113fd5753ec01b8d891163f1f03a1f4747ebabe1e9d4d8ede147
7
+ data.tar.gz: 5f169eecab72a3e26f886d45513ad718afb659b0935e2b69f07417d6603e5c9adb5cdadd066f0dba6fbe3a42a13ab03e0cbe6932538228083e3fd971677de2f2
data/README.md CHANGED
@@ -19,13 +19,19 @@ group :development do
19
19
  end
20
20
  ```
21
21
 
22
- We recommend you also use the `only` configuration option in your Tapioca config (typically `sorbet/tapioca/config.yml`) to specify only the Tapioca compilers you wish to use.
22
+ We recommend you also use the `only` configuration option in your Tapioca config (typically `sorbet/tapioca/config.yml`) to specify only the Tapioca compilers you wish to use. For instance, the following is an example `tapioca/config.yml` using the Boba `ActiveRecord` compilers with the `persisted` options:
23
+
23
24
  ```yml
25
+ gem:
24
26
  dsl:
27
+ compiler_options:
28
+ ActiveRecordColumnTypes: persisted
29
+ ActiveRecordAssociationTypes: persisted
25
30
  only:
26
- Compiler1
27
- Compiler2
31
+ - ActiveRecordAssociationsPersisted
32
+ - ActiveRecordColumnsPersisted
28
33
  ```
34
+
29
35
  This makes it easy to selectively enable only the compilers you want to use in your project.
30
36
 
31
37
  ### Typing Relations
@@ -68,6 +74,12 @@ def recent_posts_from_author(author)
68
74
  end
69
75
  ```
70
76
 
77
+ ### A Note on Tapioca Dependencies
78
+
79
+ The core `ActiveRecordAssociationsPersisted` and `ActiveRecordColumnsPersisted` compilers are extensions of Tapioca's corresponding compilers, and depend on monkey patching internal methods. As such, Boba's dependent Tapioca version must be restricted to known good versions and cannot use the more lenient pessimistic version pinning (`~>`), since even minor or patch versions of Tapioca can introduce breaking changes that would be frustrating or difficult for consumers.
80
+
81
+ We try to stay as up-to-date with Tapioca versions as possible, but can sometimes fall behind. Please submit an issue or pull request (including any needed updates) if we miss a Tapioca version you'd like to upgrade to, and we will address it as soon as possible.
82
+
71
83
  ## Contributing
72
84
 
73
85
  Bugs and feature requests are welcome and should be [filed as issues on github](https://github.com/angellist/boba/issues).
data/lib/boba/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Boba
5
- VERSION = "0.1.5"
5
+ VERSION = "0.1.7"
6
6
  end
@@ -56,7 +56,7 @@ module Tapioca
56
56
  class << self
57
57
  extend T::Sig
58
58
 
59
- sig { override.returns(T::Enumerable[Module]) }
59
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
60
60
  def gather_constants
61
61
  Tapioca::Dsl::Compilers::ActiveRecordRelations.gather_constants
62
62
  end
@@ -57,7 +57,7 @@ module Tapioca
57
57
  class << self
58
58
  extend T::Sig
59
59
 
60
- sig { override.returns(T::Enumerable[Module]) }
60
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
61
61
  def gather_constants
62
62
  all_classes.select { |c| c < ::FlagShihTzu }
63
63
  end
@@ -60,7 +60,7 @@ module Tapioca
60
60
  class << self
61
61
  extend T::Sig
62
62
 
63
- sig { override.returns(T::Enumerable[Module]) }
63
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
64
64
  def gather_constants
65
65
  descendants_of(::ActiveRecord::Base).reject(&:abstract_class?)
66
66
  end
@@ -60,7 +60,7 @@ module Tapioca
60
60
  class << self
61
61
  extend T::Sig
62
62
 
63
- sig { override.returns(T::Enumerable[Module]) }
63
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
64
64
  def gather_constants
65
65
  all_classes.select { |c| c < ::MoneyRails::ActiveRecord::Monetizable }
66
66
  end
@@ -0,0 +1,93 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ return unless defined?(Noticed::Event) && defined?(Noticed::Ephemeral)
5
+
6
+ module Tapioca
7
+ module Dsl
8
+ module Compilers
9
+ # `Tapioca::Dsl::Compilers::Noticed` decorates RBI files for subclasses
10
+ # of `Noticed::Event` and `Noticed::Ephemeral`.
11
+ #
12
+ # For example, with the following notifier class:
13
+ #
14
+ # ~~~rb
15
+ # class NewCommentNotifier < Noticed::Event
16
+ # required_params :comment
17
+ # deliver_by :email
18
+ # end
19
+ # ~~~
20
+ #
21
+ # This compiler will produce the RBI file `new_comment_notifier.rbi` with the following content:
22
+ #
23
+ # ~~~rbi
24
+ # # new_comment_notifier.rbi
25
+ # # typed: true
26
+ # class NewCommentNotifier
27
+ # class << self
28
+ # sig { params(params: T::Hash[Symbol, T.untyped]).returns(NewCommentNotifier) }
29
+ # def with(params); end
30
+ #
31
+ # sig { params(recipients: T.untyped, enqueue_job: T.nilable(T::Boolean), options: T.untyped).returns(NewCommentNotifier) }
32
+ # def deliver(recipients = T.unsafe(nil), enqueue_job: T.unsafe(nil), **options); end
33
+ #
34
+ # sig { params(recipients: T.untyped, enqueue_job: T.nilable(T::Boolean), options: T.untyped).returns(NewCommentNotifier) }
35
+ # def deliver_later(recipients = T.unsafe(nil), enqueue_job: T.unsafe(nil), **options); end
36
+ # end
37
+ # end
38
+ # ~~~
39
+ class Noticed < Tapioca::Dsl::Compiler
40
+ extend T::Sig
41
+
42
+ ConstantType = type_member do
43
+ { fixed: T.any(T.class_of(::Noticed::Event), T.class_of(::Noticed::Ephemeral)) }
44
+ end
45
+
46
+ class << self
47
+ extend T::Sig
48
+
49
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
50
+ def gather_constants
51
+ all_classes.select do |klass|
52
+ klass < ::Noticed::Event || klass < ::Noticed::Ephemeral
53
+ end
54
+ end
55
+ end
56
+
57
+ sig { override.void }
58
+ def decorate
59
+ root.create_path(constant) do |klass|
60
+ singleton = RBI::SingletonClass.new
61
+ klass << singleton
62
+
63
+ singleton.create_method(
64
+ "with",
65
+ parameters: [create_param("params", type: "T::Hash[Symbol, T.untyped]")],
66
+ return_type: "::#{constant}",
67
+ )
68
+
69
+ singleton.create_method(
70
+ "deliver",
71
+ parameters: [
72
+ create_opt_param("recipients", type: "T.untyped", default: "T.unsafe(nil)"),
73
+ create_kw_opt_param("enqueue_job", type: "T.nilable(T::Boolean)", default: "T.unsafe(nil)"),
74
+ create_kw_rest_param("options", type: "T.untyped"),
75
+ ],
76
+ return_type: "::#{constant}",
77
+ )
78
+
79
+ singleton.create_method(
80
+ "deliver_later",
81
+ parameters: [
82
+ create_opt_param("recipients", type: "T.untyped", default: "T.unsafe(nil)"),
83
+ create_kw_opt_param("enqueue_job", type: "T.nilable(T::Boolean)", default: "T.unsafe(nil)"),
84
+ create_kw_rest_param("options", type: "T.untyped"),
85
+ ],
86
+ return_type: "::#{constant}",
87
+ )
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -43,7 +43,7 @@ module Tapioca
43
43
  class << self
44
44
  extend T::Sig
45
45
 
46
- sig { override.returns(T::Enumerable[Module]) }
46
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
47
47
  def gather_constants
48
48
  all_classes.select { |c| c < ::Paperclip::Glue }
49
49
  end
@@ -119,7 +119,7 @@ module Tapioca
119
119
  "GeneratedAssociationRelationMethods",
120
120
  ].freeze
121
121
 
122
- ConstantType = type_member { { fixed: T.all(Module, ::StateMachines::ClassMethods) } }
122
+ ConstantType = type_member { { fixed: T.all(T::Module[T.anything], ::StateMachines::ClassMethods) } }
123
123
 
124
124
  sig { override.void }
125
125
  def decorate
@@ -168,7 +168,7 @@ module Tapioca
168
168
  class << self
169
169
  extend T::Sig
170
170
 
171
- sig { override.returns(T::Enumerable[Module]) }
171
+ sig { override.returns(T::Enumerable[T::Module[T.anything]]) }
172
172
  def gather_constants
173
173
  all_classes.select { |mod| ::StateMachines::InstanceMethods > mod }
174
174
  end
@@ -176,7 +176,7 @@ module Tapioca
176
176
 
177
177
  private
178
178
 
179
- sig { params(constant: Module).returns(T::Boolean) }
179
+ sig { params(constant: T::Module[T.anything]).returns(T::Boolean) }
180
180
  def uses_active_record_integration?(constant)
181
181
  ::StateMachines::Integrations.match(constant)&.integration_name == :active_record
182
182
  end
metadata CHANGED
@@ -1,42 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angellist
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: sorbet-static-and-runtime
13
+ name: sorbet
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0.5'
18
+ version: 0.6.12698
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.6.12698
26
+ - !ruby/object:Gem::Dependency
27
+ name: sorbet-runtime
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.6.12698
19
33
  type: :runtime
20
34
  prerelease: false
21
35
  version_requirements: !ruby/object:Gem::Requirement
22
36
  requirements:
23
- - - "~>"
37
+ - - ">="
24
38
  - !ruby/object:Gem::Version
25
- version: '0.5'
39
+ version: 0.6.12698
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: tapioca
28
42
  requirement: !ruby/object:Gem::Requirement
29
43
  requirements:
30
44
  - - "<="
31
45
  - !ruby/object:Gem::Version
32
- version: 0.17.7
46
+ version: 0.18.0
33
47
  type: :runtime
34
48
  prerelease: false
35
49
  version_requirements: !ruby/object:Gem::Requirement
36
50
  requirements:
37
51
  - - "<="
38
52
  - !ruby/object:Gem::Version
39
- version: 0.17.7
53
+ version: 0.18.0
40
54
  email:
41
55
  - alex.stathis@angellist.com
42
56
  executables: []
@@ -58,6 +72,7 @@ files:
58
72
  - lib/tapioca/dsl/compilers/flag_shih_tzu.rb
59
73
  - lib/tapioca/dsl/compilers/kaminari.rb
60
74
  - lib/tapioca/dsl/compilers/money_rails.rb
75
+ - lib/tapioca/dsl/compilers/noticed.rb
61
76
  - lib/tapioca/dsl/compilers/paperclip.rb
62
77
  - lib/tapioca/dsl/compilers/state_machines_extended.rb
63
78
  homepage: https://github.com/angellist/boba
@@ -65,9 +80,9 @@ licenses:
65
80
  - MIT
66
81
  metadata:
67
82
  bug_tracker_uri: https://github.com/angellist/boba/issues
68
- changelog_uri: https://github.com/angellist/boba/blob/0.1.5/History.md
83
+ changelog_uri: https://github.com/angellist/boba/blob/0.1.7/History.md
69
84
  homepage_uri: https://github.com/angellist/boba
70
- source_code_uri: https://github.com/angellist/boba/tree/0.1.5
85
+ source_code_uri: https://github.com/angellist/boba/tree/0.1.7
71
86
  rubygems_mfa_required: 'true'
72
87
  rdoc_options: []
73
88
  require_paths:
@@ -83,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
98
  - !ruby/object:Gem::Version
84
99
  version: '0'
85
100
  requirements: []
86
- rubygems_version: 3.6.2
101
+ rubygems_version: 3.6.9
87
102
  specification_version: 4
88
103
  summary: Custom Tapioca compilers
89
104
  test_files: []