diff options
author | Marc A. Paradise <marc.paradise@gmail.com> | 2021-01-29 16:28:17 -0500 |
---|---|---|
committer | Marc A. Paradise <marc.paradise@gmail.com> | 2021-02-04 10:40:42 -0500 |
commit | a258c8cb90c5377caaf76c473007043eac787153 (patch) | |
tree | 2e839187eea72c57e13367cab3255fe46469dbb9 /tasks | |
parent | a53c4c4db03e8cf1050af76f285d0d00b0088143 (diff) | |
download | chef-a258c8cb90c5377caaf76c473007043eac787153.tar.gz |
Add support for resource action descriptions
This will allow us to generate better documentation by including
action descriptions in the resource help, and includes updates to the
resource inspector and doc generation task to include action descriptions
in resource action data.
This change permits actions to be defined with the optional new
'description' parameter as follows:
```
action :my_action, description: "my_action changes the state of this world"
...
end
Action description can be looked up using the
`.action_description(action)` method of the resource class. Action
descriptions are inheritable and overridable.
Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'tasks')
-rwxr-xr-x | tasks/docs.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tasks/docs.rb b/tasks/docs.rb index b815988b8b..5d336a7b14 100755 --- a/tasks/docs.rb +++ b/tasks/docs.rb @@ -126,17 +126,14 @@ namespace :docs_site do # # Build the actions section of the resource yaml + # as a hash of actions to markdown descriptions. # # @return [Hash] # def action_list(actions) - list = {} - actions.sort.each do |action| - # nothing is a special case that sources the content from the docs site - list[action.to_sym] = (action == "nothing" ? { "shortcode" => "resources_common_actions_nothing.md" } : { "markdown" => nil }) - end - - list + actions = actions.map { |k, v| [k.to_sym, { "markdown" => v } ] }.to_h + actions[:nothing] = { "shortcode" => "resources_common_actions_nothing.md" } + actions end # TODO: |