Method: Innate::Node#update_mapping_shared

Defined in:
lib/innate/node.rb

#update_mapping_shared(paths) ⇒ Object



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'lib/innate/node.rb', line 803

def update_mapping_shared(paths)
  mapping = {}

  provides.each do |wish_key, engine|
    wish = wish_key[/(.*)_handler/, 1]
    ext_glob = ext_glob(wish)

    paths.reverse_each do |path|
      ::Dir.glob(::File.join(path, "/**/*.#{ext_glob}")) do |file|
        case file.sub(path, '').gsub('/', '__')
        when /^(.*)\.(.*)\.(.*)$/
          action_name, wish_ext, engine_ext = $1, $2, $3
        when /^(.*)\.(.*)$/
          action_name, wish_ext, engine_ext = $1, wish, $2
        end

        mapping[wish_ext] ||= {}
        mapping[wish_ext][action_name] = file
      end
    end
  end

  return mapping
end