def __init__(self, params): self.file_types_whitelist = params.file_types self.indexers = {} # Build a list of indexers which correspond to the given file types programming_languages = set() for file_type in self.file_types_whitelist: programming_languages.add(YavideUtils.file_type_to_programming_language(file_type)) for programming_language in programming_languages: self.indexers[programming_language] = YavideSourceCodeIndexerFactory.getIndexer(programming_language, params) # Setup the filesystem event monitoring self.event_handler = YavideFileSystemEventHandler(self) self.observer = Observer() self.observer.deamon = True self.observer.schedule(self.event_handler, params.proj_root_directory, recursive=True) # Print some debug information logging.info("File extension whitelist: {0}".format(self.file_types_whitelist)) logging.info("Active indexers:") for prog_language in programming_languages: logging.info("For [{0}] programming language:".format(prog_language)) indexers = self.indexers[prog_language] if indexers: for indexer in indexers: logging.info("\t\t {0}".format(indexer))
def __init__(self, params): self.file_types_whitelist = params.file_types self.indexers = {} # Build a list of indexers which correspond to the given file types programming_languages = set() for file_type in self.file_types_whitelist: programming_languages.add( YavideUtils.file_type_to_programming_language(file_type)) for programming_language in programming_languages: self.indexers[ programming_language] = YavideSourceCodeIndexerFactory.getIndexer( programming_language, params) # Setup the filesystem event monitoring self.event_handler = YavideFileSystemEventHandler(self) self.observer = Observer() self.observer.deamon = True self.observer.schedule(self.event_handler, params.proj_root_directory, recursive=True) # Print some debug information logging.info("File extension whitelist: {0}".format( self.file_types_whitelist)) logging.info("Active indexers:") for prog_language in programming_languages: logging.info( "For [{0}] programming language:".format(prog_language)) indexers = self.indexers[prog_language] if indexers: for indexer in indexers: logging.info("\t\t {0}".format(indexer))
def update(self, filename, event_type): file_type = os.path.splitext(filename)[1] if file_type in self.file_types_whitelist: programming_language = YavideUtils.file_type_to_programming_language(file_type) if programming_language in self.indexers: logging.info("Filename: '{0}' Event_type: '{1}' Programming lang: '{2}'".format( os.path.basename(filename), event_type, programming_language) ) indexers = self.indexers[programming_language] for indexer in indexers: indexer.update(filename, event_type)
def update(self, filename, event_type): file_type = os.path.splitext(filename)[1] if file_type in self.file_types_whitelist: programming_language = YavideUtils.file_type_to_programming_language( file_type) if programming_language in self.indexers: logging.info( "Filename: '{0}' Event_type: '{1}' Programming lang: '{2}'" .format(os.path.basename(filename), event_type, programming_language)) indexers = self.indexers[programming_language] for indexer in indexers: indexer.update(filename, event_type)