How to use the mirage.proj.MirageEnvironmentLevel function in mirage

To help you get started, we’ve selected a few mirage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shotastage / mirage-django-lts / mirage / manage / executor.py View on Github external
def excute_manage_cmd(self):
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
            os.system("python manage.py " + self._cmd)
github shotastage / mirage-django-lts / mirage / server / debug_server.py View on Github external
def main(self):        
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
            try:
                os.system("python manage.py runserver")
            except KeyboardInterrupt:
                mys.log("Good bye!")
            except:
                mys.log("Failed to launch web browser!", withError = True)
github shotastage / mirage-django-lts / mirage / db / migrate.py View on Github external
def main(self):
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
            mys.log("Making migrations...")
            self._make_migration()
            self._apply_migration()
github shotastage / mirage-django-lts / mirage / transfer / transfer.py View on Github external
def main(self):
        # Beta Warning
        mys.log("This feature is now under Beta version.", withError=True)

        # Logger instance

        logger = mys.progress.Progress()
        
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):

            # In advance checking.
            try:
                self._check(logger)
            except:
                return

            logger.write("Searching application %s..." % self._app, withLazy = True)

            if Path(self._app).is_dir():
                mys.log(os.getcwd())
                shutil.copytree(self._app, os.path.join(self._to, self._app))
                logger.update("Completed!")
            else:
                logger.update("Can not detect application %s!" % self._app)
                mys.log("Failed to transfer app %s!" % self._app, withError = True,
github shotastage / mirage-django-lts / mirage / generate / app.py View on Github external
def _create_app(self, name):
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
            mys.command("python manage.py startapp " + name)
github shotastage / mirage-django-lts / mirage / db / merge.py View on Github external
def _merge(self):
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.inapp):
            mys.log("Integrate migrations...")

            with proj.InDir("migrations"):
                path_obj = Path(os.getcwd())
                migration_script_path = path_obj.glob("*.py")

                for path in migration_script_path:
                    if not "__init__.py" in str(path):
                        mys.log("Removing " + str(path) + "!")
                        os.remove(path)
                
            with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
                os.system("python manage.py makemigrations")
github shotastage / mirage-django-lts / mirage / db / merge.py View on Github external
def _merge(self):
        with proj.MirageEnvironment(proj.MirageEnvironmentLevel.inapp):
            mys.log("Integrate migrations...")

            with proj.InDir("migrations"):
                path_obj = Path(os.getcwd())
                migration_script_path = path_obj.glob("*.py")

                for path in migration_script_path:
                    if not "__init__.py" in str(path):
                        mys.log("Removing " + str(path) + "!")
                        os.remove(path)
                
            with proj.MirageEnvironment(proj.MirageEnvironmentLevel.indjango):
                os.system("python manage.py makemigrations")
github shotastage / mirage-django-lts / mirage / workspace / storage.py View on Github external
def persist(file_path, domain):
        object_id = str(uuid.uuid4())
        absolute_path = os.getcwd() + "/" + file_path

        # Logger instance
        logger = mys.progress.Progress()

        with MirageEnvironment(MirageEnvironmentLevel.inproject):

            logger.write("Safety caching...", withLazy = True)
            fileable.cd(".mirage/cache/")
            fileable.copy(absolute_path, os.getcwd() + "/" + file_path, force = True)

            logger.update("Archiving files...", withLazy = True)
            shutil.make_archive(object_id, "zip", root_dir = absolute_path)
            
            fileable.move(object_id + ".zip", "../persistence/")

            MirageWorkspace.__write_persistence_file_meta(object_id, ".mirage/persistence/", domain)

            logger.update("Saving file completed!", withLazy = True)
github shotastage / mirage-django-lts / mirage / workspace / storage.py View on Github external
def initialize():

        with MirageEnvironment(MirageEnvironmentLevel.inproject):
            if not fileable.exists(".mirage"):
                mys.log("Creating Mirage workspace...")
                fileable.mkdir(".mirage")
                fileable.mkdir(".mirage/cache/")
                fileable.mkdir(".mirage/persistence/")
github shotastage / mirage-django-lts / mirage / confscript / flow.py View on Github external
def main(self) -> bool:
        mys.log("Now under construction.")
        return

        with MirageEnvironment(MirageEnvironmentLevel.inproject):

            try:
                instance = self.load_script()
            except:
                return False

            instance.execute(self._cli, self._option)

        return True