From 382107d40320dc8026f7aad304ccb2bb5a7cbd3b Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Wed, 8 Feb 2012 22:13:49 -0800 Subject: [PATCH] Get rid of build_reroute. The last thing using it was the sprockets extension, though it didn't appear to need it since removing the build_reroute call leaves tests passing, and the test site I tried still generated JS from CoffeeScript just fine. --- .../middleman-core/core_extensions/builder.rb | 38 ------------------- .../core_extensions/sprockets.rb | 14 +------ 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/builder.rb b/middleman-core/lib/middleman-core/core_extensions/builder.rb index 7f67222b..4b901b69 100644 --- a/middleman-core/lib/middleman-core/core_extensions/builder.rb +++ b/middleman-core/lib/middleman-core/core_extensions/builder.rb @@ -6,45 +6,7 @@ module Middleman::CoreExtensions::Builder # @private def registered(app) app.define_hook :after_build - app.extend ClassMethods - app.send :include, InstanceMethods - app.delegate :build_reroute, :to => :"self.class" end alias :included :registered end - - # Build Class Methods - module ClassMethods - # Get a list of callbacks which can modify a files build path - # Each callback takes a destination path and a request path and - # returns a new destination path, or false if it doesn't want to reroute. - # @return [Array] - def build_reroute(&block) - @build_rerouters ||= [] - @build_rerouters << block if block_given? - @build_rerouters - end - end - - # Build Instance Methods - module InstanceMethods - # Run through callbacks and get the new values - # - # @param [String] destination The current destination path of the built file - # @param [String] request_path The request path of the file - # @return [String] The new destination path - def reroute_builder(destination, request_path) - result = [destination, request_path] - - build_reroute.each do |block| - output = block.call(destination, request_path) - if output - result = output - break - end - end - - result - end - end end diff --git a/middleman-more/lib/middleman-more/core_extensions/sprockets.rb b/middleman-more/lib/middleman-more/core_extensions/sprockets.rb index 370534ea..cc1acaf8 100644 --- a/middleman-more/lib/middleman-more/core_extensions/sprockets.rb +++ b/middleman-more/lib/middleman-more/core_extensions/sprockets.rb @@ -13,18 +13,6 @@ module Middleman::CoreExtensions::Sprockets app.set :js_compressor, false app.set :css_compressor, false - # Cut off every extension after .js (which sprockets eats up) - app.build_reroute do |destination, request_path| - if !request_path.match(/\.js\./i) - false - else - [ - destination.gsub(/\.js(\..*)$/, ".js"), - request_path.gsub(/\.js(\..*)$/, ".js") - ] - end - end - # Once Middleman is setup app.ready do # Create sprockets env for JS @@ -172,4 +160,4 @@ module Middleman::CoreExtensions::Sprockets super(exception) end end -end \ No newline at end of file +end