Sha256: a343fcafba729574e86e4127a672e7fde3286874e64b4361255938f3f973d6a4
Contents?: true
Size: 949 Bytes
Versions: 8
Compression:
Stored size: 949 Bytes
Contents
module SandboxAssets class TestAsset class << self def find_tests(params) find params, all(config.tests_patterns, /(\.js|\.coffee).*/) end def find_stylesheets(params) find params, all(config.stylesheets_patterns, /(\.css|\.scss|\.sass|\.less).*/) end protected def find(params, file_list) return file_list unless path = params[:path] file_list.find_all {|fn| fn.start_with? path } end def all(patterns, remove_regexp) files = [] config.tests_roots.each do |root| patterns.each do |pattern| test_dir = Rails.root.join root files.concat Dir[test_dir.join pattern].sort.map { |fn| fn.sub(test_dir.to_s, '').sub(remove_regexp, '')[1..-1] } end end files end def config @@config ||= Engine.config.sandbox_assets end end end end
Version data entries
8 entries across 8 versions & 1 rubygems