Module: ActionviewPrecompiler

Defined in:
lib/actionview_precompiler.rb,
lib/actionview_precompiler/version.rb,
lib/actionview_precompiler/ast_parser.rb,
lib/actionview_precompiler/precompiler.rb,
lib/actionview_precompiler/helper_parser.rb,
lib/actionview_precompiler/render_parser.rb,
lib/actionview_precompiler/template_file.rb,
lib/actionview_precompiler/helper_scanner.rb,
lib/actionview_precompiler/parsed_filename.rb,
lib/actionview_precompiler/template_loader.rb,
lib/actionview_precompiler/template_parser.rb,
lib/actionview_precompiler/ast_parser/jruby.rb,
lib/actionview_precompiler/ast_parser/prism.rb,
lib/actionview_precompiler/template_scanner.rb,
lib/actionview_precompiler/ast_parser/ripper.rb,
lib/actionview_precompiler/ast_parser/ruby26.rb,
lib/actionview_precompiler/controller_parser.rb,
lib/actionview_precompiler/controller_scanner.rb

Defined Under Namespace

Modules: JRubyASTParser, PrismASTParser, RipperASTParser, Ruby26ASTParser Classes: ControllerParser, ControllerScanner, Error, HelperParser, HelperScanner, ParsedFilename, Precompiler, RenderCall, RenderParser, TemplateFile, TemplateLoader, TemplateParser, TemplateScanner

Constant Summary collapse

HANDLERS_FOR_EXTENSION =

Allow overriding from ActionView default handlers if necessary

Hash.new do |h, ext|
  h[ext] = ActionView::Template.handler_for_extension(ext)
end
VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.precompile(verbose: false) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/actionview_precompiler.rb', line 21

def self.precompile(verbose: false)
  precompiler = Precompiler.new(verbose: verbose)

  if block_given?
    # Custom configuration
    yield precompiler
  else
    # Scan view dirs
    ActionController::Base.view_paths.each do |view_path|
      precompiler.scan_view_dir view_path.path
    end

    # If we have an application, scan controllers
    if Rails.respond_to?(:application)
      Rails.application.paths["app/controllers"].each do |path|
        precompiler.scan_controller_dir path.to_s
      end

      Rails.application.paths["app/helpers"].each do |path|
        precompiler.scan_helper_dir path.to_s
      end
    end
  end

  precompiler.run
end