summaryrefslogtreecommitdiff
path: root/lib/chef/formatters/doc.rb
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-10-14 16:46:51 +0100
committerThom May <thom@chef.io>2016-11-16 16:28:15 +0000
commit64b8b0efd90e59ad609ba30fe4bc7ff19e70e940 (patch)
tree779c33247a0617eed1db6b6a662635a0f91d37d3 /lib/chef/formatters/doc.rb
parentbedcbd5f52448d24fdd7ab26ab79185c011beee3 (diff)
downloadchef-64b8b0efd90e59ad609ba30fe4bc7ff19e70e940.tar.gz
Structure deprecations with additional metadatatm/deprecation_with_url
This adds URLs to each class of deprecation, and correctly prints and formats them for maximum user efficiency. We also provide the URL to the data collector for Visibility to ingest. Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/formatters/doc.rb')
-rw-r--r--lib/chef/formatters/doc.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index 7dbbf1d948..0c51cc2cfb 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -61,9 +61,10 @@ class Chef
if !deprecations.empty?
puts_line ""
puts_line "Deprecated features used!"
- deprecations.each do |message, locations|
+ deprecations.each do |message, details|
+ locations = details[:locations]
if locations.size == 1
- puts_line " #{message} at #{locations.size} location:"
+ puts_line " #{message} at 1 location:"
else
puts_line " #{message} at #{locations.size} locations:"
end
@@ -74,6 +75,9 @@ class Chef
prefix = " "
end
end
+ unless details[:url].nil?
+ puts_line " See #{details[:url]} for further details."
+ end
end
puts_line ""
end
@@ -416,8 +420,13 @@ class Chef
end
# Save deprecations to the screen until the end
- deprecations[message] ||= Set.new
- deprecations[message] << location
+ if is_structured_deprecation?(message)
+ url = message.url
+ message = message.message
+ end
+
+ deprecations[message] ||= { url: url, locations: Set.new }
+ deprecations[message][:locations] << location
end
def indent