# Path: rock/constants.py
# MOUNT_PATH = os.environ.get('ROCK_MOUNT_PATH', '/')
# RUNTIMES = ['node', 'perl', 'php', 'python', 'ruby']
# SHELL = (os.environ.get('ROCK_SHELL') or '/bin/bash -c').split()
# 
# Path: rock/exceptions.py
# class ConfigError(Error):
#     pass
# 
# Path: rock/utils.py
# def isstr(s):
#     return isinstance(s, basestring)
# 
# def raw(text):
#     return text.replace('\\', '\\\\')


import collections
import copy
import os
import re
import string
import yaml
from rock import constants
from rock.exceptions import ConfigError
from rock.utils import isstr, raw
        from rock.runtime import Runtime
            path = '.'
            while os.path.split(os.path.abspath(path))[1]:
                config_path = os.path.join(path, '.rock.yml')
                if os.path.isfile(config_path):
                    self.data['path'] = os.path.abspath(path)
                    break
                path = os.path.join('..', path)
        if not self.data.get('path'):
            self.data['path'] = os.getcwd()

    def setup(self):
        if self._setup:
            return
        self._setup = True
        # path
        self.setup_path()
        # new configuration
        data = {}
        # runtime
        yml_path = os.path.join(self.data['path'], '.rock.yml')
        if yml_path and os.path.isfile(yml_path):
            data = self.parse(yml_path)
            if not isinstance(data, dict):
                raise ConfigError('.rock.yml syntax error')
            data.update(self.data)
        else:
            data = copy.deepcopy(self.data)
        # runtime
        require_runtime = 'runtime' in data
        if require_runtime:

# Path: rock/constants.py
# MOUNT_PATH = os.environ.get('ROCK_MOUNT_PATH', '/')
# RUNTIMES = ['node', 'perl', 'php', 'python', 'ruby']
# SHELL = (os.environ.get('ROCK_SHELL') or '/bin/bash -c').split()
# 
# Path: rock/exceptions.py
# class ConfigError(Error):
#     pass
# 
# Path: rock/utils.py
# def isstr(s):
#     return isinstance(s, basestring)
# 
# def raw(text):
#     return text.replace('\\', '\\\\')


# Path: rock/config.py
import collections
import copy
import os
import re
import string
import yaml
from rock import constants
from rock.exceptions import ConfigError
from rock.utils import isstr, raw
        from rock.runtime import Runtime

            path = '.'
            while os.path.split(os.path.abspath(path))[1]:
                config_path = os.path.join(path, '.rock.yml')
                if os.path.isfile(config_path):
                    self.data['path'] = os.path.abspath(path)
                    break
                path = os.path.join('..', path)
        if not self.data.get('path'):
            self.data['path'] = os.getcwd()

    def setup(self):
        if self._setup:
            return
        self._setup = True
        # path
        self.setup_path()
        # new configuration
        data = {}
        # runtime
        yml_path = os.path.join(self.data['path'], '.rock.yml')
        if yml_path and os.path.isfile(yml_path):
            data = self.parse(yml_path)
            if not isinstance(data, dict):
                raise ConfigError('.rock.yml syntax error')
            data.update(self.data)
        else:
            data = copy.deepcopy(self.data)
        # runtime
        require_runtime = 'runtime' in data
        if require_runtime:

            require_runtime = data['runtime'] not in constants.RUNTIMES