# Path: revolver/core.py
# def sudo(*args, **kwargs):
#     if env.sudo_user:
#         kwargs['user'] = env.sudo_user
# 
#     return _sudo(*args, **kwargs)
# 
# Path: revolver/command.py

# 
# Path: revolver/file.py
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def touch(location, mode=None, owner=None, group=None):
# def copy(source, destination, force=True, mode=None, owner=None, group=None):
# 
# Path: revolver/package.py
# def is_installed(name):
# def install_ppa(name):
# 
# Path: revolver/server.py
# def timezone(zone='UTC'):
# def version():
# def codename():
# 
# Path: revolver/service.py
# def add_upstart(name, content):
# def command(name, command):
# def start(name):
# def stop(name):
# def restart(name):
# def reload(name):
# def is_running(name):
# 
# Path: revolver/contextmanager.py
# def sudo(username=None, login=False):
# def unpatched_state():
# 
# Path: revolver/directory.py
# def temp_local():
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def create(path, recursive=False, mode=None, owner=None, group=None):


from revolver.core import sudo
from revolver import command, file, package, server, service
from revolver import contextmanager as ctx
from revolver import directory as dir

    if not already_installed:
        site_disable('default')

    www_dir = '/var/www'
    www_owner = 'www-data'
    if not dir.exists(www_dir):
        with ctx.sudo():
            dir.create(www_dir)
            dir.attributes(www_dir, owner=www_owner, group=www_owner)

    restart()


def ensure():
    if not command.exists('nginx'):
        install()


def restart():
    service.restart('nginx')


def reload():
    service.reload('nginx')


def site_disable(site):
    with ctx.sudo():
        with ctx.cd('/etc/nginx/sites-enabled'):

# Path: revolver/core.py
# def sudo(*args, **kwargs):
#     if env.sudo_user:
#         kwargs['user'] = env.sudo_user
# 
#     return _sudo(*args, **kwargs)
# 
# Path: revolver/command.py

# 
# Path: revolver/file.py
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def touch(location, mode=None, owner=None, group=None):
# def copy(source, destination, force=True, mode=None, owner=None, group=None):
# 
# Path: revolver/package.py
# def is_installed(name):
# def install_ppa(name):
# 
# Path: revolver/server.py
# def timezone(zone='UTC'):
# def version():
# def codename():
# 
# Path: revolver/service.py
# def add_upstart(name, content):
# def command(name, command):
# def start(name):
# def stop(name):
# def restart(name):
# def reload(name):
# def is_running(name):
# 
# Path: revolver/contextmanager.py
# def sudo(username=None, login=False):
# def unpatched_state():
# 
# Path: revolver/directory.py
# def temp_local():
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def create(path, recursive=False, mode=None, owner=None, group=None):


# Path: revolver/tool/nginx.py
from revolver.core import sudo
from revolver import command, file, package, server, service
from revolver import contextmanager as ctx
from revolver import directory as dir


    if not already_installed:
        site_disable('default')

    www_dir = '/var/www'
    www_owner = 'www-data'
    if not dir.exists(www_dir):
        with ctx.sudo():
            dir.create(www_dir)
            dir.attributes(www_dir, owner=www_owner, group=www_owner)

    restart()


def ensure():
    if not command.exists('nginx'):
        install()


def restart():
    service.restart('nginx')


def reload():
    service.reload('nginx')


def site_disable(site):
    with ctx.sudo():
        with ctx.cd('/etc/nginx/sites-enabled'):

            file.remove(site)