aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/vendor
diff options
context:
space:
mode:
authorCharlie Sharpsteen2011-11-13 18:08:03 -0800
committerCharlie Sharpsteen2011-11-13 19:23:00 -0800
commit30745b90e8d04bf5115469ad183307ba64ea77a4 (patch)
treea27a88f5a5275f3834f78a807e2e2e32816494c4 /Library/Homebrew/vendor
parentcfd9d505b0e3061bedc5f2fb55374230960b9c44 (diff)
downloadhomebrew-30745b90e8d04bf5115469ad183307ba64ea77a4.tar.bz2
Hardwire multi_json backend
The `multi_json` gem dynamically selects a JSON implementation from a list of candidates. Since we cannot control which gems are installed on a user's machine, this patch hardwires `multi_json` to use the included copy of `ok_json`. `ok_json` is a pure-Ruby JSON encoder/decoder that is bundled with `multi_json`. `ok_json` may not be as fast as other choices, but speed is not critical for our application. Closes #8574. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Diffstat (limited to 'Library/Homebrew/vendor')
-rw-r--r--Library/Homebrew/vendor/multi_json.rb14
-rw-r--r--Library/Homebrew/vendor/multi_json/engines/ok_json.rb2
2 files changed, 2 insertions, 14 deletions
diff --git a/Library/Homebrew/vendor/multi_json.rb b/Library/Homebrew/vendor/multi_json.rb
index 201265e70..daa5ca5ac 100644
--- a/Library/Homebrew/vendor/multi_json.rb
+++ b/Library/Homebrew/vendor/multi_json.rb
@@ -22,18 +22,6 @@ module MultiJson
# if any engines are already loaded, then checks
# to see which are installed if none are loaded.
def default_engine
- return :yajl if defined?(::Yajl)
- return :json_gem if defined?(::JSON)
-
- REQUIREMENT_MAP.each do |(library, engine)|
- begin
- require library
- return engine
- rescue LoadError
- next
- end
- end
-
:ok_json
end
@@ -47,7 +35,7 @@ module MultiJson
def engine=(new_engine)
case new_engine
when String, Symbol
- require "multi_json/engines/#{new_engine}"
+ require "vendor/multi_json/engines/#{new_engine}"
@engine = MultiJson::Engines.const_get("#{new_engine.to_s.split('_').map{|s| s.capitalize}.join('')}")
when Class
@engine = new_engine
diff --git a/Library/Homebrew/vendor/multi_json/engines/ok_json.rb b/Library/Homebrew/vendor/multi_json/engines/ok_json.rb
index c06f80123..07a110f6f 100644
--- a/Library/Homebrew/vendor/multi_json/engines/ok_json.rb
+++ b/Library/Homebrew/vendor/multi_json/engines/ok_json.rb
@@ -1,4 +1,4 @@
-require "multi_json/vendor/ok_json" unless defined?(::OkJson)
+require "vendor/multi_json/vendor/ok_json" unless defined?(::OkJson)
module MultiJson
module Engines