# Path: py_mina/config.py
# def fetch(key, default_value=None):
#     """
#     Gets and ensures config setting or returns `default_value` if provided
#     """
# 
#     if key in config.keys():
#         return config.get(key)
#     else:
#         if default_value != None:
#             return default_value
#         else:
#             raise Exception('"%s" is not defined' % key)
# 
# def ensure(key):
#     """
#     Ensures presence of config setting. Prevents from running unnecessary commands,
#     before discovering, that config setting is not set
#     """
# 
#     if not key in config.keys():
#         raise Exception('"%s" must be defined' % key)
# 
# def check_config(required_settings=[]):
#     """
#     Ensures required settings in cofig
#     """
# 
#     try:
#         for setting in required_settings:
#             ensure(setting)
#     except EnsureConfigError:
#         msg = 'Bad config!\nRequired settings: {0}\nCurrent config: {1}'
# 
#         raise Exception(msg.format(required_settings, config))  


import timeit
import os
import re
from py_mina.config import fetch, ensure, check_config
from fabric.api import run, sudo, settings, env, cd, hide
from py_mina.echo import *
Setup tasks
"""


from __future__ import with_statement


################################################################################
# Check
################################################################################


def check_setup_config():
    """
    Checks required config settings for setup task
    """

    check_config(['user', 'hosts', 'deploy_to'])


################################################################################
# Create required and shared 
################################################################################


def create_required_structure():
    """
    Creates required folders (tmp, releases, shared) in `deploy_to` path
    """


# Path: py_mina/config.py
# def fetch(key, default_value=None):
#     """
#     Gets and ensures config setting or returns `default_value` if provided
#     """
# 
#     if key in config.keys():
#         return config.get(key)
#     else:
#         if default_value != None:
#             return default_value
#         else:
#             raise Exception('"%s" is not defined' % key)
# 
# def ensure(key):
#     """
#     Ensures presence of config setting. Prevents from running unnecessary commands,
#     before discovering, that config setting is not set
#     """
# 
#     if not key in config.keys():
#         raise Exception('"%s" must be defined' % key)
# 
# def check_config(required_settings=[]):
#     """
#     Ensures required settings in cofig
#     """
# 
#     try:
#         for setting in required_settings:
#             ensure(setting)
#     except EnsureConfigError:
#         msg = 'Bad config!\nRequired settings: {0}\nCurrent config: {1}'
# 
#         raise Exception(msg.format(required_settings, config))  


# Path: py_mina/subtasks/setup.py
import timeit
import os
import re
from py_mina.config import fetch, ensure, check_config
from fabric.api import run, sudo, settings, env, cd, hide
from py_mina.echo import *

Setup tasks
"""


from __future__ import with_statement


################################################################################
# Check
################################################################################


def check_setup_config():
    """
    Checks required config settings for setup task
    """

    check_config(['user', 'hosts', 'deploy_to'])


################################################################################
# Create required and shared 
################################################################################


def create_required_structure():
    """
    Creates required folders (tmp, releases, shared) in `deploy_to` path
    """


    deploy_to = fetch('deploy_to')