mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
01c0e7758e
standalone and Python source wakatime-cli versions.
This partially reverts commit d588451468
.
34 lines
823 B
Python
34 lines
823 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
wakatime.dependencies.unknown
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
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):
|
|
|
|
def parse(self):
|
|
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'])
|