summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2015-07-22 14:10:09 -0700
committerNoah Kantrowitz <noah@coderanger.net>2015-07-22 14:10:09 -0700
commit37efaeea757b266c37280df5b2d4857fa6967815 (patch)
tree153a80282096a1a5c3396e2ae9da35e2f72d172a
parent2c4d7c7cf40346ca8236054901c023f35e1300c9 (diff)
downloadchef-37efaeea757b266c37280df5b2d4857fa6967815.tar.gz
Make the doc formatter actually show what version of a cookbook is being used.
This has bugged me forever. It does change the API of the Formatter system in a ~non-back-compat way but I don't think I've actually seen any formatters outside of core Chef so how much do we want to worry about this? We could write a shim in `Chef::EventDispatcher::Dispatcher` to check the arity of the method if needed.
-rw-r--r--lib/chef/cookbook/synchronizer.rb2
-rw-r--r--lib/chef/event_dispatch/base.rb4
-rw-r--r--lib/chef/formatters/doc.rb6
-rw-r--r--lib/chef/formatters/minimal.rb4
4 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb
index 1b96d0510b..4979aabfdf 100644
--- a/lib/chef/cookbook/synchronizer.rb
+++ b/lib/chef/cookbook/synchronizer.rb
@@ -131,7 +131,7 @@ class Chef
files_remaining_by_cookbook[file.cookbook] -= 1
if files_remaining_by_cookbook[file.cookbook] == 0
- @events.synchronized_cookbook(file.cookbook.name)
+ @events.synchronized_cookbook(file.cookbook)
end
end
diff --git a/lib/chef/event_dispatch/base.rb b/lib/chef/event_dispatch/base.rb
index 50aee63450..7ed871145b 100644
--- a/lib/chef/event_dispatch/base.rb
+++ b/lib/chef/event_dispatch/base.rb
@@ -118,8 +118,8 @@ class Chef
def cookbook_sync_start(cookbook_count)
end
- # Called when cookbook +cookbook_name+ has been sync'd
- def synchronized_cookbook(cookbook_name)
+ # Called when cookbook +cookbook+ has been sync'd
+ def synchronized_cookbook(cookbook)
end
# Called when an individual file in a cookbook has been updated
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index 5ea9823d78..a40efb7298 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -133,9 +133,9 @@ class Chef
indent
end
- # Called when cookbook +cookbook_name+ has been sync'd
- def synchronized_cookbook(cookbook_name)
- puts_line "- #{cookbook_name}"
+ # Called when cookbook +cookbook+ has been sync'd
+ def synchronized_cookbook(cookbook)
+ puts_line "- #{cookbook.name} (#{cookbook.version})"
end
# Called when an individual file in a cookbook has been updated
diff --git a/lib/chef/formatters/minimal.rb b/lib/chef/formatters/minimal.rb
index a189cc67eb..922a228f6e 100644
--- a/lib/chef/formatters/minimal.rb
+++ b/lib/chef/formatters/minimal.rb
@@ -109,8 +109,8 @@ class Chef
puts "Synchronizing cookbooks"
end
- # Called when cookbook +cookbook_name+ has been sync'd
- def synchronized_cookbook(cookbook_name)
+ # Called when cookbook +cookbook+ has been sync'd
+ def synchronized_cookbook(cookbook)
print "."
end