# Path: revolver/core.py
# def run(*args, **kwargs):
#     if not env.sudo_forced:
#         return _run(*args, **kwargs)
# 
#     return sudo(*args, **kwargs)
# 
# 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/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/tool/php_build.py
# def install():
# def ensure():
# def _ensure_autoload(filename):
# 
# Path: revolver/tool/php_phpenv.py
# def install():
# def ensure():
# def _ensure_autoload(filename):


from revolver.core import run
from revolver import contextmanager as ctx
from revolver import directory as dir
from revolver import file, package
from revolver.tool import php_build, php_phpenv
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, with_statement



def install(version, fpm=False, xdebug=False):
    php_build.ensure()
    php_phpenv.ensure()

    switched = run("phpenv global %s; true" % version)
    if not switched == "":
        _install_php(version, fpm, xdebug)
        run("phpenv global %s" % version)

    run("phpenv rehash")
    _install_apc()
    _install_composer()


def _install_php(version, fpm, xdebug):

# Path: revolver/core.py
# def run(*args, **kwargs):
#     if not env.sudo_forced:
#         return _run(*args, **kwargs)
# 
#     return sudo(*args, **kwargs)
# 
# 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/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/tool/php_build.py
# def install():
# def ensure():
# def _ensure_autoload(filename):
# 
# Path: revolver/tool/php_phpenv.py
# def install():
# def ensure():
# def _ensure_autoload(filename):


# Path: revolver/tool/php.py
from revolver.core import run
from revolver import contextmanager as ctx
from revolver import directory as dir
from revolver import file, package
from revolver.tool import php_build, php_phpenv

# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, with_statement



def install(version, fpm=False, xdebug=False):
    php_build.ensure()
    php_phpenv.ensure()

    switched = run("phpenv global %s; true" % version)
    if not switched == "":
        _install_php(version, fpm, xdebug)
        run("phpenv global %s" % version)

    run("phpenv rehash")
    _install_apc()
    _install_composer()


def _install_php(version, fpm, xdebug):

    package.ensure([