2014-12-25 07:04:39 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
2018-03-15 08:31:17 +00:00
|
|
|
wakatime.dependencies.unknown
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2014-12-25 07:04:39 +00:00
|
|
|
|
|
|
|
Parse dependencies from files of unknown language.
|
|
|
|
|
|
|
|
:copyright: (c) 2014 Alan Hamlett.
|
|
|
|
:license: BSD, see LICENSE for more details.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
from . import TokenParser
|
|
|
|
|
|
|
|
|
|
|
|
FILES = {
|
|
|
|
'bower': {'exact': False, 'dependency': 'bower'},
|
|
|
|
'grunt': {'exact': False, 'dependency': 'grunt'},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class UnknownParser(TokenParser):
|
|
|
|
|
2015-09-29 10:11:25 +00:00
|
|
|
def parse(self):
|
2014-12-25 07:04:39 +00:00
|
|
|
self._process_file_name(os.path.basename(self.source_file))
|
|
|
|
return self.dependencies
|
|
|
|
|
|
|
|
def _process_file_name(self, file_name):
|
|
|
|
for key, value in FILES.items():
|
|
|
|
found = (key == file_name) if value.get('exact') else (key.lower() in file_name.lower())
|
|
|
|
if found:
|
|
|
|
self.append(value['dependency'])
|