u-case 4.5.1 → 5.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/.github/workflows/ci.yml +67 -0
- data/.gitignore +7 -0
- data/.tool-versions +1 -1
- data/.vscode/settings.json +8 -0
- data/Appraisals +92 -0
- data/Gemfile +6 -56
- data/README.md +31 -34
- data/README.pt-BR.md +32 -35
- data/Rakefile +29 -1
- data/bin/matrix +16 -0
- data/bin/setup +4 -0
- data/gemfiles/rails_8_1.gemfile +19 -0
- data/gemfiles/rails_edge.gemfile +19 -0
- data/lib/micro/case/utils.rb +4 -4
- data/lib/micro/case/version.rb +1 -1
- data/lib/micro/case.rb +1 -1
- data/lib/micro/cases/map.rb +5 -3
- data/u-case.gemspec +4 -3
- metadata +28 -14
- data/.travis.sh +0 -46
- data/.travis.yml +0 -33
- data/test.sh +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d654bd6a59c3920ef02a3fa0c2b82fb32ff5f695cfe1f4d4565a84c53bf1d86c
|
|
4
|
+
data.tar.gz: e42a81c72ad2f49d01f2464e220e72bd201ca0adce6be06f14defa4ee84f67fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '090c4536a5205ed89e0cf2e76b163ca127455f90df793980bd33cdc28efecabd35736e543dc2f003954b8131367672dea79319382412dd7ce6ae25121847eab6'
|
|
7
|
+
data.tar.gz: 0a9f2345b82957003238137fcd5a4ca081205f3b83c1f8f092d92f153ef3b57dd7d726abef600cdd1b76b7e6983b222931d8903edf984573cf8dd4696851a7cd
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
name: Ruby ${{ matrix.ruby }} (transitions=${{ matrix.transitions }})
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "4.0", head]
|
|
20
|
+
transitions: ["true", "false"]
|
|
21
|
+
env:
|
|
22
|
+
ENABLE_TRANSITIONS: ${{ matrix.transitions }}
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
persist-credentials: false
|
|
27
|
+
- name: Set up Ruby
|
|
28
|
+
uses: ruby/setup-ruby@v1
|
|
29
|
+
with:
|
|
30
|
+
ruby-version: ${{ matrix.ruby }}
|
|
31
|
+
- name: Install bundler
|
|
32
|
+
run: gem install bundler -v 2.4.22
|
|
33
|
+
if: ${{ matrix.ruby == '2.7' || matrix.ruby == '3.0' }}
|
|
34
|
+
- name: Bundle install
|
|
35
|
+
run: bundle install
|
|
36
|
+
- name: Setup project
|
|
37
|
+
run: bundle exec appraisal install
|
|
38
|
+
- name: Run tests for Rails 6.0
|
|
39
|
+
run: bundle exec appraisal rails-6-0 rake test
|
|
40
|
+
if: ${{ matrix.ruby == '2.7' || matrix.ruby == '3.0' }}
|
|
41
|
+
- name: Run tests for Rails 6.1
|
|
42
|
+
run: bundle exec appraisal rails-6-1 rake test
|
|
43
|
+
if: ${{ matrix.ruby == '2.7' || matrix.ruby == '3.0' }}
|
|
44
|
+
- name: Run tests for Rails 7.0
|
|
45
|
+
run: bundle exec appraisal rails-7-0 rake test
|
|
46
|
+
if: ${{ matrix.ruby == '2.7' || matrix.ruby == '3.0' || matrix.ruby == '3.1' || matrix.ruby == '3.2' || matrix.ruby == '3.3' }}
|
|
47
|
+
- name: Run tests for Rails 7.1
|
|
48
|
+
run: bundle exec appraisal rails-7-1 rake test
|
|
49
|
+
if: ${{ matrix.ruby == '2.7' || matrix.ruby == '3.0' || matrix.ruby == '3.1' || matrix.ruby == '3.2' || matrix.ruby == '3.3' }}
|
|
50
|
+
- name: Run tests for Rails 7.2
|
|
51
|
+
run: bundle exec appraisal rails-7-2 rake test
|
|
52
|
+
if: ${{ matrix.ruby == '3.1' || matrix.ruby == '3.2' || matrix.ruby == '3.3' || matrix.ruby == '3.4' }}
|
|
53
|
+
- name: Run tests for Rails 8.0
|
|
54
|
+
run: bundle exec appraisal rails-8-0 rake test
|
|
55
|
+
if: ${{ matrix.ruby == '3.2' || matrix.ruby == '3.3' || matrix.ruby == '3.4' }}
|
|
56
|
+
- name: Run tests for Rails 8.1
|
|
57
|
+
run: bundle exec appraisal rails-8-1 rake test
|
|
58
|
+
if: ${{ matrix.ruby == '3.3' || matrix.ruby == '3.4' || matrix.ruby == '4.0' }}
|
|
59
|
+
- name: Run tests for Rails edge
|
|
60
|
+
run: bundle exec appraisal rails-edge rake test
|
|
61
|
+
if: ${{ matrix.ruby == '4.0' || matrix.ruby == 'head' }}
|
|
62
|
+
- name: Upload coverage to Qlty
|
|
63
|
+
uses: qltysh/qlty-action/coverage@v2
|
|
64
|
+
if: ${{ matrix.ruby == '3.4' && matrix.transitions == 'true' && !github.base_ref }}
|
|
65
|
+
with:
|
|
66
|
+
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
|
|
67
|
+
files: coverage/.resultset.json
|
data/.gitignore
CHANGED
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby
|
|
1
|
+
ruby 4.0.1
|
data/Appraisals
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
if RUBY_VERSION < "3.1"
|
|
2
|
+
appraise "rails-6-0" do
|
|
3
|
+
group :test do
|
|
4
|
+
gem "logger", "~> 1.6", ">= 1.6.6"
|
|
5
|
+
gem "stringio", "~> 3.2"
|
|
6
|
+
|
|
7
|
+
gem "sqlite3", "~> 1.7"
|
|
8
|
+
gem "minitest", "5.26.1"
|
|
9
|
+
gem "activerecord", "~> 6.0.0", require: "active_record"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise "rails-6-1" do
|
|
14
|
+
group :test do
|
|
15
|
+
gem "logger", "~> 1.6", ">= 1.6.6"
|
|
16
|
+
gem "stringio", "~> 3.2"
|
|
17
|
+
|
|
18
|
+
gem "sqlite3", "~> 1.7"
|
|
19
|
+
gem "minitest", "5.26.1"
|
|
20
|
+
gem "activerecord", "~> 6.1.0", require: "active_record"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if RUBY_VERSION >= "2.7" && RUBY_VERSION < "3.4"
|
|
26
|
+
appraise "rails-7-0" do
|
|
27
|
+
group :test do
|
|
28
|
+
gem "logger", "~> 1.6", ">= 1.6.6"
|
|
29
|
+
gem "stringio", "~> 3.2"
|
|
30
|
+
gem "securerandom", "~> 0.3.2"
|
|
31
|
+
|
|
32
|
+
gem "sqlite3", "~> 1.7"
|
|
33
|
+
gem "minitest", "5.26.1"
|
|
34
|
+
gem "activerecord", "~> 7.0.0", require: "active_record"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
appraise "rails-7-1" do
|
|
39
|
+
group :test do
|
|
40
|
+
gem "logger", "~> 1.6", ">= 1.6.6"
|
|
41
|
+
gem "stringio", "~> 3.2"
|
|
42
|
+
gem "securerandom", "~> 0.3.2"
|
|
43
|
+
|
|
44
|
+
gem "sqlite3", "~> 1.7"
|
|
45
|
+
gem "minitest", "5.26.1"
|
|
46
|
+
gem "activerecord", "~> 7.1.0", require: "active_record"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if RUBY_VERSION >= "3.1" && RUBY_VERSION < "4.0"
|
|
52
|
+
appraise "rails-7-2" do
|
|
53
|
+
group :test do
|
|
54
|
+
gem "sqlite3", "~> 2.8", ">= 2.8.1"
|
|
55
|
+
gem "minitest", "~> 5.27"
|
|
56
|
+
gem "activerecord", "~> 7.2.0", require: "active_record"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
if RUBY_VERSION >= "3.2" && RUBY_VERSION < "4.0"
|
|
62
|
+
appraise "rails-8-0" do
|
|
63
|
+
group :test do
|
|
64
|
+
gem "sqlite3", "~> 2.9"
|
|
65
|
+
gem "ostruct", "~> 0.6.3"
|
|
66
|
+
gem "minitest", "~> 5.27"
|
|
67
|
+
gem "activerecord", "~> 8.0.0", require: "active_record"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if RUBY_VERSION >= "3.3.0"
|
|
73
|
+
minitest_version = (RUBY_VERSION >= "4.0.0") ? "~> 6.0" : "~> 5.27"
|
|
74
|
+
|
|
75
|
+
appraise "rails-8-1" do
|
|
76
|
+
group :test do
|
|
77
|
+
gem "sqlite3", "~> 2.9"
|
|
78
|
+
gem "ostruct", "~> 0.6.3"
|
|
79
|
+
gem "minitest", minitest_version
|
|
80
|
+
gem "activerecord", "~> 8.1.0", require: "active_record"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
appraise "rails-edge" do
|
|
85
|
+
group :test do
|
|
86
|
+
gem "sqlite3", "~> 2.9"
|
|
87
|
+
gem "ostruct", "~> 0.6.3"
|
|
88
|
+
gem "minitest", minitest_version
|
|
89
|
+
gem "activerecord", github: "rails/rails", branch: "main", require: "active_record"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
data/Gemfile
CHANGED
|
@@ -1,66 +1,16 @@
|
|
|
1
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
|
-
activerecord = case activerecord_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
|
|
5
|
+
# Specify your gem's dependencies in u-case.gemspec
|
|
6
|
+
gemspec
|
|
18
7
|
|
|
19
|
-
|
|
20
|
-
case RUBY_VERSION
|
|
21
|
-
when /\A2.[23]/ then '~> 0.17.1'
|
|
22
|
-
when /\A2.4/ then '~> 0.18.5'
|
|
23
|
-
else '~> 0.19'
|
|
24
|
-
end
|
|
8
|
+
gem "rake", "~> 13.0"
|
|
25
9
|
|
|
26
10
|
group :test do
|
|
27
|
-
gem
|
|
28
|
-
|
|
29
|
-
gem 'simplecov', simplecov_version, require: false
|
|
30
|
-
|
|
31
|
-
if activerecord
|
|
32
|
-
sqlite3 =
|
|
33
|
-
case activerecord
|
|
34
|
-
when /\A6\.(0|1)/, nil then '~> 1.4.0'
|
|
35
|
-
else '~> 1.3.0'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
gem 'sqlite3', sqlite3
|
|
39
|
-
gem 'activerecord', activerecord, require: 'active_record'
|
|
40
|
-
end
|
|
11
|
+
gem "simplecov", "~> 0.22.0", require: false
|
|
41
12
|
end
|
|
42
13
|
|
|
43
|
-
pry_byebug_version =
|
|
44
|
-
case RUBY_VERSION
|
|
45
|
-
when /\A2.[23]/ then '3.6'
|
|
46
|
-
else '3.9'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
pry_version =
|
|
50
|
-
case RUBY_VERSION
|
|
51
|
-
when /\A2.2/ then '0.12.2'
|
|
52
|
-
when /\A2.3/ then '0.12.2'
|
|
53
|
-
else '0.13.1'
|
|
54
|
-
end
|
|
55
|
-
|
|
56
14
|
group :development, :test do
|
|
57
|
-
gem
|
|
58
|
-
|
|
59
|
-
gem 'byebug', '~> 10.0', '>= 10.0.2' if RUBY_VERSION =~ /\A2.[23]/
|
|
60
|
-
|
|
61
|
-
gem 'pry', "~> #{pry_version}"
|
|
62
|
-
gem 'pry-byebug', "~> #{pry_byebug_version}"
|
|
15
|
+
gem "awesome_print"
|
|
63
16
|
end
|
|
64
|
-
|
|
65
|
-
# Specify your gem's dependencies in u-case.gemspec
|
|
66
|
-
gemspec
|
data/README.md
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="./assets/ucase_logo_v1.png" alt="
|
|
3
|
-
|
|
2
|
+
<h1 align="center" id="-case"><img src="./assets/ucase_logo_v1.png" alt="μ-case" height="150"></h1>
|
|
4
3
|
<p align="center"><i>Represent use cases in a simple and powerful way while writing modular, expressive and sequentially logical code.</i></p>
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<img
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<a href="https://travis-ci.com/serradura/u-case">
|
|
16
|
-
<img alt="Build Status" src="https://travis-ci.com/serradura/u-case.svg?branch=main">
|
|
17
|
-
</a>
|
|
18
|
-
|
|
19
|
-
<a href="https://codeclimate.com/github/serradura/u-case/maintainability">
|
|
20
|
-
<img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/maintainability">
|
|
21
|
-
</a>
|
|
22
|
-
|
|
23
|
-
<a href="https://codeclimate.com/github/serradura/u-case/test_coverage">
|
|
24
|
-
<img alt="Test Coverage" src="https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/test_coverage">
|
|
25
|
-
</a>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://badge.fury.io/rb/u-case"><img src="https://badge.fury.io/rb/u-case.svg" alt="Gem Version" height="18"></a>
|
|
6
|
+
<a href="https://github.com/serradura/u-case/actions/workflows/ci.yml"><img alt="Build Status" src="https://github.com/serradura/u-case/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
+
<br/>
|
|
8
|
+
<a href="https://qlty.sh/gh/serradura/projects/u-case"><img src="https://qlty.sh/gh/serradura/projects/u-case/maintainability.svg" alt="Maintainability" /></a>
|
|
9
|
+
<a href="https://qlty.sh/gh/serradura/projects/u-case"><img src="https://qlty.sh/gh/serradura/projects/u-case/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>
|
|
26
14
|
</p>
|
|
27
15
|
|
|
28
16
|
The main project goals are:
|
|
@@ -39,10 +27,8 @@ The main project goals are:
|
|
|
39
27
|
Version | Documentation
|
|
40
28
|
--------- | -------------
|
|
41
29
|
unreleased| https://github.com/serradura/u-case/blob/main/README.md
|
|
30
|
+
5.0.0 | https://github.com/serradura/u-case/blob/v5.x/README.md
|
|
42
31
|
4.5.1 | https://github.com/serradura/u-case/blob/v4.x/README.md
|
|
43
|
-
3.1.0 | https://github.com/serradura/u-case/blob/v3.x/README.md
|
|
44
|
-
2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
|
|
45
|
-
1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
|
|
46
32
|
|
|
47
33
|
> **Note:** Você entende português? 🇧🇷 🇵🇹 Verifique o [README traduzido em pt-BR](https://github.com/serradura/u-case/blob/main/README.pt-BR.md).
|
|
48
34
|
|
|
@@ -99,13 +85,24 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
|
|
|
99
85
|
|
|
100
86
|
## Compatibility
|
|
101
87
|
|
|
102
|
-
| u-case
|
|
103
|
-
|
|
|
104
|
-
| unreleased
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
108
|
-
|
|
88
|
+
| u-case | branch | ruby | activemodel | u-attributes |
|
|
89
|
+
| ---------------- | ------ | -------- | -------------- | -------------- |
|
|
90
|
+
| unreleased | main | >= 2.7 | >= 6.0 | >= 2.7, < 4.0 |
|
|
91
|
+
| 5.0.0 | v5.x | >= 2.7 | >= 6.0 | >= 2.7, < 4.0 |
|
|
92
|
+
| 4.5.1 | v4.x | >= 2.2.0 | >= 3.2, <= 8.1 | >= 2.7, < 3.0 |
|
|
93
|
+
|
|
94
|
+
This library is tested (CI matrix) against:
|
|
95
|
+
|
|
96
|
+
| Ruby / Rails | 6.0 | 6.1 | 7.0 | 7.1 | 7.2 | 8.0 | 8.1 | Edge |
|
|
97
|
+
|--------------|-----|-----|-----|-----|-----|-----|-----|------|
|
|
98
|
+
| 2.7 | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
99
|
+
| 3.0 | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
100
|
+
| 3.1 | | | ✅ | ✅ | ✅ | | | |
|
|
101
|
+
| 3.2 | | | ✅ | ✅ | ✅ | ✅ | | |
|
|
102
|
+
| 3.3 | | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
103
|
+
| 3.4 | | | | | ✅ | ✅ | ✅ | ✅ |
|
|
104
|
+
| 4.x | | | | | | | ✅ | ✅ |
|
|
105
|
+
| Head | | | | | | | ✅ | ✅ |
|
|
109
106
|
|
|
110
107
|
> Note: The activemodel is an optional dependency, this module [can be enabled](#u-casewith_activemodel_validation---how-to-validate-use-case-attributes) to validate the use cases' attributes.
|
|
111
108
|
|
|
@@ -126,7 +123,7 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
|
|
|
126
123
|
Add this line to your application's Gemfile:
|
|
127
124
|
|
|
128
125
|
```ruby
|
|
129
|
-
gem 'u-case', '~>
|
|
126
|
+
gem 'u-case', '~> 5.0'
|
|
130
127
|
```
|
|
131
128
|
|
|
132
129
|
And then execute:
|
data/README.pt-BR.md
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="./assets/ucase_logo_v1.png" alt="
|
|
3
|
-
|
|
4
|
-
<p align="center"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<img
|
|
13
|
-
</
|
|
14
|
-
|
|
15
|
-
<a href="https://travis-ci.com/serradura/u-case">
|
|
16
|
-
<img alt="Build Status" src="https://travis-ci.com/serradura/u-case.svg?branch=main">
|
|
17
|
-
</a>
|
|
18
|
-
|
|
19
|
-
<a href="https://codeclimate.com/github/serradura/u-case/maintainability">
|
|
20
|
-
<img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/maintainability">
|
|
21
|
-
</a>
|
|
22
|
-
|
|
23
|
-
<a href="https://codeclimate.com/github/serradura/u-case/test_coverage">
|
|
24
|
-
<img alt="Test Coverage" src="https://api.codeclimate.com/v1/badges/5c3c8ad1b0b943f88efd/test_coverage">
|
|
25
|
-
</a>
|
|
2
|
+
<h1 align="center" id="-case"><img src="./assets/ucase_logo_v1.png" alt="μ-case" height="150"></h1>
|
|
3
|
+
<p align="center"><i>Represente casos de uso de forma simples e poderosa ao escrever código modular, expressivo e sequencialmente lógico.</i></p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://badge.fury.io/rb/u-case"><img src="https://badge.fury.io/rb/u-case.svg" alt="Gem Version" height="18"></a>
|
|
6
|
+
<a href="https://github.com/serradura/u-case/actions/workflows/ci.yml"><img alt="Build Status" src="https://github.com/serradura/u-case/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
+
<br/>
|
|
8
|
+
<a href="https://qlty.sh/gh/serradura/projects/u-case"><img src="https://qlty.sh/gh/serradura/projects/u-case/maintainability.svg" alt="Maintainability" /></a>
|
|
9
|
+
<a href="https://qlty.sh/gh/serradura/projects/u-case"><img src="https://qlty.sh/gh/serradura/projects/u-case/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>
|
|
26
14
|
</p>
|
|
27
15
|
|
|
28
16
|
Principais objetivos deste projeto:
|
|
@@ -39,10 +27,8 @@ Principais objetivos deste projeto:
|
|
|
39
27
|
Versão | Documentação
|
|
40
28
|
--------- | -------------
|
|
41
29
|
unreleased| https://github.com/serradura/u-case/blob/main/README.md
|
|
30
|
+
5.0.0 | https://github.com/serradura/u-case/blob/v5.x/README.md
|
|
42
31
|
4.5.1 | https://github.com/serradura/u-case/blob/v4.x/README.md
|
|
43
|
-
3.1.0 | https://github.com/serradura/u-case/blob/v3.x/README.md
|
|
44
|
-
2.6.0 | https://github.com/serradura/u-case/blob/v2.x/README.md
|
|
45
|
-
1.1.0 | https://github.com/serradura/u-case/blob/v1.x/README.md
|
|
46
32
|
|
|
47
33
|
## Índice <!-- omit in toc -->
|
|
48
34
|
- [Compatibilidade](#compatibilidade)
|
|
@@ -97,13 +83,24 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
|
|
|
97
83
|
|
|
98
84
|
## Compatibilidade
|
|
99
85
|
|
|
100
|
-
| u-case
|
|
101
|
-
|
|
|
102
|
-
| unreleased
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
| u-case | branch | ruby | activemodel | u-attributes |
|
|
87
|
+
| ---------------- | ------ | -------- | -------------- | -------------- |
|
|
88
|
+
| unreleased | main | >= 2.7 | >= 6.0 | >= 2.7, < 4.0 |
|
|
89
|
+
| 5.0.0 | v5.x | >= 2.7 | >= 6.0 | >= 2.7, < 4.0 |
|
|
90
|
+
| 4.5.1 | v4.x | >= 2.2.0 | >= 3.2, <= 8.1 | >= 2.7, < 3.0 |
|
|
91
|
+
|
|
92
|
+
Esta biblioteca é testada (matriz de CI) contra:
|
|
93
|
+
|
|
94
|
+
| Ruby / Rails | 6.0 | 6.1 | 7.0 | 7.1 | 7.2 | 8.0 | 8.1 | Edge |
|
|
95
|
+
|--------------|-----|-----|-----|-----|-----|-----|-----|------|
|
|
96
|
+
| 2.7 | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
97
|
+
| 3.0 | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
98
|
+
| 3.1 | | | ✅ | ✅ | ✅ | | | |
|
|
99
|
+
| 3.2 | | | ✅ | ✅ | ✅ | ✅ | | |
|
|
100
|
+
| 3.3 | | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
101
|
+
| 3.4 | | | | | ✅ | ✅ | ✅ | ✅ |
|
|
102
|
+
| 4.x | | | | | | | ✅ | ✅ |
|
|
103
|
+
| Head | | | | | | | ✅ | ✅ |
|
|
107
104
|
|
|
108
105
|
> Nota: O activemodel é uma dependência opcional, esse módulo que [pode ser habilitado](#u-casewith_activemodel_validation---como-validar-os-atributos-do-caso-de-uso) para validar os atributos dos casos de uso.
|
|
109
106
|
|
|
@@ -124,7 +121,7 @@ unreleased| https://github.com/serradura/u-case/blob/main/README.md
|
|
|
124
121
|
Adicione essa linha ao Gemfile da sua aplicação:
|
|
125
122
|
|
|
126
123
|
```ruby
|
|
127
|
-
gem 'u-case', '~>
|
|
124
|
+
gem 'u-case', '~> 5.0'
|
|
128
125
|
```
|
|
129
126
|
|
|
130
127
|
E então execute:
|
data/Rakefile
CHANGED
|
@@ -7,4 +7,32 @@ 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
|
+
desc "Run the full test suite in all supported Rails versions (both transitions modes)"
|
|
15
|
+
task :matrix do
|
|
16
|
+
appraisals =
|
|
17
|
+
if RUBY_VERSION < "3.1"
|
|
18
|
+
["rails-6-0", "rails-6-1"]
|
|
19
|
+
elsif RUBY_VERSION < "3.2"
|
|
20
|
+
["rails-7-0", "rails-7-1", "rails-7-2"]
|
|
21
|
+
elsif RUBY_VERSION < "3.3"
|
|
22
|
+
["rails-7-0", "rails-7-1", "rails-7-2", "rails-8-0"]
|
|
23
|
+
elsif RUBY_VERSION < "3.4"
|
|
24
|
+
["rails-7-0", "rails-7-1", "rails-7-2", "rails-8-0", "rails-8-1", "rails-edge"]
|
|
25
|
+
elsif RUBY_VERSION < "4.0"
|
|
26
|
+
["rails-7-2", "rails-8-0", "rails-8-1", "rails-edge"]
|
|
27
|
+
else
|
|
28
|
+
["rails-8-1", "rails-edge"]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
appraisals.each do |appraisal|
|
|
32
|
+
["true", "false"].each do |transitions|
|
|
33
|
+
sh({"ENABLE_TRANSITIONS" => transitions}, "bundle exec appraisal #{appraisal} rake test")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
task default: :test
|
data/bin/matrix
ADDED
data/bin/setup
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
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 "simplecov", "~> 0.22.0", require: false
|
|
9
|
+
gem "sqlite3", "~> 2.9"
|
|
10
|
+
gem "ostruct", "~> 0.6.3"
|
|
11
|
+
gem "minitest", "~> 6.0"
|
|
12
|
+
gem "activerecord", "~> 8.1.0", require: "active_record"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
group :development, :test do
|
|
16
|
+
gem "awesome_print"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
gemspec path: "../"
|
|
@@ -0,0 +1,19 @@
|
|
|
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 "simplecov", "~> 0.22.0", require: false
|
|
9
|
+
gem "sqlite3", "~> 2.9"
|
|
10
|
+
gem "ostruct", "~> 0.6.3"
|
|
11
|
+
gem "minitest", "~> 6.0"
|
|
12
|
+
gem "activerecord", branch: "main", require: "active_record", git: "https://github.com/rails/rails"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
group :development, :test do
|
|
16
|
+
gem "awesome_print"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
gemspec path: "../"
|
data/lib/micro/case/utils.rb
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
module Micro::Case::Utils
|
|
4
4
|
|
|
5
5
|
module Hashes
|
|
6
|
-
def self.
|
|
6
|
+
def self.hash_respond_to?(hash, method)
|
|
7
7
|
Kind::Hash[hash].respond_to?(method)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def self.symbolize_keys(hash)
|
|
11
|
-
return hash.transform_keys { |key| key.to_sym rescue key } if
|
|
11
|
+
return hash.transform_keys { |key| key.to_sym rescue key } if hash_respond_to?(hash, :transform_keys)
|
|
12
12
|
|
|
13
13
|
hash.each_with_object({}) do |(k, v), memo|
|
|
14
14
|
key = k.to_sym rescue k
|
|
@@ -17,13 +17,13 @@ module Micro::Case::Utils
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def self.stringify_keys(hash)
|
|
20
|
-
return hash.transform_keys(&:to_s) if
|
|
20
|
+
return hash.transform_keys(&:to_s) if hash_respond_to?(hash, :transform_keys)
|
|
21
21
|
|
|
22
22
|
hash.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v }
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def self.slice(hash, keys)
|
|
26
|
-
return hash.slice(*keys) if
|
|
26
|
+
return hash.slice(*keys) if hash_respond_to?(hash, :slice)
|
|
27
27
|
|
|
28
28
|
hash.select { |key, _value| keys.include?(key) }
|
|
29
29
|
end
|
data/lib/micro/case/version.rb
CHANGED
data/lib/micro/case.rb
CHANGED
|
@@ -117,7 +117,7 @@ module Micro
|
|
|
117
117
|
def self.__call__!
|
|
118
118
|
return const_get(FLOW_STEP) if const_defined?(FLOW_STEP, false)
|
|
119
119
|
|
|
120
|
-
class_eval("class #{FLOW_STEP} < #{self.name}; private def __call; __call_use_case; end; end")
|
|
120
|
+
class_eval("class #{FLOW_STEP} < #{self.name}; private def __call; __call_use_case; end; end; #{FLOW_STEP}")
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
private_class_method def self.__flow_use_cases
|
data/lib/micro/cases/map.rb
CHANGED
|
@@ -21,9 +21,11 @@ module Micro
|
|
|
21
21
|
|
|
22
22
|
GetUseCaseResult = -> (hash) do
|
|
23
23
|
-> (use_case) do
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if use_case.is_a?(Array)
|
|
25
|
+
use_case[0].call(hash.merge(use_case[1]))
|
|
26
|
+
else
|
|
27
|
+
use_case.call(hash)
|
|
28
|
+
end
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
data/u-case.gemspec
CHANGED
|
@@ -23,11 +23,12 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
24
|
spec.require_paths = ['lib']
|
|
25
25
|
|
|
26
|
-
spec.required_ruby_version = '>= 2.
|
|
26
|
+
spec.required_ruby_version = '>= 2.7.0'
|
|
27
27
|
|
|
28
|
-
spec.add_runtime_dependency 'kind', '>= 5.6', '<
|
|
29
|
-
spec.add_runtime_dependency 'u-attributes', '>= 2.7', '<
|
|
28
|
+
spec.add_runtime_dependency 'kind', '>= 5.6', '< 7.0'
|
|
29
|
+
spec.add_runtime_dependency 'u-attributes', '>= 2.7', '< 4.0'
|
|
30
30
|
|
|
31
|
+
spec.add_development_dependency 'appraisal', '~> 2.5'
|
|
31
32
|
spec.add_development_dependency 'bundler'
|
|
32
33
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
33
34
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: u-case
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodrigo Serradura
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: kind
|
|
@@ -19,7 +18,7 @@ dependencies:
|
|
|
19
18
|
version: '5.6'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
21
|
+
version: '7.0'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +28,7 @@ dependencies:
|
|
|
29
28
|
version: '5.6'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
31
|
+
version: '7.0'
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
33
|
name: u-attributes
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,7 +38,7 @@ dependencies:
|
|
|
39
38
|
version: '2.7'
|
|
40
39
|
- - "<"
|
|
41
40
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: '
|
|
41
|
+
version: '4.0'
|
|
43
42
|
type: :runtime
|
|
44
43
|
prerelease: false
|
|
45
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,7 +48,21 @@ dependencies:
|
|
|
49
48
|
version: '2.7'
|
|
50
49
|
- - "<"
|
|
51
50
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '
|
|
51
|
+
version: '4.0'
|
|
52
|
+
- !ruby/object:Gem::Dependency
|
|
53
|
+
name: appraisal
|
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - "~>"
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '2.5'
|
|
59
|
+
type: :development
|
|
60
|
+
prerelease: false
|
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - "~>"
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '2.5'
|
|
53
66
|
- !ruby/object:Gem::Dependency
|
|
54
67
|
name: bundler
|
|
55
68
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,10 +99,11 @@ executables: []
|
|
|
86
99
|
extensions: []
|
|
87
100
|
extra_rdoc_files: []
|
|
88
101
|
files:
|
|
102
|
+
- ".github/workflows/ci.yml"
|
|
89
103
|
- ".gitignore"
|
|
90
104
|
- ".tool-versions"
|
|
91
|
-
- ".
|
|
92
|
-
-
|
|
105
|
+
- ".vscode/settings.json"
|
|
106
|
+
- Appraisals
|
|
93
107
|
- CODE_OF_CONDUCT.md
|
|
94
108
|
- Gemfile
|
|
95
109
|
- LICENSE.txt
|
|
@@ -97,7 +111,10 @@ files:
|
|
|
97
111
|
- README.pt-BR.md
|
|
98
112
|
- Rakefile
|
|
99
113
|
- bin/console
|
|
114
|
+
- bin/matrix
|
|
100
115
|
- bin/setup
|
|
116
|
+
- gemfiles/rails_8_1.gemfile
|
|
117
|
+
- gemfiles/rails_edge.gemfile
|
|
101
118
|
- lib/micro/case.rb
|
|
102
119
|
- lib/micro/case/config.rb
|
|
103
120
|
- lib/micro/case/error.rb
|
|
@@ -117,13 +134,11 @@ files:
|
|
|
117
134
|
- lib/micro/cases/utils.rb
|
|
118
135
|
- lib/u-case.rb
|
|
119
136
|
- lib/u-case/with_activemodel_validation.rb
|
|
120
|
-
- test.sh
|
|
121
137
|
- u-case.gemspec
|
|
122
138
|
homepage: https://github.com/serradura/u-case
|
|
123
139
|
licenses:
|
|
124
140
|
- MIT
|
|
125
141
|
metadata: {}
|
|
126
|
-
post_install_message:
|
|
127
142
|
rdoc_options: []
|
|
128
143
|
require_paths:
|
|
129
144
|
- lib
|
|
@@ -131,15 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
131
146
|
requirements:
|
|
132
147
|
- - ">="
|
|
133
148
|
- !ruby/object:Gem::Version
|
|
134
|
-
version: 2.
|
|
149
|
+
version: 2.7.0
|
|
135
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
151
|
requirements:
|
|
137
152
|
- - ">="
|
|
138
153
|
- !ruby/object:Gem::Version
|
|
139
154
|
version: '0'
|
|
140
155
|
requirements: []
|
|
141
|
-
rubygems_version:
|
|
142
|
-
signing_key:
|
|
156
|
+
rubygems_version: 4.0.7
|
|
143
157
|
specification_version: 4
|
|
144
158
|
summary: Represent use cases in a simple and powerful way while writing modular, expressive
|
|
145
159
|
and sequentially logical code.
|
data/.travis.sh
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
RUBY_V=$(ruby -v)
|
|
4
|
-
|
|
5
|
-
function run_with_bundler {
|
|
6
|
-
rm Gemfile.lock
|
|
7
|
-
|
|
8
|
-
if [ ! -z "$1" ]; then
|
|
9
|
-
bundle_cmd="bundle _$1_"
|
|
10
|
-
else
|
|
11
|
-
bundle_cmd="bundle"
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
eval "$2 $bundle_cmd update"
|
|
15
|
-
eval "$2 ENABLE_TRANSITIONS=true $bundle_cmd exec rake test"
|
|
16
|
-
eval "$2 ENABLE_TRANSITIONS=false $bundle_cmd exec rake test"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function run_with_ar_version_and_bundler {
|
|
20
|
-
run_with_bundler "$2" "ACTIVERECORD_VERSION=$1"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
RUBY_2_2345="ruby 2.[2345]."
|
|
24
|
-
|
|
25
|
-
if [[ $RUBY_V =~ $RUBY_2_2345 ]]; then
|
|
26
|
-
run_with_bundler "$BUNDLER_V1"
|
|
27
|
-
|
|
28
|
-
run_with_ar_version_and_bundler "3.2" "$BUNDLER_V1"
|
|
29
|
-
run_with_ar_version_and_bundler "4.0" "$BUNDLER_V1"
|
|
30
|
-
run_with_ar_version_and_bundler "4.1" "$BUNDLER_V1"
|
|
31
|
-
run_with_ar_version_and_bundler "4.2" "$BUNDLER_V1"
|
|
32
|
-
run_with_ar_version_and_bundler "5.0" "$BUNDLER_V1"
|
|
33
|
-
run_with_ar_version_and_bundler "5.1" "$BUNDLER_V1"
|
|
34
|
-
run_with_ar_version_and_bundler "5.2" "$BUNDLER_V1"
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
RUBY_2_567="ruby 2.[567]."
|
|
38
|
-
RUBY_3_x_x="ruby 3.0."
|
|
39
|
-
|
|
40
|
-
if [[ $RUBY_V =~ $RUBY_2_567 ]] || [[ $RUBY_V =~ $RUBY_3_x_x ]]; then
|
|
41
|
-
gem install bundler -v ">= 2" --no-doc
|
|
42
|
-
|
|
43
|
-
run_with_bundler
|
|
44
|
-
run_with_ar_version_and_bundler "6.0"
|
|
45
|
-
run_with_ar_version_and_bundler "6.1"
|
|
46
|
-
fi
|
data/.travis.yml
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
|
|
3
|
-
cache:
|
|
4
|
-
bundler: true
|
|
5
|
-
directories:
|
|
6
|
-
- /home/travis/.rvm/
|
|
7
|
-
|
|
8
|
-
rvm:
|
|
9
|
-
- 2.2.2
|
|
10
|
-
- 2.3.0
|
|
11
|
-
- 2.4.0
|
|
12
|
-
- 2.5.0
|
|
13
|
-
- 2.6.0
|
|
14
|
-
- 2.7.0
|
|
15
|
-
- 3.0.0
|
|
16
|
-
|
|
17
|
-
env:
|
|
18
|
-
- BUNDLER_V1="1.17.3"
|
|
19
|
-
|
|
20
|
-
before_install:
|
|
21
|
-
- gem install bundler -v "$BUNDLER_V1"
|
|
22
|
-
|
|
23
|
-
install: bundle install --jobs=3 --retry=3
|
|
24
|
-
|
|
25
|
-
before_script:
|
|
26
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
27
|
-
- chmod +x ./cc-test-reporter
|
|
28
|
-
- "./cc-test-reporter before-build"
|
|
29
|
-
|
|
30
|
-
script: "./.travis.sh"
|
|
31
|
-
|
|
32
|
-
after_success:
|
|
33
|
-
- "./cc-test-reporter after-build -t simplecov"
|