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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c19fc5a6ffdcec800571b94fb0d1ac43eb82ae771388ad69b2d5cd4293ef1b1
4
- data.tar.gz: bee42f15d1cee3a969495d2267b702e311a6121ec684f1806d3dd82aff7b2bb1
3
+ metadata.gz: 4a9b1cdaccb648dcffd8c5b50417b2891d2c263f922884b4e8163aa8389a7602
4
+ data.tar.gz: 7ab3292c7441d0a279c1609e3976c7599ae10ae4168b22aae027667578d0352a
5
5
  SHA512:
6
- metadata.gz: 934ebc5db4d532e7ab0254e34851910dba35ba86e0cf9f6b8462c24bdeab3cbd94ac588c791f67e31f188f0f09270489a168591cb4656e923811cd1cad9c883f
7
- data.tar.gz: 69d7f39f7167bc045e86ae0f23c655dd8bebcb6e176963a981be17cd29e39025116ccb5f2fa2273a6d1b505eb76ec2fc846850b45d19c0f8423547931b95d383
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
- # Attributes passed as keyword arguments
66
- PublishArticle.execute(
67
- title: "Getting Started with Ruby",
68
- content: "This is a comprehensive guide...",
69
- author_id: 42,
70
- category: "programming",
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:
@@ -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
@@ -5,6 +5,6 @@ module CMDx
5
5
  # @return [String] the version of the CMDx gem
6
6
  #
7
7
  # @rbs return: String
8
- VERSION = "1.10.1"
8
+ VERSION = "1.11.0"
9
9
 
10
10
  end
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 YARDocs: https://drexed.github.io/cmdx/api/index.html
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmdx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez