tapioca-compilers-dry_struct 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0840d4fb2c71cdea0fe01b82fab1a0c478823f1e8929d6f1c6d961bb3aca40e1'
4
- data.tar.gz: e917669d24d90e8fe6d5fb32edaadd7bc8bf351cb2d276435b137542c63cab8d
3
+ metadata.gz: 328465f4867f3800e53f085041e812ae8be9e1a079ff239a100c5c9e7de8dec8
4
+ data.tar.gz: 75b0dae85cdf386ed9abb2b30521722065f300cc51d9e59bdff6e05f8581c08b
5
5
  SHA512:
6
- metadata.gz: a927c2fa5debbbfb41ed0f49d6dffafffb7aea13f3f3b99a2a0d902b57da9770b02af4a86c6b1c3d8cca95543b0a4809746df733b03b6a96efadc70b2602baaa
7
- data.tar.gz: 537998a563c39c7d3b1ccb30f686114a6de4a99bfcf47abc900a24e2e90cbd9b6ed111ca4782a129dc747c2c08841e0965d4df434ac52b2eca12b1018cb39f2c
6
+ metadata.gz: ae98c1c4e2f935bb64c5523971fd4dee9061022dc1f94558eedb8a917d6efe5db0f88eb983f163f8afd0375d1b1e624d455f76907b783adfc218d571c2272a1f
7
+ data.tar.gz: 688b11f616071382d840d6bba3576d1674c0003414ad3869dd4b75cb08defef05e698958e13b5bbe2e301295a72fe28d2793d7dc180b3ec1c9ca722cd5563293
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # tapioca-compilers-dry_struct Changelog
2
2
 
3
- ## [v0.1.0](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/compare/v0.0.0...v0.0.1)
3
+ ## [v0.0.2](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/compare/v0.0.1...v0.0.2)
4
+
5
+ - [Introduct CI(Github Action)]()
6
+
7
+ ## [v0.0.1](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/compare/v0.0.0...v0.0.1)
4
8
 
5
9
  - Move dry-monads from runtime_dependency to development_dependency
6
10
 
data/README.md CHANGED
@@ -1,12 +1,59 @@
1
+ # tapioca-compilers-dry_struct
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/tapioca-compilers-dry_struct.svg)](https://badge.fury.io/rb/tapioca-compilers-dry_struct) ![github action badge](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/actions/workflows/main.yml/badge.svg)
4
+
1
5
  **[WARNING] THIS APP IS ALPHA VERSION!!!**
2
6
 
3
7
  This script is a [Tapioca's custom DSL compiler](https://github.com/Shopify/tapioca#writing-custom-dsl-compilers) for [dry-struct](https://dry-rb.org/gems/dry-struct/main/).
4
8
 
5
- # References
9
+ From this ruby code,
6
10
 
7
- https://discourse.dry-rb.org/t/dry-rb-sorbet-can-we-unite/961
11
+ ```
12
+ class Example < Dry::Struct
13
+ attribute :attr01, Types::String
14
+ attribute :attr02, Types::String.optional
15
+ attribute? :attr03, Types::String
16
+ attribute :attr04, Types::Integer
17
+ attribute :attr05, Types::Date
18
+ attribute :attr06, Types::Array.of(Types::String)
19
+ attribute :attr07, Types.Constructor(User)
20
+ attribute :attr08, Types::String | Types::Integer
21
+ attribute :attr09, Types::Maybe::String
22
+ end
23
+ ```
8
24
 
9
- https://github.com/Shopify/tapioca/issues/1210
25
+ the compiler generates a rbi file below.
26
+
27
+ ```
28
+ class Example
29
+ sig { returns(String) }
30
+ def attr01; end
31
+
32
+ sig { returns(T.nilable(String)) }
33
+ def attr02; end
34
+
35
+ sig { returns(T.nilable(String)) }
36
+ def attr03; end
37
+
38
+ sig { returns(Integer) }
39
+ def attr04; end
40
+
41
+ sig { returns(Date) }
42
+ def attr05; end
43
+
44
+ sig { returns(T::Array[String]) }
45
+ def attr06; end
46
+
47
+ sig { returns(User) }
48
+ def attr07; end
49
+
50
+ sig { returns(T.any(String, Integer)) }
51
+ def attr08; end
52
+
53
+ sig { returns(T.any(Dry::Monads::Maybe::Some, Dry::Monads::Maybe::None)) }
54
+ def attr09; end
55
+ end
56
+ ```
10
57
 
11
58
  # Installation
12
59
 
@@ -22,7 +69,7 @@ And then execute:
22
69
  $ bundle
23
70
  ```
24
71
 
25
- > all the gem needs to do is to place the DSL compiler inside the lib/tapioca/dsl/compilers folder and it will be automatically discovered and loaded by Tapioca.
72
+ > all the gem needs to do is to place the DSL compiler inside the lib/tapioca/dsl/compilers folder and it will be automatically discovered and loaded by Tapioca.
26
73
  >
27
74
  > https://github.com/Shopify/tapioca/blob/v0.10.2/README.md#writing-custom-dsl-compilers
28
75
 
@@ -47,16 +94,24 @@ bundle exec rake spec
47
94
 
48
95
  # Environment Variables
49
96
 
97
+ You can change behaviours of the compiler by environment variables.
98
+
50
99
  ## DRY_PREFER_PLAIN_TIME
51
100
 
52
101
  \ | Ruby `Time` is typed as
53
102
  ------- | --------
54
- 0(DEFAULT) | `::ActiveSupport::TimeWithZone`
103
+ 0 (DEFAULT) | `::ActiveSupport::TimeWithZone`
55
104
  1 | `::Time`
56
105
 
57
106
  ## DRY_USE_EXPERIMENTAL_SHAPE
58
107
 
59
108
  \ | `Types::Hash.schema(name: Types::String, age: Types::Integer)` is typed as
60
109
  ------- | --------
61
- 0(DEFAULT) | `::T::Hash[::T.untyped, ::T.untyped]`
110
+ 0 (DEFAULT) | `::T::Hash[::T.untyped, ::T.untyped]`
62
111
  1 | `{ name: ::String, age: ::Integer }`
112
+
113
+ # References
114
+
115
+ https://discourse.dry-rb.org/t/dry-rb-sorbet-can-we-unite/961
116
+
117
+ https://github.com/Shopify/tapioca/issues/1210
@@ -5,7 +5,7 @@ Gem::Specification.new do |spec|
5
5
  spec.authors = ["Yuki Jikumaru"]
6
6
  spec.email = ["jikumaruyuki@gmail.com"]
7
7
  spec.license = "MIT"
8
- spec.version = "0.0.1"
8
+ spec.version = "0.0.2"
9
9
 
10
10
  spec.summary = "Tapioca's custom DSL compiler for dry-struct"
11
11
  spec.description = spec.summary
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency "tapioca", ">= 0.10"
24
24
  spec.add_runtime_dependency "dry-struct", ">= 1.2"
25
25
 
26
- spec.add_development_dependency "bundler"
26
+ spec.add_development_dependency "bundler", ">= 2.0.0"
27
27
  spec.add_development_dependency "rake", ">= 12.0"
28
28
  spec.add_development_dependency "rspec", ">= 3.10"
29
29
  spec.add_development_dependency "dry-monads", ">= 1.2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapioca-compilers-dry_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Jikumaru
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 2.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement