tapioca-compilers-dry_struct 0.0.0 → 0.0.2

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: 9dcbe2532639837d3887debbc6b919d0e6181ce40af168e8c0ef74ab1efdf21e
4
- data.tar.gz: 81e38049ba86b21f99967514aa1bc9b6f87c60fa7a7d8b5d395633098b265d55
3
+ metadata.gz: 328465f4867f3800e53f085041e812ae8be9e1a079ff239a100c5c9e7de8dec8
4
+ data.tar.gz: 75b0dae85cdf386ed9abb2b30521722065f300cc51d9e59bdff6e05f8581c08b
5
5
  SHA512:
6
- metadata.gz: e0df50ffae3ca81b5236ecbb6c9d57b424841454067ffe5ce8f0d453b9e367706527f3940546b417f8055595bd13971cabef2a903f0c298bf28306935f1bbdeb
7
- data.tar.gz: 5d2ba85b1a2399808f847407803c3b34a55dda5a474c6b766f836a432b05ff6289dc4f46ec75a2582b44ec3c2909595411d43406e6c0f26642d17fe5ad55bdf5
6
+ metadata.gz: ae98c1c4e2f935bb64c5523971fd4dee9061022dc1f94558eedb8a917d6efe5db0f88eb983f163f8afd0375d1b1e624d455f76907b783adfc218d571c2272a1f
7
+ data.tar.gz: 688b11f616071382d840d6bba3576d1674c0003414ad3869dd4b75cb08defef05e698958e13b5bbe2e301295a72fe28d2793d7dc180b3ec1c9ca722cd5563293
data/CHANGELOG.md CHANGED
@@ -0,0 +1,13 @@
1
+ # tapioca-compilers-dry_struct Changelog
2
+
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)
8
+
9
+ - Move dry-monads from runtime_dependency to development_dependency
10
+
11
+ ## [v0.0.0](https://github.com/YukiJikumaru/tapioca-compilers-dry_struct/tree/v0.0.0)
12
+
13
+ - Initial release
data/README.md CHANGED
@@ -1,18 +1,61 @@
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.
10
26
 
11
- # Installation
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
12
43
 
13
- cp lib/tapioca/dsl/compilers/dry_struct.rb PATH_TO_YOUR_PROJECT/sorbet/tapioca/compilers/dry_struct.rb
44
+ sig { returns(T::Array[String]) }
45
+ def attr06; end
14
46
 
15
- -----------------------------------
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
+ ```
57
+
58
+ # Installation
16
59
 
17
60
  Add this line to your application’s Gemfile:
18
61
 
@@ -26,7 +69,7 @@ And then execute:
26
69
  $ bundle
27
70
  ```
28
71
 
29
- > 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.
30
73
  >
31
74
  > https://github.com/Shopify/tapioca/blob/v0.10.2/README.md#writing-custom-dsl-compilers
32
75
 
@@ -51,16 +94,24 @@ bundle exec rake spec
51
94
 
52
95
  # Environment Variables
53
96
 
97
+ You can change behaviours of the compiler by environment variables.
98
+
54
99
  ## DRY_PREFER_PLAIN_TIME
55
100
 
56
101
  \ | Ruby `Time` is typed as
57
102
  ------- | --------
58
- 0(DEFAULT) | `::ActiveSupport::TimeWithZone`
103
+ 0 (DEFAULT) | `::ActiveSupport::TimeWithZone`
59
104
  1 | `::Time`
60
105
 
61
106
  ## DRY_USE_EXPERIMENTAL_SHAPE
62
107
 
63
108
  \ | `Types::Hash.schema(name: Types::String, age: Types::Integer)` is typed as
64
109
  ------- | --------
65
- 0(DEFAULT) | `::T::Hash[::T.untyped, ::T.untyped]`
110
+ 0 (DEFAULT) | `::T::Hash[::T.untyped, ::T.untyped]`
66
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,9 +5,9 @@ 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.0"
8
+ spec.version = "0.0.2"
9
9
 
10
- spec.summary = "Tapioca's compiler for dry-struct"
10
+ spec.summary = "Tapioca's custom DSL compiler for dry-struct"
11
11
  spec.description = spec.summary
12
12
  spec.homepage = "https://github.com/YukiJikumaru/tapioca-compilers-dry_struct"
13
13
  spec.files = Dir["README.md", "CHANGELOG.md", "tapioca-compilers-dry_struct.gemspec", "lib/tapioca/dsl/compilers/dry_struct.rb"]
@@ -20,12 +20,11 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = ">= 2.7.0"
22
22
 
23
- # to update dependencies edit project.yml
24
23
  spec.add_runtime_dependency "tapioca", ">= 0.10"
25
24
  spec.add_runtime_dependency "dry-struct", ">= 1.2"
26
- spec.add_runtime_dependency "dry-monads", ">= 1.2"
27
25
 
28
- spec.add_development_dependency "bundler"
29
- spec.add_development_dependency "rake"
30
- spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "bundler", ">= 2.0.0"
27
+ spec.add_development_dependency "rake", ">= 12.0"
28
+ spec.add_development_dependency "rspec", ">= 3.10"
29
+ spec.add_development_dependency "dry-monads", ">= 1.2"
31
30
  end
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.0
4
+ version: 0.0.2
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-12 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tapioca
@@ -39,62 +39,62 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: dry-monads
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.2'
48
- type: :runtime
47
+ version: 2.0.0
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: '1.2'
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '12.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '12.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '3.10'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '3.10'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: dry-monads
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '1.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
97
- description: Tapioca's compiler for dry-struct
96
+ version: '1.2'
97
+ description: Tapioca's custom DSL compiler for dry-struct
98
98
  email:
99
99
  - jikumaruyuki@gmail.com
100
100
  executables: []
@@ -131,5 +131,5 @@ requirements: []
131
131
  rubygems_version: 3.1.6
132
132
  signing_key:
133
133
  specification_version: 4
134
- summary: Tapioca's compiler for dry-struct
134
+ summary: Tapioca's custom DSL compiler for dry-struct
135
135
  test_files: []