Class: Chef::Taste::JSONDisplay

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/taste/display.rb

Overview

Displays the cookbook dependency status in JSON format

Class Method Summary collapse

Class Method Details

.dependencies_hash(dependencies) ⇒ Object

Converts the dependency objects to JSON object

Parameters:

  • dependencies (Array<Dependency>)

    list of cookbook dependency objects



122
123
124
125
126
127
128
# File 'lib/chef/taste/display.rb', line 122

def dependencies_hash(dependencies)
  {}.tap do |hash|
    dependencies.each do |dependency|
      hash[dependency.name] = dependency.to_hash
    end
  end
end

Prints the status of dependent in JSON

Parameters:

  • dependencies (Array<Dependency>)

    list of cookbook dependency objects



114
115
116
# File 'lib/chef/taste/display.rb', line 114

def print(dependencies)
  puts JSON.pretty_generate(dependencies_hash(dependencies))
end