From 59a07d4cc027b5a01641cc4c7bc75080085fae05 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 6 Jul 2011 10:30:24 -0700 Subject: [PATCH] make data dir configurable --- lib/middleman/core_extensions/data.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/middleman/core_extensions/data.rb b/lib/middleman/core_extensions/data.rb index eedfa55d..84e3c3dc 100755 --- a/lib/middleman/core_extensions/data.rb +++ b/lib/middleman/core_extensions/data.rb @@ -5,6 +5,7 @@ require "thor" module Middleman::CoreExtensions::Data class << self def registered(app) + app.set :data_dir, "data" app.extend ClassMethods app.helpers Helpers end @@ -33,7 +34,7 @@ module Middleman::CoreExtensions::Data elsif @@remote_sources.has_key?(path.to_s) response = HTTParty.get(@@remote_sources[path.to_s]).parsed_response else - file_path = File.join(@app.class.root, "data", "#{path}.yml") + file_path = File.join(@app.class.root, @app.class.data_dir, "#{path}.yml") if File.exists? file_path response = YAML.load_file(file_path) end