# 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
                    if isinstance(value, (int, float)):
                        src[env][name] = str(value)
                    else:
                        raise ConfigError('%s.%s must be a string' %
                                          (env, name))
                dst['env'][name] = string.Template(
                    src[env][name]).safe_substitute(**dst['env']).rstrip('\n')

            del src[env]

    def merge(self, src, dst):
        if src is None:
            return dst
        # merge global environment variables
        self.merge_env(src, dst)
        # merge env-specific environment variables
        self.merge_env(src, dst, self.env)
        # merge sections
        for name in list(src.keys()):
            if name not in dst:
                if isstr(src[name]):
                    src[name] = PARENT_RE.sub('', src[name])
                elif isinstance(src[name], dict):
                    for subname in src[name]:
                        value = src[name][subname]
                        if isstr(value):
                            src[name][subname] = PARENT_RE.sub('', value)
                dst[name] = src[name]
            elif isstr(src[name]):
                if not isstr(dst[name]):

# 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

                    if isinstance(value, (int, float)):
                        src[env][name] = str(value)
                    else:
                        raise ConfigError('%s.%s must be a string' %
                                          (env, name))
                dst['env'][name] = string.Template(
                    src[env][name]).safe_substitute(**dst['env']).rstrip('\n')

            del src[env]

    def merge(self, src, dst):
        if src is None:
            return dst
        # merge global environment variables
        self.merge_env(src, dst)
        # merge env-specific environment variables
        self.merge_env(src, dst, self.env)
        # merge sections
        for name in list(src.keys()):
            if name not in dst:
                if isstr(src[name]):
                    src[name] = PARENT_RE.sub('', src[name])
                elif isinstance(src[name], dict):
                    for subname in src[name]:
                        value = src[name][subname]
                        if isstr(value):
                            src[name][subname] = PARENT_RE.sub('', value)
                dst[name] = src[name]
            elif isstr(src[name]):
                if not isstr(dst[name]):

                    raise ConfigError('unable to merge "%s" into "str"' %