Beispiel #1
0
    def create_local_module(self):
        """Creates the folder structure and files in a cloned git repository.

        This will use the file creation specified in
        :meth:`~dls_ade.module_template.ModuleTemplate.create_files`.

        Raises:
            :class:`~dls_ade.exceptions.ArgumentError`: From \
                :meth:`~dls_ade.module_template.ModuleTemplate.create_files`
            OSError: From \
                :meth:`~dls_ade.module_template.ModuleTemplate.create_files`
            :class:`~dls_ade.exceptions.VCSGitError`: From \
                :func:`~dls_ade.vcs_git.stage_all_files_and_commit`


        """
        self.verify_can_create_local_module()

        self._can_create_local_module = False

        print("Cloning module to " + self._module_path)

        vcs_git.clone(self._server_repo_path, self.abs_module_path)

        os.chdir(self.abs_module_path)
        self._module_template.create_files()
        os.chdir(self._cwd)

        commit_message = ("Added app, {app_name:s}, to module.".format(
            app_name=self._app_name
        ))

        vcs_git.stage_all_files_and_commit(self.abs_module_path,
                                           commit_message)
Beispiel #2
0
    def create_local_module(self):
        """Creates the folder structure and files in a cloned git repository.

        This will use the file creation specified in
        :meth:`~dls_ade.module_template.ModuleTemplate.create_files`.

        Raises:
            :class:`~dls_ade.exceptions.ArgumentError`: From \
                :meth:`~dls_ade.module_template.ModuleTemplate.create_files`
            OSError: From \
                :meth:`~dls_ade.module_template.ModuleTemplate.create_files`
            :class:`~dls_ade.exceptions.VCSGitError`: From \
                :func:`~dls_ade.vcs_git.stage_all_files_and_commit`
        """

        self.verify_can_create_local_module()

        self._can_create_local_module = False

        self._usermsg.info("Cloning module to {}".format(self._module_path))

        vcs = self.server.clone(self._server_repo_path, self.abs_module_path)

        os.chdir(self.abs_module_path)
        self._module_template.create_files()
        os.chdir(self._cwd)

        commit_message = ("Added app, {app_name:s}, to module.".format(
            app_name=self._app_name
        ))

        vcs_git.stage_all_files_and_commit(vcs.repo, commit_message)
Beispiel #3
0
    def create_local_module(self):
        """Creates the folder structure and files in a new git repository.

        This will use the file creation specified in
        :meth:`~dls_ade.module_template.ModuleTemplate.create_files`. It will
        also stage and commit these files to a git repository located in the
        same directory

        Note:
            This will set `_can_create_local_module` False in order to prevent
            the user calling this method twice in succession.

        Raises:
            :class:`~dls_ade.exceptions.VerificationError`: Local module \
                cannot be created.
            OSError: The abs_module_path already exists (outside interference).
        """

        self.verify_can_create_local_module()

        self._can_create_local_module = False

        self._usermsg.info("Making clean directory structure for %s",
                           self._module_path)

        os.makedirs(self.abs_module_path)

        # The reason why we have to change directory into the folder where the
        # files are created is in order to remain compatible with
        # makeBaseApp.pl, used for IOC and Support modules
        os.chdir(self.abs_module_path)

        self._module_template.create_files()

        os.chdir(self._cwd)

        repo = vcs_git.init_repo(self.abs_module_path)
        vcs_git.stage_all_files_and_commit(repo, "Initial commit")
Beispiel #4
0
    def create_local_module(self):
        """Creates the folder structure and files in a new git repository.

        This will use the file creation specified in
        :meth:`~dls_ade.module_template.ModuleTemplate.create_files`. It will
        also stage and commit these files to a git repository located in the
        same directory

        Note:
            This will set `_can_create_local_module` False in order to prevent
            the user calling this method twice in succession.

        Raises:
            :class:`~dls_ade.exceptions.VerificationError`: Local module \
                cannot be created.
            OSError: The abs_module_path already exists (outside interference).

        """
        self.verify_can_create_local_module()

        self._can_create_local_module = False

        print("Making clean directory structure for " + self._module_path)

        os.makedirs(self.abs_module_path)

        # The reason why we have to change directory into the folder where the
        # files are created is in order to remain compatible with
        # makeBaseApp.pl, used for IOC and Support modules
        os.chdir(self.abs_module_path)

        self._module_template.create_files()

        os.chdir(self._cwd)

        vcs_git.init_repo(self.abs_module_path)
        vcs_git.stage_all_files_and_commit(self.abs_module_path)