kind 5.10.0 → 6.0.1
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/.github/workflows/ci.yml +58 -17
- data/.gitignore +8 -1
- data/.tool-versions +1 -1
- data/Appraisals +84 -0
- data/CHANGELOG.md +346 -1936
- data/CLAUDE.md +117 -0
- data/Gemfile +8 -42
- data/README.md +35 -44
- data/Rakefile +67 -1
- data/bin/matrix +16 -0
- data/bin/setup +4 -0
- data/gemfiles/rails_8_1.gemfile +14 -0
- data/gemfiles/rails_edge.gemfile +14 -0
- data/kind.gemspec +7 -2
- data/lib/kind/any.rb +6 -6
- data/lib/kind/maybe.rb +4 -0
- data/lib/kind/version.rb +1 -1
- metadata +54 -10
- data/bin/prepare_coverage +0 -27
- data/bin/test +0 -76
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Notes for AI assistants working in `kind`.
|
|
4
|
+
|
|
5
|
+
## How to work in this repo
|
|
6
|
+
|
|
7
|
+
### 1. Think before coding
|
|
8
|
+
|
|
9
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
10
|
+
|
|
11
|
+
- State assumptions explicitly. If uncertain, ask.
|
|
12
|
+
- If multiple interpretations exist, present them — don't pick silently.
|
|
13
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
14
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
15
|
+
|
|
16
|
+
### 2. Simplicity first
|
|
17
|
+
|
|
18
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
19
|
+
|
|
20
|
+
- No features beyond what was asked.
|
|
21
|
+
- No abstractions for single-use code.
|
|
22
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
23
|
+
- No error handling for impossible scenarios.
|
|
24
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
25
|
+
|
|
26
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes,
|
|
27
|
+
simplify.
|
|
28
|
+
|
|
29
|
+
### 3. Surgical changes
|
|
30
|
+
|
|
31
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
32
|
+
|
|
33
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
34
|
+
- Don't refactor things that aren't broken.
|
|
35
|
+
- Match existing style, even if you'd do it differently.
|
|
36
|
+
- If you notice unrelated dead code, mention it — don't delete it.
|
|
37
|
+
- Remove imports/variables/functions that _your_ changes orphaned. Don't
|
|
38
|
+
remove pre-existing dead code unless asked.
|
|
39
|
+
|
|
40
|
+
The test: every changed line should trace directly to the user's request.
|
|
41
|
+
|
|
42
|
+
### 4. Goal-driven execution
|
|
43
|
+
|
|
44
|
+
**Define success criteria. Loop until verified.**
|
|
45
|
+
|
|
46
|
+
Turn vague tasks into verifiable goals:
|
|
47
|
+
|
|
48
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
49
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
50
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
51
|
+
|
|
52
|
+
For multi-step work, state a brief plan with a verification check per step.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## What this is
|
|
57
|
+
|
|
58
|
+
`kind` is a zero-runtime-dependency Ruby toolkit organized as a collection of
|
|
59
|
+
small, cohesive modules under `lib/kind/` — type handlers (`Kind::String`,
|
|
60
|
+
`Kind::Of()`, `Kind.object`), monads (`Kind::Maybe`, `Kind::Either`,
|
|
61
|
+
`Kind::Result`), enums (`Kind::Enum`), immutable objects
|
|
62
|
+
(`Kind::ImmutableAttributes`), business-logic helpers (`Kind::Action`,
|
|
63
|
+
`Kind::Functional::Steps`, `Kind::Functional::Action`), and an optional
|
|
64
|
+
ActiveModel validator (`Kind::Validator`). Everything is modularized: callers
|
|
65
|
+
require what they want (`require 'kind/basic'`, `require 'kind/either'`,
|
|
66
|
+
`require 'kind/any'`, …), and the umbrella `require 'kind'` loads the lot.
|
|
67
|
+
Because `kind` is a leaf dependency for `u-case` and other downstream gems,
|
|
68
|
+
behavior changes — especially anything affecting the public API or the
|
|
69
|
+
supported `ruby` / `activemodel` matrix — are highly visible.
|
|
70
|
+
|
|
71
|
+
## Running tests
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
bundle exec rake test # default suite, current bundle
|
|
75
|
+
bundle exec appraisal <name> rake test # one ActiveModel appraisal (see Appraisals)
|
|
76
|
+
bundle exec rake test_basic_modules # per-module isolation runs (KIND_BASIC) + KIND_STRICT
|
|
77
|
+
bundle exec rake matrix # full local matrix for the active Ruby
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`bin/setup` re-installs and refreshes appraisals. `bin/matrix` reinstalls then
|
|
81
|
+
runs `rake matrix`. CI runs the matrix across the full Ruby × ActiveModel grid
|
|
82
|
+
plus the per-module (`KIND_BASIC`) and `KIND_STRICT` axes. Tests are the
|
|
83
|
+
success criterion for any behavior change — write or update a test first, then
|
|
84
|
+
make it pass (rule 4).
|
|
85
|
+
|
|
86
|
+
## CHANGELOG and README are part of every change
|
|
87
|
+
|
|
88
|
+
Both files are user-facing — keep them in sync with the code:
|
|
89
|
+
|
|
90
|
+
- **`CHANGELOG.md`**: follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/).
|
|
91
|
+
Every user-visible change (new API, behavior change, breaking change, dep
|
|
92
|
+
bump that shifts the supported matrix, security fix) gets a bullet under
|
|
93
|
+
the appropriate section (`Added` / `Changed` / `Deprecated` / `Removed` /
|
|
94
|
+
`Fixed` / `Security`). Pure README/CI/internal-refactor changes generally
|
|
95
|
+
don't need an entry.
|
|
96
|
+
- **`README.md`**: the **Documentation** table and the **Compatibility** table
|
|
97
|
+
at the top reference the latest released version and its supported Ruby ×
|
|
98
|
+
ActiveModel bounds. Update them when you cut a release. If you change a
|
|
99
|
+
documented API, update the relevant section in the same commit.
|
|
100
|
+
|
|
101
|
+
## Bumping the version
|
|
102
|
+
|
|
103
|
+
1. Edit `lib/kind/version.rb` — change `Kind::VERSION`. Follow
|
|
104
|
+
[SemVer](https://semver.org/): patch for fixes, minor for additive
|
|
105
|
+
user-visible changes, major for breaking changes.
|
|
106
|
+
2. Add a new top entry in `CHANGELOG.md` (`## [X.Y.Z] - YYYY-MM-DD`) and a
|
|
107
|
+
matching compare link at the bottom (`[X.Y.Z]: …/compare/vPREV...vX.Y.Z`).
|
|
108
|
+
3. Update `README.md`:
|
|
109
|
+
- **Documentation** table → bump the `v6.x` (or current major) row's
|
|
110
|
+
version label.
|
|
111
|
+
- **Compatibility** table → if supported Ruby / ActiveModel bounds
|
|
112
|
+
changed, add a new row; otherwise bump the existing row's version label.
|
|
113
|
+
4. If the supported matrix moved, double-check the Compatibility table, the
|
|
114
|
+
Ruby × Rails CI matrix below it, and the `Appraisals` file reflect the
|
|
115
|
+
new bounds.
|
|
116
|
+
|
|
117
|
+
Don't tag, push, or `gem release` — humans do that.
|
data/Gemfile
CHANGED
|
@@ -1,48 +1,14 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
activemodel = case activemodel_version
|
|
8
|
-
when '3.2' then '3.2.22'
|
|
9
|
-
when '4.0' then '4.0.13'
|
|
10
|
-
when '4.1' then '4.1.16'
|
|
11
|
-
when '4.2' then '4.2.11'
|
|
12
|
-
when '5.0' then '5.0.7'
|
|
13
|
-
when '5.1' then '5.1.7'
|
|
14
|
-
when '5.2' then '5.2.4'
|
|
15
|
-
when '6.0' then '6.0.3.4'
|
|
16
|
-
when '6.1' then '6.1.2'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
simplecov_version =
|
|
20
|
-
case RUBY_VERSION
|
|
21
|
-
when /\A2.[123]/ then '0.17.1'
|
|
22
|
-
when /\A2.4/ then '~> 0.18.5'
|
|
23
|
-
else '~> 0.21.2'
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
is_ruby_2_1 = RUBY_VERSION <= '2.2.0'
|
|
5
|
+
# Specify your gem's dependencies in kind.gemspec
|
|
6
|
+
gemspec
|
|
27
7
|
|
|
28
|
-
|
|
29
|
-
if activemodel_version
|
|
30
|
-
activemodel_version < '4.1' ? '~> 4.2' : '~> 5.0'
|
|
31
|
-
else
|
|
32
|
-
is_ruby_2_1 ? '~> 4.2' : '~> 5.0'
|
|
33
|
-
end
|
|
8
|
+
gem "rake", "~> 13.0"
|
|
34
9
|
|
|
35
10
|
group :test do
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
gem 'minitest' , minitest_version
|
|
42
|
-
gem 'simplecov', simplecov_version, require: false
|
|
11
|
+
gem "minitest", "~> 5.0"
|
|
12
|
+
gem "ostruct", "~> 0.6.3" if RUBY_VERSION >= "3.5"
|
|
13
|
+
gem "simplecov", "~> 0.22.0", require: false
|
|
43
14
|
end
|
|
44
|
-
|
|
45
|
-
gem 'rake', is_ruby_2_1 ? '~> 12.3' : '~> 13.0'
|
|
46
|
-
|
|
47
|
-
# Specify your gem's dependencies in type_validator.gemspec
|
|
48
|
-
gemspec
|
data/README.md
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<h1 align="center">🤷 kind</h1>
|
|
2
|
+
<h1 align="center" id="-kind">🤷 kind</h1>
|
|
3
3
|
<p align="center"><i>A development toolkit for Ruby with several small/cohesive abstractions to empower your development workflow - It's totally free of dependencies.</i></p>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<img
|
|
13
|
-
</
|
|
14
|
-
|
|
15
|
-
<br />
|
|
16
|
-
|
|
17
|
-
<img src="https://img.shields.io/badge/ruby%20%3E=%202.1,%20%3C%203.1-ruby.svg?colorA=99004d&colorB=cc0066" alt="Ruby">
|
|
18
|
-
|
|
19
|
-
<img src="https://img.shields.io/badge/rails%20%3E=%203.2.0,%20%3C%207.0-rails.svg?colorA=8B0000&colorB=FF0000" alt="Rails">
|
|
20
|
-
|
|
21
|
-
<br />
|
|
22
|
-
|
|
23
|
-
<a href="https://codeclimate.com/github/serradura/kind/maintainability">
|
|
24
|
-
<img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/711329decb2806ccac95/maintainability">
|
|
25
|
-
</a>
|
|
26
|
-
|
|
27
|
-
<a href="https://codeclimate.com/github/serradura/kind/test_coverage">
|
|
28
|
-
<img alt="Test Coverage" src="https://api.codeclimate.com/v1/badges/711329decb2806ccac95/test_coverage">
|
|
29
|
-
</a>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://badge.fury.io/rb/kind"><img src="https://badge.fury.io/rb/kind.svg" alt="Gem Version" height="18"></a>
|
|
6
|
+
<a href="https://github.com/serradura/kind/actions/workflows/ci.yml"><img alt="Build Status" src="https://github.com/serradura/kind/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
+
<br/>
|
|
8
|
+
<a href="https://qlty.sh/gh/serradura/projects/kind"><img src="https://qlty.sh/gh/serradura/projects/kind/maintainability.svg" alt="Maintainability" /></a>
|
|
9
|
+
<a href="https://qlty.sh/gh/serradura/projects/kind"><img src="https://qlty.sh/gh/serradura/projects/kind/coverage.svg" alt="Code Coverage" /></a>
|
|
10
|
+
<br/>
|
|
11
|
+
<img src="https://img.shields.io/badge/Ruby%20%3E%3D%202.7%2C%20%3C%3D%20Head-ruby.svg?colorA=444&colorB=333" alt="Ruby">
|
|
12
|
+
<img src="https://img.shields.io/badge/Rails%20%3E%3D%206.0%2C%20%3C%3D%20Edge-rails.svg?colorA=444&colorB=333" alt="Rails">
|
|
13
|
+
</p>
|
|
30
14
|
</p>
|
|
31
15
|
|
|
32
16
|
**Motivation:**
|
|
@@ -42,11 +26,8 @@ So, I invite you to check out these features to see how they could be useful for
|
|
|
42
26
|
Version | Documentation
|
|
43
27
|
---------- | -------------
|
|
44
28
|
unreleased | https://github.com/serradura/kind/blob/main/README.md
|
|
29
|
+
6.0.1 | https://github.com/serradura/kind/blob/v6.x/README.md
|
|
45
30
|
5.10.0 | https://github.com/serradura/kind/blob/v5.x/README.md
|
|
46
|
-
4.1.0 | https://github.com/serradura/kind/blob/v4.x/README.md
|
|
47
|
-
3.1.0 | https://github.com/serradura/kind/blob/v3.x/README.md
|
|
48
|
-
2.3.0 | https://github.com/serradura/kind/blob/v2.x/README.md
|
|
49
|
-
1.9.0 | https://github.com/serradura/kind/blob/v1.x/README.md
|
|
50
31
|
|
|
51
32
|
## Table of Contents <!-- omit in toc -->
|
|
52
33
|
- [Compatibility](#compatibility)
|
|
@@ -92,7 +73,7 @@ unreleased | https://github.com/serradura/kind/blob/main/README.md
|
|
|
92
73
|
- [Kind::None() and Kind::Some()](#kindnone-and-kindsome)
|
|
93
74
|
- [Kind::Optional](#kindoptional)
|
|
94
75
|
- [Replacing blocks by lambdas](#replacing-blocks-by-lambdas-2)
|
|
95
|
-
- [Kind::Maybe(<Type>)](#
|
|
76
|
+
- [Kind::Maybe(<Type>)](#kindtypemaybe)
|
|
96
77
|
- [Real world examples](#real-world-examples)
|
|
97
78
|
- [Error handling](#error-handling)
|
|
98
79
|
- [Kind::Maybe.wrap {}](#kindmaybewrap-)
|
|
@@ -122,14 +103,24 @@ unreleased | https://github.com/serradura/kind/blob/main/README.md
|
|
|
122
103
|
|
|
123
104
|
## Compatibility
|
|
124
105
|
|
|
125
|
-
| kind
|
|
126
|
-
|
|
|
127
|
-
| unreleased
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
106
|
+
| kind | branch | ruby | activemodel |
|
|
107
|
+
| ---------------- | ------ | -------- | -------------- |
|
|
108
|
+
| unreleased | main | >= 2.7 | >= 6.0 |
|
|
109
|
+
| 6.0.1 | v6.x | >= 2.7 | >= 6.0 |
|
|
110
|
+
| 5.10.0 | v5.x | >= 2.1.0, <= 3.0.0 | >= 3.2, < 7.0 |
|
|
111
|
+
|
|
112
|
+
This library is tested (CI matrix) against:
|
|
113
|
+
|
|
114
|
+
| Ruby / Rails | 6.0 | 6.1 | 7.0 | 7.1 | 7.2 | 8.0 | 8.1 | Edge |
|
|
115
|
+
|--------------|-----|-----|-----|-----|-----|-----|-----|------|
|
|
116
|
+
| 2.7 | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
117
|
+
| 3.0 | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
118
|
+
| 3.1 | | | ✅ | ✅ | ✅ | | | |
|
|
119
|
+
| 3.2 | | | ✅ | ✅ | ✅ | ✅ | | |
|
|
120
|
+
| 3.3 | | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
121
|
+
| 3.4 | | | | | ✅ | ✅ | ✅ | ✅ |
|
|
122
|
+
| 4.x | | | | | | | ✅ | ✅ |
|
|
123
|
+
| Head | | | | | | | ✅ | ✅ |
|
|
133
124
|
|
|
134
125
|
> Note: The activemodel is an optional dependency, it is related with the [Kind::Validator](#kindvalidator-activemodelvalidations).
|
|
135
126
|
|
|
@@ -138,7 +129,7 @@ unreleased | https://github.com/serradura/kind/blob/main/README.md
|
|
|
138
129
|
Add this line to your application's Gemfile:
|
|
139
130
|
|
|
140
131
|
```ruby
|
|
141
|
-
gem 'kind'
|
|
132
|
+
gem 'kind', '~> 6.0'
|
|
142
133
|
```
|
|
143
134
|
|
|
144
135
|
And then execute:
|
|
@@ -277,7 +268,7 @@ Kind::String.value('1', default: 1) # Kind::Error (1 expected to be a kind of S
|
|
|
277
268
|
|
|
278
269
|
### Kind::\<Type\>.maybe
|
|
279
270
|
|
|
280
|
-
This method exposes a [typed `Kind::Maybe`](#
|
|
271
|
+
This method exposes a [typed `Kind::Maybe`](#kindtypemaybe) and using it will be possible to apply a sequence of operations in the case of the wrapped value has the expected kind.
|
|
281
272
|
|
|
282
273
|
```ruby
|
|
283
274
|
Double = ->(value) do
|
|
@@ -865,9 +856,9 @@ This module also has the method `to_proc`, because of this you can make use of t
|
|
|
865
856
|
|
|
866
857
|
## Kind::Undefined
|
|
867
858
|
|
|
868
|
-
The [`Kind::Undefined`](https://github.com/serradura/kind/blob/
|
|
859
|
+
The [`Kind::Undefined`](https://github.com/serradura/kind/blob/main/lib/kind/basic/undefined.rb) constant can be used to distinguish the usage of `nil`.
|
|
869
860
|
|
|
870
|
-
If you are interested, check out [the tests](https://github.com/serradura/kind/blob/main/test/kind/undefined_test.rb) to understand its methods.
|
|
861
|
+
If you are interested, check out [the tests](https://github.com/serradura/kind/blob/main/test/kind/basic/undefined_test.rb) to understand its methods.
|
|
871
862
|
|
|
872
863
|
[⬆️ Back to Top](#table-of-contents-)
|
|
873
864
|
|
data/Rakefile
CHANGED
|
@@ -7,4 +7,70 @@ Rake::TestTask.new(:test) do |t|
|
|
|
7
7
|
t.test_files = FileList["test/**/*_test.rb"]
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
task
|
|
10
|
+
require "appraisal/task"
|
|
11
|
+
|
|
12
|
+
Appraisal::Task.new
|
|
13
|
+
|
|
14
|
+
KIND_BASIC_MODULE_GLOBS = [
|
|
15
|
+
"test/kind/{basic/*_test,basic_test}.rb",
|
|
16
|
+
"test/kind/enum_test.rb",
|
|
17
|
+
"test/kind/presence_test.rb",
|
|
18
|
+
"test/kind/dig_test.rb",
|
|
19
|
+
"test/kind/try_test.rb",
|
|
20
|
+
"test/kind/maybe_test.rb",
|
|
21
|
+
"test/kind/immutable_attributes_test.rb",
|
|
22
|
+
"test/kind/function_test.rb",
|
|
23
|
+
"test/kind/action_test.rb",
|
|
24
|
+
"test/kind/{functional/*_test,functional_test}.rb",
|
|
25
|
+
"test/kind/either/*_test.rb",
|
|
26
|
+
"test/kind/result/*_test.rb"
|
|
27
|
+
].freeze
|
|
28
|
+
|
|
29
|
+
def run_isolated_module(files, env: {})
|
|
30
|
+
return if files.empty?
|
|
31
|
+
|
|
32
|
+
loader = Gem.bin_path('rake', 'rake_test_loader.rb') rescue nil
|
|
33
|
+
loader ||= File.join(Gem.loaded_specs['rake'].full_gem_path, 'lib/rake/rake_test_loader.rb')
|
|
34
|
+
|
|
35
|
+
sh(env, FileUtils::RUBY, '-Ilib', '-Itest', loader, *files)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc "Run each kind module in isolation (KIND_BASIC=t)"
|
|
39
|
+
task :test_basic_modules do
|
|
40
|
+
KIND_BASIC_MODULE_GLOBS.each do |glob|
|
|
41
|
+
run_isolated_module(Dir.glob(glob), env: { 'KIND_BASIC' => 't' })
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
run_isolated_module(Dir.glob('test/kind/strict_disabled_test.rb'), env: { 'KIND_STRICT' => 't' })
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "Run the full test suite against every supported Rails version"
|
|
48
|
+
task :matrix do
|
|
49
|
+
appraisals =
|
|
50
|
+
if RUBY_VERSION < "3.1"
|
|
51
|
+
%w[rails-6-0 rails-6-1 rails-7-0 rails-7-1]
|
|
52
|
+
elsif RUBY_VERSION < "3.2"
|
|
53
|
+
%w[rails-7-0 rails-7-1 rails-7-2]
|
|
54
|
+
elsif RUBY_VERSION < "3.3"
|
|
55
|
+
%w[rails-7-0 rails-7-1 rails-7-2 rails-8-0]
|
|
56
|
+
elsif RUBY_VERSION < "3.4"
|
|
57
|
+
%w[rails-7-0 rails-7-1 rails-7-2 rails-8-0 rails-8-1 rails-edge]
|
|
58
|
+
elsif RUBY_VERSION < "4.0"
|
|
59
|
+
%w[rails-7-2 rails-8-0 rails-8-1 rails-edge]
|
|
60
|
+
else
|
|
61
|
+
%w[rails-8-1 rails-edge]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Default (no activemodel)
|
|
65
|
+
sh "bundle exec rake test"
|
|
66
|
+
|
|
67
|
+
# Per-module isolation runs
|
|
68
|
+
Rake::Task[:test_basic_modules].invoke
|
|
69
|
+
|
|
70
|
+
# Each activemodel appraisal
|
|
71
|
+
appraisals.each do |appraisal|
|
|
72
|
+
sh "bundle exec appraisal #{appraisal} rake test"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
task default: :test
|
data/bin/matrix
ADDED
data/bin/setup
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "rake", "~> 13.0"
|
|
6
|
+
|
|
7
|
+
group :test do
|
|
8
|
+
gem "minitest", "~> 6.0"
|
|
9
|
+
gem "ostruct", "~> 0.6.3"
|
|
10
|
+
gem "simplecov", "~> 0.22.0", require: false
|
|
11
|
+
gem "activemodel", "~> 8.1.0"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
gemspec path: "../"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file was generated by Appraisal
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem "rake", "~> 13.0"
|
|
6
|
+
|
|
7
|
+
group :test do
|
|
8
|
+
gem "minitest", "~> 6.0"
|
|
9
|
+
gem "ostruct", "~> 0.6.3"
|
|
10
|
+
gem "simplecov", "~> 0.22.0", require: false
|
|
11
|
+
gem "activemodel", branch: "main", git: "https://github.com/rails/rails"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
gemspec path: "../"
|
data/kind.gemspec
CHANGED
|
@@ -10,11 +10,12 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.description = %q{A development toolkit for Ruby with several small/cohesive abstractions (monads, enums, business logic, data validation...) to empower your development workflow - It's totally free of dependencies.}
|
|
11
11
|
spec.homepage = 'https://github.com/serradura/kind'
|
|
12
12
|
spec.license = 'MIT'
|
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
|
14
14
|
|
|
15
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
16
16
|
spec.metadata['source_code_uri'] = 'https://github.com/serradura/kind'
|
|
17
|
-
|
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/serradura/kind/blob/main/CHANGELOG.md'
|
|
18
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
|
18
19
|
|
|
19
20
|
# Specify which files should be added to the gem when it is released.
|
|
20
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -24,4 +25,8 @@ Gem::Specification.new do |spec|
|
|
|
24
25
|
spec.bindir = 'exe'
|
|
25
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
27
|
spec.require_paths = ['lib']
|
|
28
|
+
|
|
29
|
+
spec.add_development_dependency 'appraisal', '~> 2.5'
|
|
30
|
+
spec.add_development_dependency 'bundler'
|
|
31
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
27
32
|
end
|
data/lib/kind/any.rb
CHANGED
|
@@ -27,12 +27,12 @@ module Kind
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def name
|
|
30
|
-
str =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
str =
|
|
31
|
+
if @values.is_a?(::Set)
|
|
32
|
+
"{#{@values.to_a.map(&:inspect).join(', ')}}"
|
|
33
|
+
else
|
|
34
|
+
@values.inspect
|
|
35
|
+
end
|
|
36
36
|
|
|
37
37
|
"Kind::Any#{str}"
|
|
38
38
|
end
|
data/lib/kind/maybe.rb
CHANGED
data/lib/kind/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,56 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kind
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodrigo Serradura
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: appraisal
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.5'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.5'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bundler
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rake
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '13.0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '13.0'
|
|
13
54
|
description: A development toolkit for Ruby with several small/cohesive abstractions
|
|
14
55
|
(monads, enums, business logic, data validation...) to empower your development
|
|
15
56
|
workflow - It's totally free of dependencies.
|
|
@@ -23,16 +64,19 @@ files:
|
|
|
23
64
|
- ".gitignore"
|
|
24
65
|
- ".tool-versions"
|
|
25
66
|
- ".vscode/settings.json"
|
|
67
|
+
- Appraisals
|
|
26
68
|
- CHANGELOG.md
|
|
69
|
+
- CLAUDE.md
|
|
27
70
|
- CODE_OF_CONDUCT.md
|
|
28
71
|
- Gemfile
|
|
29
72
|
- LICENSE.txt
|
|
30
73
|
- README.md
|
|
31
74
|
- Rakefile
|
|
32
75
|
- bin/console
|
|
33
|
-
- bin/
|
|
76
|
+
- bin/matrix
|
|
34
77
|
- bin/setup
|
|
35
|
-
-
|
|
78
|
+
- gemfiles/rails_8_1.gemfile
|
|
79
|
+
- gemfiles/rails_edge.gemfile
|
|
36
80
|
- kind.gemspec
|
|
37
81
|
- lib/kind.rb
|
|
38
82
|
- lib/kind/__lib__/action_steps.rb
|
|
@@ -129,7 +173,8 @@ licenses:
|
|
|
129
173
|
metadata:
|
|
130
174
|
homepage_uri: https://github.com/serradura/kind
|
|
131
175
|
source_code_uri: https://github.com/serradura/kind
|
|
132
|
-
|
|
176
|
+
changelog_uri: https://github.com/serradura/kind/blob/main/CHANGELOG.md
|
|
177
|
+
bug_tracker_uri: https://github.com/serradura/kind/issues
|
|
133
178
|
rdoc_options: []
|
|
134
179
|
require_paths:
|
|
135
180
|
- lib
|
|
@@ -137,15 +182,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
137
182
|
requirements:
|
|
138
183
|
- - ">="
|
|
139
184
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: 2.
|
|
185
|
+
version: 2.7.0
|
|
141
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
187
|
requirements:
|
|
143
188
|
- - ">="
|
|
144
189
|
- !ruby/object:Gem::Version
|
|
145
190
|
version: '0'
|
|
146
191
|
requirements: []
|
|
147
|
-
rubygems_version:
|
|
148
|
-
signing_key:
|
|
192
|
+
rubygems_version: 4.0.12
|
|
149
193
|
specification_version: 4
|
|
150
194
|
summary: A development toolkit for Ruby with several small/cohesive abstractions to
|
|
151
195
|
empower your development workflow.
|
data/bin/prepare_coverage
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
# Borrowed from https://gist.github.com/qortex/7e7c49f3731391a91ee898336183acef
|
|
4
|
-
|
|
5
|
-
# Temporary hack to get CodeClimate to work with SimpleCov 0.18 JSON format until issue is fixed
|
|
6
|
-
# upstream: https://github.com/codeclimate/test-reporter/issues/413
|
|
7
|
-
|
|
8
|
-
require "json"
|
|
9
|
-
|
|
10
|
-
filename = "coverage/.resultset.json"
|
|
11
|
-
contents = JSON.parse(File.read(filename))
|
|
12
|
-
|
|
13
|
-
def remove_lines_key(obj)
|
|
14
|
-
case obj
|
|
15
|
-
when Hash
|
|
16
|
-
obj.transform_values do |val|
|
|
17
|
-
val.is_a?(Hash) && val.key?("lines") ? val["lines"] : remove_lines_key(val)
|
|
18
|
-
end
|
|
19
|
-
else
|
|
20
|
-
obj
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# overwrite
|
|
25
|
-
File.write(filename, JSON.generate(remove_lines_key(contents)))
|
|
26
|
-
|
|
27
|
-
puts Dir['coverage/.*.json']
|