diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-04-29 13:15:09 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-04-29 13:15:09 -0700 |
commit | dfd878390cbce6f26048a24ca4e48d3ce70a9d17 (patch) | |
tree | aae1e404e9d0a83e7f55357312001048ded239c0 /tasks | |
parent | 43f4326b3327b28f86772c0298ce8e6aceebf8c2 (diff) | |
download | chef-dfd878390cbce6f26048a24ca4e48d3ce70a9d17.tar.gz |
Updates to the code generation task
Don't generate the nil robots or syntax_code_block fields
Skip empty fields in our properties
Confirmed with Ian that Hugo is going to skip the empty fields anyways
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'tasks')
-rwxr-xr-x | tasks/docs.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tasks/docs.rb b/tasks/docs.rb index 46119b3664..6e139406b2 100755 --- a/tasks/docs.rb +++ b/tasks/docs.rb @@ -157,15 +157,17 @@ namespace :docs_site do # - what to do about "lazy default" for default? def properties_list(properties) properties.map do |property| - { - "property" => property["name"], - "ruby_type" => friendly_types_list(property["is"]), - "required" => property["required"], - "default_value" => friendly_default_value(property), - # "allowed_values" => property["equal_to"].join(', '), - "new_in" => property["introduced"], - "description_list" => [{ "markdown" => property["description"] }], - } + default_val = friendly_default_value(property) + + values = {} + values["property"] = property["name"] + values["ruby_type"] = friendly_types_list(property["is"]) + values["required"] = property["required"] + values["default_value"] = default_val unless default_val.nil? + values["new_in"] = property["introduced"] unless property["introduced"].nil? + # values["allowed_values"] = property["equal_to"].join(', ') + values["description_list"] = [{ "markdown" => property["description"] }] + values end end @@ -257,14 +259,12 @@ namespace :docs_site do # the main method that builds what will become the yaml file def build_resource_data(name, data) - properties = data["properties"].reject { |v| v["name"] == "name" || v['deprecated'] }.sort_by! { |v| v["name"] } + properties = data["properties"].reject { |v| v["name"] == "name" || v["deprecated"] }.sort_by! { |v| v["name"] } r = {} - # These properties are always set to these values. + # We want all our resources to show up in the main resource reference page r["resource_reference"] = true - r["robots"] = nil - r["syntax_code_block"] = nil # These properties are set to special values for only a few resources. r.merge!(special_properties(name, data)) |