# Path: vimswitch/DiskIo.py
# def getDiskIo(app):
#     return app.get('diskIo', createDiskIo(app))
# 
# Path: vimswitch/FileDownloader.py
# def getFileDownloader(app):
#     return app.get('fileDownloader', createFileDownloader(app))
# 
# Path: vimswitch/GithubZipballExtractor.py
# def getGithubZipballExtractor(app):
#     return app.get('githubZipballExtractor', createGithubZipballExtractor(app))
# 
# Path: vimswitch/ProfileCache.py
# def getProfileCache(app):
#     return app.get('profileCache', createProfileCache(app))
# 
# Path: vimswitch/ProfileUrlResolver.py
# def getProfileUrl(profile):
#     prefix = 'https://github.com/'
#     suffix = '/archive/master.zip'
#     url = prefix + profile.getName() + suffix
#     return url
# 
# Path: vimswitch/Settings.py
# def getSettings(app):
#     return app.get('settings', createSettings(app))


from .DiskIo import getDiskIo
from .FileDownloader import getFileDownloader
from .GithubZipballExtractor import getGithubZipballExtractor
from .ProfileCache import getProfileCache
from .ProfileUrlResolver import getProfileUrl
from .Settings import getSettings
import os


class ProfileRetriever:
    def __init__(self, settings, fileDownloader, profileCache, diskIo, githubZipballExtractor):
        self.settings = settings
        self.fileDownloader = fileDownloader
        self.profileCache = profileCache
        self.diskIo = diskIo
        self.githubZipballExtractor = githubZipballExtractor

    def retrieve(self, profile):
        """
        Downloads a profile into the cache. If the profile already exists, then
        it is overwritten.
        """

# Path: vimswitch/DiskIo.py
# def getDiskIo(app):
#     return app.get('diskIo', createDiskIo(app))
# 
# Path: vimswitch/FileDownloader.py
# def getFileDownloader(app):
#     return app.get('fileDownloader', createFileDownloader(app))
# 
# Path: vimswitch/GithubZipballExtractor.py
# def getGithubZipballExtractor(app):
#     return app.get('githubZipballExtractor', createGithubZipballExtractor(app))
# 
# Path: vimswitch/ProfileCache.py
# def getProfileCache(app):
#     return app.get('profileCache', createProfileCache(app))
# 
# Path: vimswitch/ProfileUrlResolver.py
# def getProfileUrl(profile):
#     prefix = 'https://github.com/'
#     suffix = '/archive/master.zip'
#     url = prefix + profile.getName() + suffix
#     return url
# 
# Path: vimswitch/Settings.py
# def getSettings(app):
#     return app.get('settings', createSettings(app))


# Path: vimswitch/ProfileRetriever.py
from .DiskIo import getDiskIo
from .FileDownloader import getFileDownloader
from .GithubZipballExtractor import getGithubZipballExtractor
from .ProfileCache import getProfileCache
from .ProfileUrlResolver import getProfileUrl
from .Settings import getSettings
import os



class ProfileRetriever:
    def __init__(self, settings, fileDownloader, profileCache, diskIo, githubZipballExtractor):
        self.settings = settings
        self.fileDownloader = fileDownloader
        self.profileCache = profileCache
        self.diskIo = diskIo
        self.githubZipballExtractor = githubZipballExtractor

    def retrieve(self, profile):
        """
        Downloads a profile into the cache. If the profile already exists, then
        it is overwritten.
        """

        url = getProfileUrl(profile)