camille 0.6.4 → 1.0.0
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -9
- data/lib/camille/generators/install_generator.rb +4 -5
- data/lib/camille/type.rb +2 -7
- data/lib/camille/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1ea493a56729858449f5d04a2242a0920a1aff7e345fde52d7fed3061b9cb3e
|
4
|
+
data.tar.gz: 624ef2a41e1c413e8e288de97f6b464f02ce51d9f2cda9eeed9b7ba4a818aaad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf2d9199a22c3a1a6f0c81538d93e87f4aacf073c52866fed0d07156f44af98d059c6559071554e275dc754bfd5413284acebf841e59f11659acfa9527827bc
|
7
|
+
data.tar.gz: 8b249d54deee18c77faebe8da95eda1ff6bae624daf67f9db1e54225951fca9259c5ef58f0c22393806ec5225c007f6962cdb377eff572a2bc20c97bb5c48859
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -29,10 +29,6 @@ Therefore, if the front-end requests the API by calling `data`, we have guarante
|
|
29
29
|
|
30
30
|
By using these request functions, we also don't need to know about HTTP verbs and paths. It's impossible to have unrecognized routes, since Camille will make sure that each function handled by the correct Rails action.
|
31
31
|
|
32
|
-
## Tutorial
|
33
|
-
|
34
|
-
There's a step by step tutorial for setting up and showcasing Camille: https://github.com/onyxblade/camille-tutorial.
|
35
|
-
|
36
32
|
## Installation
|
37
33
|
|
38
34
|
Add this line to your application's Gemfile:
|
@@ -128,14 +124,15 @@ Each custom type is considered a type alias in TypeScript. And `alias_of` define
|
|
128
124
|
type Product = {id: number, name: string}
|
129
125
|
```
|
130
126
|
|
131
|
-
You can perform a type check on a value using `
|
127
|
+
You can perform a type check on a value using `check`, which can be handy in testing:
|
132
128
|
|
133
129
|
```ruby
|
134
|
-
|
135
|
-
|
130
|
+
# `check` will return either a Camille::Checked or a Camille::TypeError
|
131
|
+
result = Camille::Types::Product.check(hash)
|
132
|
+
if result.checked?
|
136
133
|
# the hash is accepted by Camille::Types::Product type
|
137
134
|
else
|
138
|
-
p
|
135
|
+
p result
|
139
136
|
end
|
140
137
|
```
|
141
138
|
|
@@ -161,7 +158,7 @@ params(
|
|
161
158
|
# an array of objects also works
|
162
159
|
object_array: {
|
163
160
|
field: Number
|
164
|
-
}[]
|
161
|
+
}[],
|
165
162
|
# a union type is two types connected by '|'
|
166
163
|
union: Number | String,
|
167
164
|
# an intersection type is two types connected by '&'
|
@@ -264,6 +261,10 @@ object:
|
|
264
261
|
|
265
262
|
Everything in `config/camille/types` and `config/camille/schemas` will automatically reload after changes in development environment, just like other files in Rails.
|
266
263
|
|
264
|
+
## Versioning
|
265
|
+
|
266
|
+
This project uses [Semantic Versioning](https://semver.org/).
|
267
|
+
|
267
268
|
## Development
|
268
269
|
|
269
270
|
Run tests with `bundle exec rake`.
|
@@ -10,15 +10,14 @@ module Camille
|
|
10
10
|
copy_file "configuration.rb", "config/camille/configuration.rb"
|
11
11
|
end
|
12
12
|
|
13
|
-
def create_date_time_and_decimal
|
14
|
-
copy_file "date_time.rb", "config/camille/types/date_time.rb"
|
15
|
-
copy_file "decimal.rb", "config/camille/types/decimal.rb"
|
16
|
-
end
|
17
|
-
|
18
13
|
def create_schemas_folder
|
19
14
|
copy_file ".keep", "config/camille/schemas/.keep"
|
20
15
|
end
|
21
16
|
|
17
|
+
def create_types_folder
|
18
|
+
copy_file ".keep", "config/camille/types/.keep"
|
19
|
+
end
|
20
|
+
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
data/lib/camille/type.rb
CHANGED
@@ -23,13 +23,8 @@ module Camille
|
|
23
23
|
@underlying.check value
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
28
|
-
result.type_error? ? result : nil
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.test value
|
32
|
-
new.test value
|
26
|
+
def self.check value
|
27
|
+
new.check value
|
33
28
|
end
|
34
29
|
|
35
30
|
def self.klass_name
|
data/lib/camille/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camille
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- merely
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|