# Path: staticsites/utilities.py
# def dump_storage(storage):
# def load_storage(string):
# def has_extension(path, extensions):
# def is_xml(app, deploy_type, path):
# def is_html(app, deploy_type, path):
# def is_css(app, deploy_type, path):
# def is_js(app, deploy_type, path):
# def get_conf(key, app='', deploy_type='', path='', input=None):
# def get_default_deploy_type():
# def get_path(func_name=None, app=None, deploy_type=None, path=None):
# def get_minify(minify=None, app=None, deploy_type=None, path=None):
# def get_gzip(gzip=None, app=None, deploy_type=None, path=None):
# def get_encoding(encoding=None, app=None, deploy_type=None, path=None):
# def get_file_storage(file_storage=None, app=None, deploy_type=None, path=None):
# def get_storages(file_storage=None, app=None, deploy_type=None, path=None, **kwargs):
# def get_deploy_root(deploy_root=None, app=None, deploy_type=None, path=None):
# def get_deploy_root_date_format(deploy_root_date_format=None, app=None, deploy_type=None, path=None):
# def get_default_index(app=None, deploy_type=None):
# def iterate_dir(path, callback, ignore=None, deploy_type=None, *args, **kwargs):
#     def _iterate_dir(path, sub_path, callback, ignore, *args, **kwargs):
# def read_binary(path):
# def read_text(path):
# def read_gzip_file(path):
# def file_from_content(content, gzip=False):
# def invalidate_paths(deploy_type, paths, *args, **kwargs):
# def git_match(pattern, path):
# def ignore_file(path, deploy_type=None):
# def ignore_files(path, sub_path, files, deploy_type=None):


import io
import hashlib
import logging
import StringIO
from urlparse import urljoin
from utilities import file_from_content
from gzip import GzipFile
from os.path import abspath, join, getmtime, dirname, isdir
from staticsites import utilities
from datetime import datetime
from inspect import getmembers, isfunction
from django.conf import settings
from django.utils.module_loading import import_module
from django.db.models import Q
from django.http import HttpRequest
from models import DeployOperation, Deploy
        from django.contrib.staticfiles.templatetags import staticfiles
        from django.contrib.admin.templatetags import admin_static

__author__ = 'Christian Bianciotto'







class DefaultDeployUtilities:
    def __init__(self, deploy_type, force):
        self.deploy_type = deploy_type
        self.force = force
        self.deploy = None
        self.storage = None

        self.paths = []
        self.deploy_operations = []

    def copy(self, path, sub_path, *args, **kwargs):
        static_root = utilities.get_conf('STATICSITE_STATIC_ROOT', self.deploy_type)

        full_path = join(path, sub_path)
        storage_path = join(static_root, sub_path)

        # TODO get also from staticfiles dir (trasforme tupla to dict?)
        minify = utilities.get_minify(None, None, self.deploy_type, sub_path)
        gzip = utilities.get_gzip(None, None, self.deploy_type, sub_path)
        storages = utilities.get_storages(None, None, self.deploy_type, sub_path, **kwargs)

# Path: staticsites/utilities.py
# def dump_storage(storage):
# def load_storage(string):
# def has_extension(path, extensions):
# def is_xml(app, deploy_type, path):
# def is_html(app, deploy_type, path):
# def is_css(app, deploy_type, path):
# def is_js(app, deploy_type, path):
# def get_conf(key, app='', deploy_type='', path='', input=None):
# def get_default_deploy_type():
# def get_path(func_name=None, app=None, deploy_type=None, path=None):
# def get_minify(minify=None, app=None, deploy_type=None, path=None):
# def get_gzip(gzip=None, app=None, deploy_type=None, path=None):
# def get_encoding(encoding=None, app=None, deploy_type=None, path=None):
# def get_file_storage(file_storage=None, app=None, deploy_type=None, path=None):
# def get_storages(file_storage=None, app=None, deploy_type=None, path=None, **kwargs):
# def get_deploy_root(deploy_root=None, app=None, deploy_type=None, path=None):
# def get_deploy_root_date_format(deploy_root_date_format=None, app=None, deploy_type=None, path=None):
# def get_default_index(app=None, deploy_type=None):
# def iterate_dir(path, callback, ignore=None, deploy_type=None, *args, **kwargs):
#     def _iterate_dir(path, sub_path, callback, ignore, *args, **kwargs):
# def read_binary(path):
# def read_text(path):
# def read_gzip_file(path):
# def file_from_content(content, gzip=False):
# def invalidate_paths(deploy_type, paths, *args, **kwargs):
# def git_match(pattern, path):
# def ignore_file(path, deploy_type=None):
# def ignore_files(path, sub_path, files, deploy_type=None):


# Path: staticsites/deploy.py
import io
import hashlib
import logging
import StringIO
from urlparse import urljoin
from utilities import file_from_content
from gzip import GzipFile
from os.path import abspath, join, getmtime, dirname, isdir
from staticsites import utilities
from datetime import datetime
from inspect import getmembers, isfunction
from django.conf import settings
from django.utils.module_loading import import_module
from django.db.models import Q
from django.http import HttpRequest
from models import DeployOperation, Deploy
        from django.contrib.staticfiles.templatetags import staticfiles
        from django.contrib.admin.templatetags import admin_static


__author__ = 'Christian Bianciotto'







class DefaultDeployUtilities:
    def __init__(self, deploy_type, force):
        self.deploy_type = deploy_type
        self.force = force
        self.deploy = None
        self.storage = None

        self.paths = []
        self.deploy_operations = []

    def copy(self, path, sub_path, *args, **kwargs):
        static_root = utilities.get_conf('STATICSITE_STATIC_ROOT', self.deploy_type)

        full_path = join(path, sub_path)
        storage_path = join(static_root, sub_path)

        # TODO get also from staticfiles dir (trasforme tupla to dict?)
        minify = utilities.get_minify(None, None, self.deploy_type, sub_path)
        gzip = utilities.get_gzip(None, None, self.deploy_type, sub_path)
        storages = utilities.get_storages(None, None, self.deploy_type, sub_path, **kwargs)

        encoding = utilities.get_encoding(None, None, self.deploy_type, sub_path)