Use native Ruby JSON implementation instead of ActiveSupport's.

This commit is contained in:
Mauro Otonelli 2015-07-14 19:30:17 -03:00
parent c14fd72d04
commit 63d6a00ed9
2 changed files with 4 additions and 4 deletions

View file

@ -9,7 +9,7 @@ module Middleman
def registered(app) def registered(app)
# Data formats # Data formats
require 'yaml' require 'yaml'
require 'active_support/json' require 'json'
app.config.define_setting :data_dir, 'data', 'The directory data files are stored in' app.config.define_setting :data_dir, 'data', 'The directory data files are stored in'
app.send :include, InstanceMethods app.send :include, InstanceMethods
@ -98,7 +98,7 @@ module Middleman
if %w(.yaml .yml).include?(extension) if %w(.yaml .yml).include?(extension)
data = YAML.load_file(full_path) data = YAML.load_file(full_path)
elsif extension == '.json' elsif extension == '.json'
data = ActiveSupport::JSON.decode(full_path.read) data = JSON.parse(full_path.read)
else else
return return
end end

View file

@ -5,7 +5,7 @@ require 'pathname'
require 'yaml' require 'yaml'
# Parsing JSON frontmatter # Parsing JSON frontmatter
require 'active_support/json' require 'json'
# Extensions namespace # Extensions namespace
module Middleman::CoreExtensions module Middleman::CoreExtensions
@ -154,7 +154,7 @@ module Middleman::CoreExtensions
begin begin
json = ($1 + $2).sub(';;;', '{').sub(';;;', '}') json = ($1 + $2).sub(';;;', '{').sub(';;;', '}')
data = ActiveSupport::JSON.decode(json).symbolize_keys data = JSON.parse(json).symbolize_keys
rescue => e rescue => e
app.logger.error "JSON Exception parsing #{full_path}: #{e.message}" app.logger.error "JSON Exception parsing #{full_path}: #{e.message}"
return false return false