diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index db0ece584a..0b81e037ab 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -18,3 +18,4 @@ require "compat/language/haskell" require "compat/xcode" require "compat/software_spec" require "compat/utils" +require "compat/json" diff --git a/Library/Homebrew/utils/json.rb b/Library/Homebrew/compat/json.rb similarity index 77% rename from Library/Homebrew/utils/json.rb rename to Library/Homebrew/compat/json.rb index 21c5b52b0a..c8bf1c292a 100644 --- a/Library/Homebrew/utils/json.rb +++ b/Library/Homebrew/compat/json.rb @@ -7,16 +7,19 @@ module Utils Error = Class.new(StandardError) def load(str) - ::JSON.load(str) + odeprecated "Utils::JSON.load", "JSON.parse" + ::JSON.parse(str) rescue ::JSON::ParserError => e raise Error, e.message end def dump(obj) + odeprecated "Utils::JSON.dump", "JSON.generate" ::JSON.generate(obj) end def stringify_keys(obj) + odeprecated "Utils::JSON.stringify_keys" case obj when Array obj.map { |val| stringify_keys(val) } diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 7a7673d017..89a90bed2d 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -9,7 +9,6 @@ require "utils/git" require "utils/github" require "utils/hash" require "utils/inreplace" -require "utils/json" require "utils/popen" require "utils/tty"