diff options
author | Tim Smith <tsmith@chef.io> | 2018-08-31 17:16:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 17:16:16 -0700 |
commit | f6e2f46325d906e4d8a569826db28fa561de37d0 (patch) | |
tree | 6b4d3dd4cb4b2eb57c1ecf81b42d57e87464337a | |
parent | e460f5f8496a19e86616cb756e3cbf71e9f9d918 (diff) | |
parent | 8fc37006ff1e496e0063ddb839d7c28682b32a55 (diff) | |
download | chef-f6e2f46325d906e4d8a569826db28fa561de37d0.tar.gz |
Merge pull request #7609 from chef/inspector_library
Allow resource_inspector be used outside the binary
-rw-r--r-- | lib/chef/resource_inspector.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb index 10fa42c842..1559932940 100644 --- a/lib/chef/resource_inspector.rb +++ b/lib/chef/resource_inspector.rb @@ -81,7 +81,8 @@ module ResourceInspector # otherwise, if we have a path then extract all the resources from the cookbook # or else do a list of built in resources # - # @param complete [TrueClass, FalseClass] Whether to show properties defined in the base Resource class + # @param complete [TrueClass, FalseClass] Whether to show properties defined in the base Resource class + # @return [String] JSON formatting of all resources def self.inspect(arguments = [], complete: false) output = if arguments.empty? ObjectSpace.each_object(Class).select { |k| k < Chef::Resource }.each_with_object({}) { |klass, acc| acc[klass.resource_name] = extract_resource(klass) } @@ -96,11 +97,11 @@ module ResourceInspector end end - puts Chef::JSONCompat.to_json_pretty(output) + Chef::JSONCompat.to_json_pretty(output) end def self.start - inspect(ARGV, complete: true) + puts inspect(ARGV, complete: true) end end |