Method: Papers::Javascript.introspected
- Defined in:
- lib/papers/dependency_specification/javascript.rb
.introspected ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/papers/dependency_specification/javascript.rb', line 12 def self.introspected dirs = Papers.config.javascript_paths whitelist_dirs = Papers.config.whitelist_javascript_paths # TODO: add logic for determining rails. Is Rails.root better than Dir.pwd for such a case? root_regexp = /^#{Regexp.escape Dir.pwd.to_s}\// files = dirs.map { |dir| Dir.glob("#{dir}/**/*.{js,js.erb,coffee,coffee.erb}") }.flatten.map do |name| name = name.sub(root_regexp, '') name unless whitelist_dirs.any? { |dir| name.start_with?(dir) } end files.compact end |