Sha256: 695e1182f76f743ae1605f54f7ce2a972b87ca04d2687ed9f38a7d43561f3113

Contents?: true

Size: 1.15 KB

Versions: 41

Compression:

Stored size: 1.15 KB

Contents

module WebFontLoader
  class Modules

    def initialize(*modules)
      @project_root = WebFontLoader::ProjectRoot
      @js_src = "src"
      @js_test = "src-test"
      @modules = modules.empty? ? config.keys : modules
      # Make sure 'core' is first.
      @modules.unshift "core"
      @modules.uniq!
    end

    attr_reader :modules
    attr_accessor :project_root, :js_src, :js_test

    def all_source_files
      @all_source_files ||= begin
        modules.map { |mod| config[mod] }.compact.flatten.map { |f| File.join(js_src, f) }.push File.join(js_src, "async_load.js")
      end
    end

    def all_test_globs
      @all_test_globs ||= begin
        js_test_dirs = Dir[File.join(project_root, js_test, "*")].map { |d| File.basename(d) }
        js_test_dirs.map { |dir| File.join(js_test, dir, "*.js") if modules.include?(dir) }.compact
      end
    end

    def js_output_wrapper(source)
      File.read(File.join(js_src, "closure.js")).sub("{{source}}", source)
    end

  protected

    def config
      @config ||= begin
        path = File.join(project_root, js_src)
        YAML.load_file(File.join(path, "modules.yml"))
      end
    end

  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
webfontloader-1.4.11 lib/webfontloader/modules.rb
webfontloader-1.4.10 lib/webfontloader/modules.rb
webfontloader-1.4.9 lib/webfontloader/modules.rb
webfontloader-1.4.8 lib/webfontloader/modules.rb
webfontloader-1.4.7 lib/webfontloader/modules.rb
webfontloader-1.4.6 lib/webfontloader/modules.rb
webfontloader-1.4.5 lib/webfontloader/modules.rb
webfontloader-1.4.4 lib/webfontloader/modules.rb
webfontloader-1.4.3 lib/webfontloader/modules.rb
webfontloader-1.4.2 lib/webfontloader/modules.rb
webfontloader-1.4.1 lib/webfontloader/modules.rb
webfontloader-1.4.0 lib/webfontloader/modules.rb
webfontloader-1.3.2 lib/webfontloader/modules.rb
webfontloader-1.3.1 lib/webfontloader/modules.rb
webfontloader-1.3.0 lib/webfontloader/modules.rb
webfontloader-1.2.1 lib/webfontloader/modules.rb
webfontloader-1.2.0 lib/webfontloader/modules.rb
webfontloader-1.1.2 lib/webfontloader/modules.rb
webfontloader-1.1.1 lib/webfontloader/modules.rb
webfontloader-1.1.0 lib/webfontloader/modules.rb