From 57c035f06a74b63d23d2452296252b0de54db104 Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Wed, 12 Dec 2012 12:27:03 -0600 Subject: [PATCH] Added gem_assets config. --- lib/jasmine/headless/files_list.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/jasmine/headless/files_list.rb b/lib/jasmine/headless/files_list.rb index aad2d62..00a8a20 100644 --- a/lib/jasmine/headless/files_list.rb +++ b/lib/jasmine/headless/files_list.rb @@ -1,6 +1,7 @@ require 'jasmine-core' require 'time' require 'multi_json' +require 'rubygems' require 'set' require 'sprockets' require 'sprockets/engines' @@ -130,8 +131,14 @@ module Jasmine::Headless @search_paths += src_dir.collect { |dir| File.expand_path(dir) } @search_paths += asset_paths.collect { |dir| File.expand_path(dir) } @search_paths += spec_dir.collect { |dir| File.expand_path(dir) } + @search_paths += gem_assets.collect do |name, dirs| + dirs.collect do |dir| + File.expand_path(File.join(gem_dir(name), dir)) + end + end.flatten @search_paths.uniq! + @search_paths end @@ -291,6 +298,10 @@ module Jasmine::Headless @asset_paths ||= config_dir('asset_paths') end + def gem_assets + @gem_assets ||= @options[:config]['gem_assets'] + end + def spec_file_searches @searches['spec_files'] end @@ -320,6 +331,12 @@ module Jasmine::Headless def spec_helper File.join(spec_dir, "helpers", "spec_helper") end + + def gem_dir gem + return unless gemspec = Gem.loaded_specs[gem] + + gemspec.gem_dir + end end end