From df31f655222359129a24a506378fe9331764f590 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 4 Jul 2012 11:29:00 -0700 Subject: [PATCH] Make automatic helpers smarter. Fixes #510 --- .../external-helpers/helpers/{three_helper.rb => derp.rb} | 2 +- .../helpers/{four_helper.rb => four_helpers.rb} | 2 +- middleman-core/fixtures/external-helpers/helpers/two_helper.rb | 3 --- .../fixtures/external-helpers/helpers/yet_another_thingy.rb | 3 +++ .../lib/middleman-core/core_extensions/external_helpers.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename middleman-core/fixtures/external-helpers/helpers/{three_helper.rb => derp.rb} (54%) rename middleman-core/fixtures/external-helpers/helpers/{four_helper.rb => four_helpers.rb} (52%) delete mode 100644 middleman-core/fixtures/external-helpers/helpers/two_helper.rb create mode 100644 middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb diff --git a/middleman-core/fixtures/external-helpers/helpers/three_helper.rb b/middleman-core/fixtures/external-helpers/helpers/derp.rb similarity index 54% rename from middleman-core/fixtures/external-helpers/helpers/three_helper.rb rename to middleman-core/fixtures/external-helpers/helpers/derp.rb index 067137be..5e6ea1fe 100644 --- a/middleman-core/fixtures/external-helpers/helpers/three_helper.rb +++ b/middleman-core/fixtures/external-helpers/helpers/derp.rb @@ -1,3 +1,3 @@ -module ThreeHelper +module Derp def three; "Three"; end end \ No newline at end of file diff --git a/middleman-core/fixtures/external-helpers/helpers/four_helper.rb b/middleman-core/fixtures/external-helpers/helpers/four_helpers.rb similarity index 52% rename from middleman-core/fixtures/external-helpers/helpers/four_helper.rb rename to middleman-core/fixtures/external-helpers/helpers/four_helpers.rb index a0bb07cb..4e05c65e 100644 --- a/middleman-core/fixtures/external-helpers/helpers/four_helper.rb +++ b/middleman-core/fixtures/external-helpers/helpers/four_helpers.rb @@ -1,3 +1,3 @@ -module FourHelper +module FourHelpers def four; "Four"; end end \ No newline at end of file diff --git a/middleman-core/fixtures/external-helpers/helpers/two_helper.rb b/middleman-core/fixtures/external-helpers/helpers/two_helper.rb deleted file mode 100644 index b6c2e26e..00000000 --- a/middleman-core/fixtures/external-helpers/helpers/two_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -module TwoHelper - def two; "Two"; end -end \ No newline at end of file diff --git a/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb b/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb new file mode 100644 index 00000000..b7e6f003 --- /dev/null +++ b/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb @@ -0,0 +1,3 @@ +module YetAnotherThingy + def two; "Two"; end +end \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb b/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb index 4a9d779e..fc0b726c 100644 --- a/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb +++ b/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb @@ -10,7 +10,7 @@ module Middleman def registered(app) # Setup a default helpers paths app.set :helpers_dir, "helpers" - app.set :helpers_filename_glob, "**/*_helper.rb" + app.set :helpers_filename_glob, "**/*.rb" app.set :helpers_filename_to_module_name_proc, Proc.new { |filename| basename = File.basename(filename, File.extname(filename)) basename.camelcase