Class: Smith::ACLCompiler

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/smith/acl_compiler.rb

Instance Method Summary collapse

Methods included from Logger

included

Constructor Details

#initializeACLCompiler

Returns a new instance of ACLCompiler.



12
13
14
15
# File 'lib/smith/acl_compiler.rb', line 12

def initialize
  @acl_type_cache = AclTypeCache.instance
  @acl_parser = ACLParser.new
end

Instance Method Details

#compileObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/smith/acl_compiler.rb', line 17

def compile
  $LOAD_PATH << Smith.acl_cache_directory

  Smith.acl_directories.each do |path|
    $LOAD_PATH << path

    acl_files = path_glob(path)
    out_of_date_acls = path_glob(path).select { |p| should_compile?(p) }
    if out_of_date_acls.size > 0
      compile_on_path(path, acl_files, out_of_date_acls)
    end

    acl_files.each do |acl_file|
      acl_class_path = acl_compiled_path(acl_file)
      load_acl(acl_class_path)
      add_to_type_cache(acl_class_path)
    end
  end
end