Merge pull request #1560 from mauro-oto/remove_active_support_json

Drop active_support's JSON in favor of native JSON implementation
This commit is contained in:
Eliott Appleford 2015-07-15 12:03:06 +01:00
commit a855b634e6
4 changed files with 5 additions and 9 deletions

View file

@ -6,7 +6,7 @@ gem 'yard', '~> 0.8', require: false
# Test tools # Test tools
gem 'pry', '~> 0.10', group: :development gem 'pry', '~> 0.10', group: :development
gem 'aruba', '~> 0.6' gem 'aruba', '~> 0.7.4'
gem 'rspec', '~> 3.0' gem 'rspec', '~> 3.0'
gem 'fivemat', '~> 1.3' gem 'fivemat', '~> 1.3'
gem 'cucumber', '~> 1.3' gem 'cucumber', '~> 1.3'

View file

@ -8,10 +8,6 @@ require 'i18n'
# users expect. # users expect.
::I18n.enforce_available_locales = false ::I18n.enforce_available_locales = false
# Use ActiveSupport JSON
require 'active_support/json'
require 'active_support/core_ext/integer/inflections'
# Simple callback library # Simple callback library
require 'hooks' require 'hooks'

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