diff --git a/middleman-cli/features/support/env.rb b/middleman-cli/features/support/env.rb index 3e14c957..64cfaef1 100644 --- a/middleman-cli/features/support/env.rb +++ b/middleman-cli/features/support/env.rb @@ -1,6 +1,8 @@ ENV['TEST'] = 'true' require 'backports/latest' +require 'active_support/all' + require 'sassc' require 'simplecov' diff --git a/middleman-core/features/incremental_builds.feature b/middleman-core/features/incremental_builds.feature index 5d1c9964..41264379 100644 --- a/middleman-core/features/incremental_builds.feature +++ b/middleman-core/features/incremental_builds.feature @@ -591,9 +591,9 @@ Feature: Incremental builds When a file named "source/roles/data.json.erb" with: """ { - "roles": <%= data.roles.select(&:salary).to_json %> + "roles": <%= data.roles.select(&:salary).to_json %>, + "roles2": <%= data.roles.first.as_json %> } """ - Then build the app tracking dependencies - Then there are "1" files which are created - # with depth "1" \ No newline at end of file + Then build the app tracking dependencies with depth "1" + Then there are "1" files which are created \ No newline at end of file diff --git a/middleman-core/features/support/env.rb b/middleman-core/features/support/env.rb index ac7e5491..127aa111 100644 --- a/middleman-core/features/support/env.rb +++ b/middleman-core/features/support/env.rb @@ -1,6 +1,8 @@ ENV['TEST'] = 'true' require 'backports/latest' +require 'active_support/all' + require 'sassc' require 'simplecov' diff --git a/middleman-core/lib/middleman-core.rb b/middleman-core/lib/middleman-core.rb index a83a8d94..12c413f8 100644 --- a/middleman-core/lib/middleman-core.rb +++ b/middleman-core/lib/middleman-core.rb @@ -3,6 +3,7 @@ libdir = __dir__ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) require 'backports/latest' +require 'active_support/all' # Top-level Middleman namespace module Middleman diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index d1c6b76e..51dd8225 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -1,4 +1,3 @@ -require 'active_support/core_ext/integer/inflections' require 'hamster' require 'middleman-core/contracts' require 'middleman-core/callback_manager' diff --git a/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb b/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb index 4d96aa77..5cce42ea 100644 --- a/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb +++ b/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb @@ -1,4 +1,3 @@ -require 'active_support/core_ext/object/deep_dup' require 'middleman-core/util' module Middleman diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb index 2115713b..0f575561 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb @@ -8,6 +8,10 @@ module Middleman class ArrayProxy < BaseProxy WRAPPED_LIST_METHODS = Set.new %i[each each_with_index select sort shuffle reverse rotate sample] + def respond_to_missing?(name, *) + self.class.const_get(:WRAPPED_LIST_METHODS).include?(name) || super + end + def method_missing(name, *args, &block) if self.class.const_get(:WRAPPED_LIST_METHODS).include?(name) log_access(:__full_access__) @@ -53,16 +57,6 @@ module Middleman end end - def to_s - log_access(:__full_access__) - @data.to_s - end - - def to_json(*args) - log_access(:__full_access__) - @data.to_a.to_json(*args) - end - private def wrapped_array diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb index a4381118..f3c99fc7 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb @@ -20,6 +20,10 @@ module Middleman @accessed_keys = ::Hamster::Set.new end + def respond_to_missing?(name, *) + @data.respond_to?(name) || super + end + def method_missing(name, *args, &block) if @data.respond_to?(name) log_access(:__full_access__) @@ -40,6 +44,11 @@ module Middleman @parent = new_parent end + def as_json(*args) + log_access(:__full_access__) + @data.as_json(*args) + end + protected def log_access(key) diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb index ccd3641a..cb3be832 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb @@ -14,6 +14,10 @@ module Middleman end alias get [] + def respond_to_missing?(name, *) + @data.key?(name) || super + end + def method_missing(name, *_args) return self[name] if @data.key?(name) @@ -21,16 +25,6 @@ module Middleman rescue NoMethodError nil end - - def to_s - log_access(:__full_access__) - @data.to_s - end - - def to_json(*args) - log_access(:__full_access__) - @data.to_h.to_json(*args) - end end end end diff --git a/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb index 91321a16..ef5fada9 100644 --- a/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb +++ b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb @@ -23,8 +23,6 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension def initialize(app, options_hash = ::Middleman::EMPTY_HASH, &block) super - require 'active_support/core_ext/object/to_query' - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::OutputHelpers ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::TagHelpers ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::AssetTagHelpers @@ -47,7 +45,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension options = parse_data_options(name, options) attributes = tag_attributes(options) - output = ActiveSupport::SafeBuffer.new + output = ::ActiveSupport::SafeBuffer.new output.safe_concat "<#{name}#{attributes}>" if content.respond_to?(:each) && !content.is_a?(String) diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index 414574a3..9804751f 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -4,8 +4,6 @@ require 'pathname' # DbC require 'middleman-core/contracts' -require 'active_support/core_ext/hash/keys' - require 'middleman-core/util/data' # Extensions namespace diff --git a/middleman-core/lib/middleman-core/extension.rb b/middleman-core/lib/middleman-core/extension.rb index 43d98690..90ccf81d 100644 --- a/middleman-core/lib/middleman-core/extension.rb +++ b/middleman-core/lib/middleman-core/extension.rb @@ -1,6 +1,5 @@ require 'forwardable' require 'memoist' -require 'active_support/core_ext/class/attribute' require 'middleman-core/configuration' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/extensions/minify_css.rb b/middleman-core/lib/middleman-core/extensions/minify_css.rb index 2859d784..64801c6e 100644 --- a/middleman-core/lib/middleman-core/extensions/minify_css.rb +++ b/middleman-core/lib/middleman-core/extensions/minify_css.rb @@ -1,4 +1,3 @@ -require 'active_support/core_ext/object/try' require 'memoist' require 'middleman-core/contracts' require 'rack/mime' diff --git a/middleman-core/lib/middleman-core/extensions/minify_javascript.rb b/middleman-core/lib/middleman-core/extensions/minify_javascript.rb index acfa3513..b7432f16 100644 --- a/middleman-core/lib/middleman-core/extensions/minify_javascript.rb +++ b/middleman-core/lib/middleman-core/extensions/minify_javascript.rb @@ -1,4 +1,3 @@ -require 'active_support/core_ext/object/try' require 'middleman-core/contracts' require 'memoist' diff --git a/middleman-core/lib/middleman-core/file_renderer.rb b/middleman-core/lib/middleman-core/file_renderer.rb index 3b85738f..a6e44435 100644 --- a/middleman-core/lib/middleman-core/file_renderer.rb +++ b/middleman-core/lib/middleman-core/file_renderer.rb @@ -1,7 +1,5 @@ require 'tilt' require 'hamster' -require 'active_support/core_ext/string/output_safety' -require 'active_support/core_ext/module/delegation' require 'middleman-core/contracts' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/logger.rb b/middleman-core/lib/middleman-core/logger.rb index d8e06bbe..989656b5 100644 --- a/middleman-core/lib/middleman-core/logger.rb +++ b/middleman-core/lib/middleman-core/logger.rb @@ -1,9 +1,7 @@ # Use the Ruby/Rails logger -require 'active_support/notifications' -require 'active_support/logger' module Middleman # The Middleman Logger - class Logger < ActiveSupport::Logger + class Logger < ::ActiveSupport::Logger def self.singleton(*args) if !@_logger || !args.empty? args = [0, false, args.first] if args.length == 1 && (args.first.is_a?(::String) || args.first.respond_to?(:write)) diff --git a/middleman-core/lib/middleman-core/preview_server/information.rb b/middleman-core/lib/middleman-core/preview_server/information.rb index 7c03b449..1e9a8236 100644 --- a/middleman-core/lib/middleman-core/preview_server/information.rb +++ b/middleman-core/lib/middleman-core/preview_server/information.rb @@ -1,5 +1,4 @@ require 'ipaddr' -require 'active_support/core_ext/object/blank' require 'middleman-core/preview_server/checks' require 'middleman-core/preview_server/server_hostname' require 'middleman-core/preview_server/server_ip_address' diff --git a/middleman-core/lib/middleman-core/renderers/erb.rb b/middleman-core/lib/middleman-core/renderers/erb.rb index 5305406f..0d541db4 100644 --- a/middleman-core/lib/middleman-core/renderers/erb.rb +++ b/middleman-core/lib/middleman-core/renderers/erb.rb @@ -13,7 +13,7 @@ module Middleman def precompiled_preamble(locals) original = super "__in_erb_template = true\n" << original - # .rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n" + # .rpartition("\n").first << "#{@outvar} = _buf = ::ActiveSupport::SafeBuffer.new\n" end end end diff --git a/middleman-core/lib/middleman-core/renderers/redcarpet.rb b/middleman-core/lib/middleman-core/renderers/redcarpet.rb index f08ddf5c..81c7af90 100644 --- a/middleman-core/lib/middleman-core/renderers/redcarpet.rb +++ b/middleman-core/lib/middleman-core/renderers/redcarpet.rb @@ -1,5 +1,4 @@ require 'redcarpet' -require 'active_support/core_ext/module/attribute_accessors' module Middleman module Renderers diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index 5c9acb6d..3170ebd0 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -1,5 +1,4 @@ # Used for merging results of metadata callbacks -require 'active_support/core_ext/hash/deep_merge' require 'monitor' require 'hamster' require 'middleman-core/extensions' diff --git a/middleman-core/lib/middleman-core/template_renderer.rb b/middleman-core/lib/middleman-core/template_renderer.rb index 03492838..9c29ca67 100644 --- a/middleman-core/lib/middleman-core/template_renderer.rb +++ b/middleman-core/lib/middleman-core/template_renderer.rb @@ -1,6 +1,5 @@ require 'tilt' require 'hamster' -require 'active_support/core_ext/string/output_safety' require 'middleman-core/contracts' require 'middleman-core/template_context' require 'middleman-core/file_renderer' diff --git a/middleman-core/lib/middleman-core/util.rb b/middleman-core/lib/middleman-core/util.rb index 9247e0e7..6f5f790f 100644 --- a/middleman-core/lib/middleman-core/util.rb +++ b/middleman-core/lib/middleman-core/util.rb @@ -1,6 +1,3 @@ -# For instrumenting -require 'active_support/notifications' - require 'middleman-core/application' require 'middleman-core/sources' require 'middleman-core/sitemap/resource' diff --git a/middleman-core/lib/middleman-core/util/uri_templates.rb b/middleman-core/lib/middleman-core/util/uri_templates.rb index 9fe1d772..1d8f04d6 100644 --- a/middleman-core/lib/middleman-core/util/uri_templates.rb +++ b/middleman-core/lib/middleman-core/util/uri_templates.rb @@ -1,8 +1,6 @@ # For URI templating require 'addressable/uri' require 'addressable/template' -require 'active_support/inflector' -require 'active_support/inflector/transliterate' module Middleman module Util diff --git a/middleman-core/spec/spec_helper.rb b/middleman-core/spec/spec_helper.rb index 563337a1..d808b2a4 100644 --- a/middleman-core/spec/spec_helper.rb +++ b/middleman-core/spec/spec_helper.rb @@ -1,3 +1,6 @@ +require 'backports/latest' +require 'active_support/all' + require 'simplecov' SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/..')) SimpleCov.start