diff --git a/middleman-core/features/v3_extensions.feature b/middleman-core/features/v3_extensions.feature new file mode 100644 index 00000000..134dd72f --- /dev/null +++ b/middleman-core/features/v3_extensions.feature @@ -0,0 +1,20 @@ +Feature: v3 Modular Extension + Scenario: Registering and overwriting a system config option + Given a fixture app "large-build-app" + And a file named "config.rb" with: + """ + module MyFeature + class << self + def registered(app) + app.set :css_dir, "lib/my/css" + end + alias :included :registered + end + end + + ::Middleman::Extensions.register(:my_feature, MyFeature) + activate :my_feature + """ + Given a successfully built app at "large-build-app" + When I cd to "build" + Then the file "link_test.html" should contain "lib/my/css/test.css" \ No newline at end of file diff --git a/middleman-core/fixtures/large-build-app/source/link_test.html.erb b/middleman-core/fixtures/large-build-app/source/link_test.html.erb new file mode 100644 index 00000000..c5d6488e --- /dev/null +++ b/middleman-core/fixtures/large-build-app/source/link_test.html.erb @@ -0,0 +1,5 @@ +--- +layout: false +--- + +<%= stylesheet_link_tag :test %> \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/configuration.rb b/middleman-core/lib/middleman-core/configuration.rb index b1893db5..0b2454fa 100644 --- a/middleman-core/lib/middleman-core/configuration.rb +++ b/middleman-core/lib/middleman-core/configuration.rb @@ -22,7 +22,7 @@ module Middleman # @param default Attribute value # @return [void] def set(key, default=nil, &block) - config.define_setting(key, default) + config.define_setting(key, default) unless config.defines_setting?(key) @inst.set(key, default, &block) if @inst end