Class: ClosureDependenciesProcessor

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/closure-sprockets/processor.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(context, locals, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/closure-sprockets/processor.rb', line 4

def evaluate(context, locals, &block)
  context.require_asset 'goog/base'

  data.lines.each do |line|

    if line =~ /goog\.require\s*\(\s*[\'\"]([^\)]+)[\'\"]\s*\)/
      goog, mod, sub = $1.split(".")
      next if mod =~ /^Test/
      sub = mod if sub.nil?

      dep = [goog, mod, sub].compact.join("/").downcase
      context.require_asset(dep)
    end
  end

  data
end

#prepareObject



2
# File 'lib/closure-sprockets/processor.rb', line 2

def prepare; end