diff --git a/Rakefile b/Rakefile index 6d56986..5e89765 100755 --- a/Rakefile +++ b/Rakefile @@ -13,6 +13,7 @@ module PrototypeHelper TEST_UNIT_DIR = File.join(TEST_DIR, 'unit') TMP_DIR = File.join(TEST_UNIT_DIR, 'tmp') VERSION = YAML.load(IO.read(File.join(SRC_DIR, 'constants.yml')))['PROTOTYPE_VERSION'] + DEFAULT_SELECTOR_ENGINE = 'sizzle' %w[sprockets pdoc unittest_js caja_builder].each do |name| $:.unshift File.join(PrototypeHelper::ROOT_DIR, 'vendor', name, 'lib') @@ -45,8 +46,8 @@ module PrototypeHelper require_sprockets load_path = [SRC_DIR] - if selector = options[:selector_engine] - load_path << get_selector_engine(selector) + if selector_path = get_selector_engine(options[:selector_engine]) + load_path << selector_path end secretary = Sprockets::Secretary.new( @@ -66,7 +67,7 @@ module PrototypeHelper :path => 'src', :source => file, :destination => temp_path, - :selector_engine => ENV['SELECTOR_ENGINE'] || 'sizzle', + :selector_engine => ENV['SELECTOR_ENGINE'] || DEFAULT_SELECTOR_ENGINE, :strip_comments => false ) rm_rf DOC_DIR @@ -99,8 +100,7 @@ module PrototypeHelper def self.get_selector_engine(name) submodule_path = File.join(ROOT_DIR, "vendor", name) return submodule_path if File.exist?(File.join(submodule_path, "repository", ".git")) - ext_path = File.join(ROOT_DIR, "ext", name) - return ext_path if File.exist?(ext_path) + return if name == DEFAULT_SELECTOR_ENGINE get_submodule('the required selector engine', "#{name}/repository") unless File.exist?(submodule_path) @@ -151,7 +151,7 @@ task :dist do PrototypeHelper.sprocketize( :path => 'src', :source => 'prototype.js', - :selector_engine => ENV['SELECTOR_ENGINE'] || 'sizzle' + :selector_engine => ENV['SELECTOR_ENGINE'] || PrototypeHelper::DEFAULT_SELECTOR_ENGINE ) end