cmdx 1.10.1 → 1.11.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/.DS_Store +0 -0
- data/CHANGELOG.md +6 -0
- data/Rakefile +0 -5
- data/docs/attributes/definitions.md +16 -10
- data/lib/cmdx/attribute_value.rb +2 -2
- data/lib/cmdx/version.rb +1 -1
- data/mkdocs.yml +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a9b1cdaccb648dcffd8c5b50417b2891d2c263f922884b4e8163aa8389a7602
|
|
4
|
+
data.tar.gz: 7ab3292c7441d0a279c1609e3976c7599ae10ae4168b22aae027667578d0352a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3c544688dd90eb3e117460f591cd1d85dd3590a1aae8c90e37930c2728ecab5b1ff8ccce06be2cb894627d5d7beca7edebfa313667879e863c0e5338dc7bc29
|
|
7
|
+
data.tar.gz: a0b6e9c99fc46d3b4bbc627d9967acb8e39fe0fcf1ff51dcc3ab841acabc7b6d6e1bacf3cbaf4a08f0fc9381b409b2829d5f830ecadeefaab9d84647ce28c7cb
|
data/.DS_Store
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [UNRELEASED]
|
|
8
8
|
|
|
9
|
+
## [1.11.0] - 2025-11-08
|
|
10
|
+
|
|
11
|
+
### Updated
|
|
12
|
+
- Added conditionally required attributes options
|
|
13
|
+
- Update specs to use new `cmdx-rspec` matcher names
|
|
14
|
+
|
|
9
15
|
## [1.10.1] - 2025-11-06
|
|
10
16
|
|
|
11
17
|
### Added
|
data/Rakefile
CHANGED
|
@@ -20,11 +20,6 @@ task :yard do
|
|
|
20
20
|
|
|
21
21
|
# Remove unwanted files
|
|
22
22
|
FileUtils.rm_f("#{api_dir}/Cmdx_.html")
|
|
23
|
-
FileUtils.rm_f("#{api_dir}/top-level-namespace.html")
|
|
24
|
-
FileUtils.rm_f("#{api_dir}/CMDx/InstallGenerator.html")
|
|
25
|
-
FileUtils.rm_f("#{api_dir}/CMDx/LocaleGenerator.html")
|
|
26
|
-
FileUtils.rm_f("#{api_dir}/CMDx/TaskGenerator.html")
|
|
27
|
-
FileUtils.rm_f("#{api_dir}/CMDx/WorkflowGenerator.html")
|
|
28
23
|
|
|
29
24
|
# Make CMDx.html the default index
|
|
30
25
|
FileUtils.cp("#{api_dir}/CMDx.html", "#{api_dir}/index.html") if File.exist?("#{api_dir}/CMDx.html")
|
|
@@ -52,6 +52,10 @@ class PublishArticle < CMDx::Task
|
|
|
52
52
|
required :category
|
|
53
53
|
required :status, :tags
|
|
54
54
|
|
|
55
|
+
# Conditionally required
|
|
56
|
+
required :publisher, if: :magazine?
|
|
57
|
+
required :approver, unless: proc { status == :published }
|
|
58
|
+
|
|
55
59
|
def work
|
|
56
60
|
title #=> "Getting Started with Ruby"
|
|
57
61
|
content #=> "This is a comprehensive guide..."
|
|
@@ -59,20 +63,22 @@ class PublishArticle < CMDx::Task
|
|
|
59
63
|
category #=> "programming"
|
|
60
64
|
status #=> :published
|
|
61
65
|
tags #=> ["ruby", "beginner"]
|
|
66
|
+
publisher #=> "Eastbay"
|
|
67
|
+
approver #=> #<Editor ...>
|
|
62
68
|
end
|
|
63
|
-
end
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
status: :published,
|
|
72
|
-
tags: ["ruby", "beginner"]
|
|
73
|
-
)
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def magazine?
|
|
73
|
+
context.title.ends_with?("[M]")
|
|
74
|
+
end
|
|
75
|
+
end
|
|
74
76
|
```
|
|
75
77
|
|
|
78
|
+
!!! note
|
|
79
|
+
|
|
80
|
+
When a required attribute's condition evaluates to `false`, the attribute behaves as optional. All other attribute features such as coercions, validations, defaults, and transformations still apply normally.
|
|
81
|
+
|
|
76
82
|
## Sources
|
|
77
83
|
|
|
78
84
|
Attributes read from any accessible object—not just context. Use sources to pull data from models, services, or any callable:
|
data/lib/cmdx/attribute_value.rb
CHANGED
|
@@ -111,10 +111,10 @@ module CMDx
|
|
|
111
111
|
else source.respond_to?(:call) ? source.call(task) : source
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
if required? && (parent.nil? || parent&.required?)
|
|
114
|
+
if required? && (parent.nil? || parent&.required?) && Utils::Condition.evaluate(task, options)
|
|
115
115
|
case sourced_value
|
|
116
116
|
when Context, Hash then sourced_value.key?(name)
|
|
117
|
-
when Proc then true # Cannot be determined
|
|
117
|
+
when Proc then true # HACK: Cannot be determined so assume it will respond
|
|
118
118
|
else sourced_value.respond_to?(name, true)
|
|
119
119
|
end || errors.add(method_name, Locale.t("cmdx.attributes.required"))
|
|
120
120
|
end
|
data/lib/cmdx/version.rb
CHANGED
data/mkdocs.yml
CHANGED
|
@@ -156,7 +156,7 @@ nav:
|
|
|
156
156
|
- More:
|
|
157
157
|
- Tips and Tricks: tips_and_tricks.md
|
|
158
158
|
- References:
|
|
159
|
-
- API
|
|
159
|
+
- API Documentation: https://drexed.github.io/cmdx/api/index.html
|
|
160
160
|
- llms.txt: https://drexed.github.io/cmdx/llms.txt
|
|
161
161
|
- llms-full.txt: https://drexed.github.io/cmdx/llms-full.txt
|
|
162
162
|
|