diff --git a/features/helpers_external.feature b/features/helpers_external.feature new file mode 100644 index 00000000..6e6b6f7b --- /dev/null +++ b/features/helpers_external.feature @@ -0,0 +1,6 @@ +Feature: Helpers in external files + + Scenario: Hello Helper + Given the Server is running at "external-helpers" + Then going to "/index.html" should not raise an exception + And I should see "Hello World" \ No newline at end of file diff --git a/fixtures/external-helpers/config.rb b/fixtures/external-helpers/config.rb new file mode 100644 index 00000000..3de1ebc7 --- /dev/null +++ b/fixtures/external-helpers/config.rb @@ -0,0 +1,4 @@ +require "lib/hello_helper" +helpers HelloHelper + +page "/", :layout => false \ No newline at end of file diff --git a/fixtures/external-helpers/lib/hello_helper.rb b/fixtures/external-helpers/lib/hello_helper.rb new file mode 100644 index 00000000..1b2e6e99 --- /dev/null +++ b/fixtures/external-helpers/lib/hello_helper.rb @@ -0,0 +1,5 @@ +module HelloHelper + def hello + "Hello World" + end +end \ No newline at end of file diff --git a/fixtures/external-helpers/source/index.html.erb b/fixtures/external-helpers/source/index.html.erb new file mode 100644 index 00000000..efafd361 --- /dev/null +++ b/fixtures/external-helpers/source/index.html.erb @@ -0,0 +1 @@ +<%= hello %> \ No newline at end of file diff --git a/lib/middleman/core_extensions/extensions.rb b/lib/middleman/core_extensions/extensions.rb index 6ddd1b7c..c0644ef6 100644 --- a/lib/middleman/core_extensions/extensions.rb +++ b/lib/middleman/core_extensions/extensions.rb @@ -94,6 +94,9 @@ module Middleman::CoreExtensions::Extensions run_hook :before_configuration + # Search the root of the project for required files + $LOAD_PATH.unshift(root) + # Check for and evaluate local configuration local_config = File.join(root, "config.rb") if File.exists? local_config