Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback json library #889

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion Gemfile
Expand Up @@ -3,7 +3,11 @@ source 'https://rubygems.org'
gem 'typhoeus', '~>0.8.0'
gem 'nokogiri'
gem 'addressable'
gem 'yajl-ruby' # Better JSON parser regarding memory usage
if defined?(JRUBY_VERSION)
gem 'json'
else
gem 'yajl-ruby' # Better JSON parser regarding memory usage
end
# TODO: update the below when terminal-table 1.5.3+ is released.
# (and delete the Terminal module in lib/common/hacks.rb)
gem 'terminal-table', '~>1.4.5'
Expand Down
7 changes: 6 additions & 1 deletion lib/environment.rb
Expand Up @@ -31,7 +31,12 @@
require 'pathname'
# Third party libs
require 'typhoeus'
require 'yajl/json_gem'
begin
require 'yajl/json_gem'
rescue LoadError
# Require basic json library if yajl is not available
require 'json'
end
require 'nokogiri'
require 'terminal-table'
require 'ruby-progressbar'
Expand Down