tapioca-compilers-dry_struct 0.0.1 → 0.0.3

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: '0840d4fb2c71cdea0fe01b82fab1a0c478823f1e8929d6f1c6d961bb3aca40e1'
4
- data.tar.gz: e917669d24d90e8fe6d5fb32edaadd7bc8bf351cb2d276435b137542c63cab8d
3
+ metadata.gz: 2c7239e98f59e27e9d3fca73114ca3a121396f6e2ddf82379b1af70d1cbf848c
4
+ data.tar.gz: 1b4ed939c1c8323a68965cef004624196cdd7e56c999b48313cc4c53afed75fb
5
5
  SHA512:
6
- metadata.gz: a927c2fa5debbbfb41ed0f49d6dffafffb7aea13f3f3b99a2a0d902b57da9770b02af4a86c6b1c3d8cca95543b0a4809746df733b03b6a96efadc70b2602baaa
7
- data.tar.gz: 537998a563c39c7d3b1ccb30f686114a6de4a99bfcf47abc900a24e2e90cbd9b6ed111ca4782a129dc747c2c08841e0965d4df434ac52b2eca12b1018cb39f2c
6
+ metadata.gz: c6d0f96e957ba3c99a15134ba069b08c075259aa5f9f47e2b5d72feeb8cbdebeaef8b18271604cd1ea9341a2f9b24ffda4044953679e9df4ea320b02fa0700c5
7
+ data.tar.gz: 851374244bea61b2f1c8839b79ac6c046338e01bde59681d5cfdf20ce15396b1aaeb9590117b08e94bc506cb73770f3dbce08504f9959edc28ea1a713272cf29
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
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.3](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/compare/v0.0.2...v0.0.3)
4
+
5
+ - [Add test cases for environment variables](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/pull/2)
6
+
7
+ ## [v0.0.2](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/compare/v0.0.1...v0.0.2)
8
+
9
+ - [Introduce CI(Github Action)](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/pull/1)
10
+
11
+ ## [v0.0.1](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/compare/v0.0.0...v0.0.1)
4
12
 
5
13
  - Move dry-monads from runtime_dependency to development_dependency
6
14
 
data/README.md CHANGED
@@ -1,12 +1,57 @@
1
- **[WARNING] THIS APP IS ALPHA VERSION!!!**
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)
2
4
 
3
5
  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
6
 
5
- # References
7
+ From this ruby code,
6
8
 
7
- https://discourse.dry-rb.org/t/dry-rb-sorbet-can-we-unite/961
9
+ ```
10
+ class Example < Dry::Struct
11
+ attribute :attr01, Types::String
12
+ attribute :attr02, Types::String.optional
13
+ attribute? :attr03, Types::String
14
+ attribute :attr04, Types::Integer
15
+ attribute :attr05, Types::Date
16
+ attribute :attr06, Types::Array.of(Types::String)
17
+ attribute :attr07, Types.Constructor(User)
18
+ attribute :attr08, Types::String | Types::Integer
19
+ attribute :attr09, Types::Maybe::String
20
+ end
21
+ ```
8
22
 
9
- https://github.com/Shopify/tapioca/issues/1210
23
+ the compiler generates a rbi file below.
24
+
25
+ ```
26
+ class Example
27
+ sig { returns(String) }
28
+ def attr01; end
29
+
30
+ sig { returns(T.nilable(String)) }
31
+ def attr02; end
32
+
33
+ sig { returns(T.nilable(String)) }
34
+ def attr03; end
35
+
36
+ sig { returns(Integer) }
37
+ def attr04; end
38
+
39
+ sig { returns(Date) }
40
+ def attr05; end
41
+
42
+ sig { returns(T::Array[String]) }
43
+ def attr06; end
44
+
45
+ sig { returns(User) }
46
+ def attr07; end
47
+
48
+ sig { returns(T.any(String, Integer)) }
49
+ def attr08; end
50
+
51
+ sig { returns(T.any(Dry::Monads::Maybe::Some, Dry::Monads::Maybe::None)) }
52
+ def attr09; end
53
+ end
54
+ ```
10
55
 
11
56
  # Installation
12
57
 
@@ -22,7 +67,7 @@ And then execute:
22
67
  $ bundle
23
68
  ```
24
69
 
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.
70
+ > 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
71
  >
27
72
  > https://github.com/Shopify/tapioca/blob/v0.10.2/README.md#writing-custom-dsl-compilers
28
73
 
@@ -47,16 +92,24 @@ bundle exec rake spec
47
92
 
48
93
  # Environment Variables
49
94
 
95
+ You can change behaviours of the compiler by environment variables.
96
+
50
97
  ## DRY_PREFER_PLAIN_TIME
51
98
 
52
99
  \ | Ruby `Time` is typed as
53
100
  ------- | --------
54
- 0(DEFAULT) | `::ActiveSupport::TimeWithZone`
101
+ 0 (DEFAULT) | `::ActiveSupport::TimeWithZone`
55
102
  1 | `::Time`
56
103
 
57
104
  ## DRY_USE_EXPERIMENTAL_SHAPE
58
105
 
59
106
  \ | `Types::Hash.schema(name: Types::String, age: Types::Integer)` is typed as
60
107
  ------- | --------
61
- 0(DEFAULT) | `::T::Hash[::T.untyped, ::T.untyped]`
108
+ 0 (DEFAULT) | `::T::Hash[::T.untyped, ::T.untyped]`
62
109
  1 | `{ name: ::String, age: ::Integer }`
110
+
111
+ # References
112
+
113
+ https://discourse.dry-rb.org/t/dry-rb-sorbet-can-we-unite/961
114
+
115
+ 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.3"
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,14 +1,14 @@
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Jikumaru
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tapioca
@@ -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