rana-cli/wakatime/project.py

44 lines
906 B
Python
Raw Normal View History

2013-07-06 07:51:09 +00:00
# -*- coding: utf-8 -*-
"""
wakatime.project
~~~~~~~~~~~~~~~~
Returns a project for the given file.
:copyright: (c) 2013 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
import logging
import os
from .projects.wakatime import WakaTime
2013-11-14 08:52:00 +00:00
from .projects.projectmap import ProjectMap
2013-07-06 07:51:09 +00:00
from .projects.git import Git
from .projects.mercurial import Mercurial
from .projects.subversion import Subversion
log = logging.getLogger(__name__)
PLUGINS = [
WakaTime,
2013-11-14 08:52:00 +00:00
ProjectMap,
2013-07-06 07:51:09 +00:00
Git,
Mercurial,
Subversion,
]
def find_project(path, config):
2013-07-06 07:51:09 +00:00
for plugin in PLUGINS:
plugin_name = plugin.__name__.lower()
if config.has_section(plugin_name):
plugin_config = config
else:
plugin_config = None
project = plugin(path, plugin_config)
if project.process():
2013-07-06 07:51:09 +00:00
return project
return None