From 296dd5ecb2910bfa952c315ec23550a6fb012679 Mon Sep 17 00:00:00 2001 From: alexbostock Date: Wed, 4 Jul 2018 15:08:32 +0100 Subject: [PATCH] Fix format of cask JSON output --- Library/Homebrew/cask/lib/hbc/cask.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 9402e8eec1..58ca6453ce 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -138,22 +138,24 @@ module Hbc "appcast" => appcast, "version" => version, "sha256" => sha256, - "artifacts" => {}, + "artifacts" => artifacts.map do |a| + if a.methods.include? :to_a + a.to_a + elsif a.methods.include? :to_h + a.to_h + else + a + end + end, "caveats" => caveats, "depends_on" => depends_on, - "conflicts_with" => conflicts_with, + "conflicts_with" => conflicts_with.to_a, "container" => container, "gpg" => gpg, "accessibility_access" => accessibility_access, "auto_updates" => auto_updates, } - artifacts.each do |a| - hsh["artifacts"][a.class.english_name] = a.summarize - end - - hsh["conflicts_with"] = [] if hsh["conflicts_with"].nil? - hsh end end