How to use the mirage.system.log 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 / projectstartup / angular_app_create.py View on Github external
return

        # Input information
        mys.log("Please type your new Django application information.")

        # Check namespace
        try:
            self._project_name = mys.log("Project name", withInput = True)
            self._check_namesapce(self._project_name)
        except:
            mys.log("Project \"{0}\" is already exists.".format(self._project_name), withError = True,
                    errorDetail = "Please remove duplication of Django project namespace.")
            return

        version      = mys.log("App version", withInput = True, default = "0.0.1")
        author       = mys.log("Author name", withInput = True)
        email        = mys.log("Email",       withInput = True)
        git_url      = mys.log("Git URL",     withInput = True)
        license_name = mys.log("License",     withInput = True)
        license_url  = mys.log("License Url", withInput = True)
        description  = mys.log("Description", withInput = True)
        copyrightor  = mys.log("Copyrightor", withInput = True, default = author)




        self._create_new_django_app()

        # Create logging instance
        logger = mys.Progress()

        with proj.InDir("./" + self._project_name):
github shotastage / mirage-django-lts / mirage / projectstartup / angular_app_create.py View on Github external
def main(self):

        # Check
        try:
            self._check_before()
        except:
            return

        # Input information
        mys.log("Please type your new Django application information.")

        # Check namespace
        try:
            self._project_name = mys.log("Project name", withInput = True)
            self._check_namesapce(self._project_name)
        except:
            mys.log("Project \"{0}\" is already exists.".format(self._project_name), withError = True,
                    errorDetail = "Please remove duplication of Django project namespace.")
            return

        version      = mys.log("App version", withInput = True, default = "0.0.1")
        author       = mys.log("Author name", withInput = True)
        email        = mys.log("Email",       withInput = True)
        git_url      = mys.log("Git URL",     withInput = True)
        license_name = mys.log("License",     withInput = True)
        license_url  = mys.log("License Url", withInput = True)
github shotastage / mirage-django-lts / mirage / touch / touch.py View on Github external
start_year = mys.log("Start year", withInput = True)

        try:
            copyrights = Config().get(Category.copyright, Detail.copyright_copyrigtors)
        except:
            copyrights = mys.log("Copyrights", withInput = True)

        try:
            licensename = Config().get(Category.project_basic, Detail.project_license)
        except:
            licensename = mys.log("License name", withInput = True)

        try:
            license_url = Config("secret").get(Category.private_profile, Detail.private_license_url)
        except:
            license_url = mys.log("License doc URL", withInput = True)


        try:
            with open(str(self._fname), "w") as f:

                # When copyrights is list, copyright_source raises TypeError: unhashable type: 'list'
                if [ext for ext in [".py", ".rb", ".sh"] if ext in self._fname]:
                    f.write(
                        copyright_source.copyright_script_style_doc(proj_name, self._fname, your_name,
                                                   start_year, tuple(copyrights), licensename, license_url)
                    )
                elif [ext for ext in [".scss", ".js", ".ts", ".swift", ".c"] if ext in self._fname]:
                    f.write(
                        copyright_source.copyright_c_style_doc(proj_name, self._fname, your_name,
                                                   start_year, tuple(copyrights), licensename, license_url)
                    )
github shotastage / mirage-django-lts / mirage / generate / app.py View on Github external
def _install_app(self, name):

        try:
            master_app = self.__detect_master_app()
        except:
            mys.log("Failed to detect master app.", withError = True)


        mys.log("Installing app...")

        with proj.InDir(master_app):
            if os.path.isdir("environment"):
                with proj.InDir("./environment"):
                    self.__insert_app_path(name, "common.py")

            elif os.path.isdir("settings"):
                with proj.InDir("./settings"):
                    self.__insert_app_path(name, "common.py")

            else:
                if os.path.isfile("settings.py"):
                    self.__insert_app_path(name, "settings.py")
github shotastage / mirage-django-lts / mirage / miragefile / conf.py View on Github external
def _get_copyright(self, detail):

        if detail == Detail.copyright_start_year:
            return self._data["project"]["copyright"]["start_year"]
        elif detail == Detail.copyright_copyrigtors:
            return self._data["project"]["copyright"]["copyrightors"]
        else:
            mys.log("The config information named " + detail + " does not exist!", withError = True) 
            raise MiragefileUnknownError
github shotastage / mirage-django-lts / mirage / projectstartup / react_app_create.py View on Github external
except:
            return

        # Input information
        mys.log("Please type your new Django application information.")

        # Check namespace
        try:
            self._project_name = mys.log("Project name", withInput = True)
            self._check_namesapce(self._project_name)
        except:
            mys.log("Project \"{0}\" is already exists.".format(self._project_name), withError = True,
                    errorDetail = "Please remove duplication of Django project namespace.")
            return

        version      = mys.log("App version", withInput = True, default = "0.0.1")
        author       = mys.log("Author name", withInput = True)
        email        = mys.log("Email",       withInput = True)
        git_url      = mys.log("Git URL",     withInput = True)
        license_name = mys.log("License",     withInput = True)
        license_url  = mys.log("License Url", withInput = True)
        description  = mys.log("Description", withInput = True)
        copyrightor  = mys.log("Copyrightor", withInput = True, default = author)




        self._create_new_django_app()

        # Create logging instance
        logger = mys.Progress()
github shotastage / mirage-django-lts / mirage / projectstartup / django_app_create.py View on Github external
# Check namespace
        try:
            self._project_name = mys.log("Project name", withInput = True)
            self._check_namesapce(self._project_name)
        except:
            mys.log("Project \"{0}\" is already exists.".format(self._project_name), withError = True,
                    errorDetail = "Please remove duplication of Django project namespace.")
            return

        version      = mys.log("App version", withInput = True, default = "0.0.1")
        author       = mys.log("Author name", withInput = True)
        email        = mys.log("Email",       withInput = True)
        git_url      = mys.log("Git URL",     withInput = True)
        license_name = mys.log("License",     withInput = True)
        description  = mys.log("Description", withInput = True)
        copyrightor  = mys.log("Copyrightor", withInput = True, default = author)




        self._create_new_django_app()

        # Create logging instance
        logger = mys.Progress()

        with proj.InDir("./" + self._project_name):

            # Generate .gitignore
            #log("Generating gitignore...")
            logger.write("Generating gitignore...", withLazy = True)
            self._create_template_git_project()
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 / 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 / confscript / flow.py View on Github external
def load_script(self) -> object:

        sys.path.append(os.getcwd())

        try:
            fp, name, desc = imp.find_module("mirage.config")
            config_script = imp.load_module("config_script", fp, name, desc)

            if config_script.MirageConfig.assertBool():
                mys.log("Config script loaded!")
            else:
                mys.log("Failed to import mirage.config.py !", withError = True)
                raise ImportError

        except ImportError:
            mys.log("Failed to import mirage.config.py !", withError = True)