boba 0.1.6 → 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 +4 -4
- data/README.md +9 -3
- data/lib/boba/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/noticed.rb +93 -0
- metadata +25 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 63c47fee7660d2248135eb4b850664f22fb6ada8a21154f0c0854e441d4e956a
|
|
4
|
+
data.tar.gz: 516e3f237a09e382f50ed4d345441b22f1a6db37708f3f07e6f16144f6ed7f50
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
27
|
-
|
|
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
|
data/lib/boba/version.rb
CHANGED
|
@@ -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
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Angellist
|
|
@@ -10,33 +10,47 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: sorbet
|
|
13
|
+
name: sorbet
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
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:
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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:
|