PyFunceble/auto_save.py
def _travis(self):
        """
        Logic behind autosave under Travis CI.
        """

        if PyFunceble.CONFIGURATION["travis"]:
            try:
                _ = PyFunceble.environ["TRAVIS_BUILD_DIR"]
                time_autorisation = False

                try:
                    time_autorisation = int(PyFunceble.time()) >= int(
                        PyFunceble.INTERN["start"]
                    ) + (int(PyFunceble.CONFIGURATION["travis_autosave_minutes"]) * 60)
                except KeyError:
                    if self.last and not self.bypass:
                        raise Exception(
                            "Please review the way `ExecutionTime()` is called."
                        )

                if self.last or time_autorisation or self.bypass:
                    Percentage().log()
                    self.travis_permissions()

                    command = 'git add --all && git commit -a -m "%s"'

                    if self.last or self.bypass:
                        if PyFunceble.CONFIGURATION["command_before_end"]:
                            for line in Command(
                                PyFunceble.CONFIGURATION["command_before_end"]
                            ).run():
                                sys_stdout.write("{}\n".format(line))

                            self.travis_permissions()

                        message = (
                            PyFunceble.CONFIGURATION["travis_autosave_final_commit"]
                            + " [ci skip]"
                        )

                        Command(command % message).execute()
                    else:
                        if PyFunceble.CONFIGURATION["command"]:
                            for line in Command(
                                PyFunceble.CONFIGURATION["command"]
                            ).run():
                                sys_stdout.write("{}\n".format(line))

                            self.travis_permissions()

                        Command(
                            command % PyFunceble.CONFIGURATION["travis_autosave_commit"]
                        ).execute()

                    print(
                        Command(
                            "git push origin %s"
                            % PyFunceble.CONFIGURATION["travis_branch"]
                        ).execute()
                    )
                    exit(0)
            except KeyError:
                pass
def _travis(self):
        """
        Logic behind autosave under Travis CI.
        """

        if PyFunceble.CONFIGURATION["travis"]:
            try:
                _ = PyFunceble.environ["TRAVIS_BUILD_DIR"]
                time_autorisation = False

                try:
                    time_autorisation = int(PyFunceble.time()) >= int(
                        PyFunceble.INTERN["start"]
                    ) + (int(PyFunceble.CONFIGURATION["travis_autosave_minutes"]) * 60)
                except KeyError:
                    if self.last and not self.bypass:
                        raise Exception(
                            "Please review the way `ExecutionTime()` is called."
                        )

                if self.last or time_autorisation or self.bypass:
                    Percentage().log()
                    self.travis_permissions()

                    command = 'git add --all && git commit -a -m "%s"'

                    if self.last or self.bypass:
                        if PyFunceble.CONFIGURATION["command_before_end"]:
                            for line in Command(
                                PyFunceble.CONFIGURATION["command_before_end"]
                            ).run():
                                sys_stdout.write("{}\n".format(line))

                            self.travis_permissions()

                        message = (
                            PyFunceble.CONFIGURATION["travis_autosave_final_commit"]
                            + " [ci skip]"
                        )

                        Command(command % message).execute()
                    else:
                        if PyFunceble.CONFIGURATION["command"]:
                            for line in Command(
                                PyFunceble.CONFIGURATION["command"]
                            ).run():
                                sys_stdout.write("{}\n".format(line))

                            self.travis_permissions()

                        Command(
                            command % PyFunceble.CONFIGURATION["travis_autosave_commit"]
                        ).execute()

                    print(
                        Command(
                            "git push origin %s"
                            % PyFunceble.CONFIGURATION["travis_branch"]
                        ).execute()
                    )
                    exit(0)
            except KeyError:
                pass
Logic behind autosave under Travis CI.