# Path: py_mina/state.py
# def set(key, value):
# 
# Path: py_mina/echo.py
# def echo_task(message, error=False):
#     color = red if error == True else yellow
#     
#     print(color('\n=====> %s' % message))


import timeit
from fabric.api import task, settings
from py_mina.state import state, set_state
from py_mina.subtasks.deploy import *
from py_mina.echo import echo_task
				set_state('finalize', True)
			except Exception as error:
				set_state('finalize', error)


		def _on_success_deploy():
			if  state.get('success') == True and callable(on_success):
				try: 
					on_success()

					set_state('on_success', True)
				except Exception as error:
					set_state('on_success', error)


		def deploy_wrapper(*args):
			"""
			Runs deploy process on remote server
				1) Pre deploy (lock, build path, latest_release)
				2) Deploy
				3) Post deploy (move to releases, link release to current)
				4) Finalize deploy (cleanup, remove build path, unlock)
				5) Runs `on_success` callback function if deploy successfully finished
				6) Shows deploy stats
			"""
			
			start_time = timeit.default_timer()

			check_deploy_config()


# Path: py_mina/state.py
# def set(key, value):
# 
# Path: py_mina/echo.py
# def echo_task(message, error=False):
#     color = red if error == True else yellow
#     
#     print(color('\n=====> %s' % message))


# Path: py_mina/decorators/deploy.py
import timeit
from fabric.api import task, settings
from py_mina.state import state, set_state
from py_mina.subtasks.deploy import *
from py_mina.echo import echo_task

				set_state('finalize', True)
			except Exception as error:
				set_state('finalize', error)


		def _on_success_deploy():
			if  state.get('success') == True and callable(on_success):
				try: 
					on_success()

					set_state('on_success', True)
				except Exception as error:
					set_state('on_success', error)


		def deploy_wrapper(*args):
			"""
			Runs deploy process on remote server
				1) Pre deploy (lock, build path, latest_release)
				2) Deploy
				3) Post deploy (move to releases, link release to current)
				4) Finalize deploy (cleanup, remove build path, unlock)
				5) Runs `on_success` callback function if deploy successfully finished
				6) Shows deploy stats
			"""
			
			start_time = timeit.default_timer()

			check_deploy_config()


			echo_task('Running "%s" task' % wrapped_function_name)