Beispiel #1
0
    def create(self, name):
        """Create a directory structure and a configuration file for the
        module, using the name parameter as the module's name.

        """
        if not name[0].isupper():
            warn(NAME_CASE_WARNING)
        self.name = name
        os.mkdir(self.name)
        for directory in settings.directories:
            os.mkdir("%s/%s" % (self.name, directory))
        self._create_config()
        self._create_regfile()
Beispiel #2
0
    def create(self, name):
        """Create a directory structure, a configuration file, and an
        activation file for the module, using the name parameter as the
        module's name.

        """
        if not name[0].isupper():
            warn(self.NAME_CASE_WARNING)
        self.name = name
        self._mkdir(self.name)
        for directory in settings.directories:
            self._mkdir(os.path.join(self.name, directory))
        self._create_config()
        self._create_regfile()
        self._print_feedback()
Beispiel #3
0
    def __init__(self):
        """Initialize the module by retrieving its code pool, namespace, and
        name.

        """
        cwd = os.getcwd()
        code_pools = "|".join(settings.code_pools)
        pattern = "/app/code/(%s)/([A-Za-z]+)/?([A-Za-z]+)?" % code_pools
        match = re.search(pattern, cwd)
        try:
            self.code_pool = match.group(1)
            self.namespace = match.group(2)
            self.name = match.group(3)
            self.path = cwd[:match.end()]
            self.cfg_path = self.path + "/etc/config.xml".replace("/", os.sep)

            if not self.namespace[0].isupper():
                warn(NAME_CASE_WARNING)
            if not self.name is None and not self.name[0].isupper():
                warn(NAME_CASE_WARNING)
        except AttributeError:
            raise EnvironmentError("Wrong execution directory.")
Beispiel #4
0
 def _check_case_convention(self):
     if not self.namespace[0].isupper():
         warn(self.NAME_CASE_WARNING)
     if not self.name is None and not self.name[0].isupper():
         warn(self.NAME_CASE_WARNING)