Esempio n. 1
0
    def __init__(self, base_directory, path_to_app):
        self.base_directory = base_directory
        self.app_directory = join_path(self.base_directory, "katana",
                                       "katana.wapps")
        self.plugin_directory = join_path(self.base_directory, "warrior",
                                          "plugins")
        self.settings_file = join_path(self.base_directory, "katana",
                                       "katana.wui", "settings.py")
        self.urls_file = join_path(self.base_directory, "katana", "katana.wui",
                                   "urls.py")

        self.app_name = get_sub_folders(
            join_path(path_to_app, "warriorframework_py3", "katana",
                      "katana.wapps"))[0]
        self.path_to_app = join_path(path_to_app, "warriorframework_py3",
                                     "katana", "katana.wapps", self.app_name)
        self.path_to_plugin_dir = join_path(path_to_app,
                                            "warriorframework_py3", "warrior",
                                            "plugins")
        self.wf_config_file = join_path(self.path_to_app, "wf_config.json")

        self.plugins_paths = get_sub_folders(self.path_to_plugin_dir,
                                             abs_path=True)
        self.pkg_in_settings = "katana.wapps.{0}".format(self.app_name)
        self.urls_inclusions = []
        self.settings_backup = []
        self.urls_backup = []
        self.delete_app_dir = []
        self.delete_plugins_dir = []
        self.config_data = None
        self.message = ""
Esempio n. 2
0
    def __init__(self, filepath):
        """
        :param filepath: Path to the root directory of the app being installed

        self.navigator: Navigator() onject
        self.app_name: Name of the actual app directory.
        self.path_to_app: Path to the actual app directory
        self.wf_config_file: Path to the app's wf_config file
        self.urls_inclusions: List of ursl that need o be included in main urls.py
        self.mandatory_fields: Mandatory fields necessary in wf_config.json
        self.wapp_data: All data in the wf_config.json file
        self.django_based: True indicates that this app uses new Katana API. False indicates that
                           app still uses the old Katana API
        """
        self.navigator = Navigator()
        self.app_name = get_sub_folders(
            join_path(filepath, "warriorframework_py3", "katana",
                      "katana.wapps"))[0]
        self.path_to_app = join_path(filepath, "warriorframework_py3",
                                     "katana", "katana.wapps", self.app_name)
        self.wf_config_file = join_path(self.path_to_app, "wf_config.json")
        self.urls_inclusions = []
        self.mandatory_fields = [
            "app", "version", "warrior-compatibility",
            "warrior-incompatibility"
        ]
        self.wapp_data = read_json_data(self.wf_config_file)
        self.django_based = False if "pure_django" not in self.wapp_data or not self.wapp_data[
            "pure_django"] else True
Esempio n. 3
0
def _get_apps(apps_directory_path, apps_package_name):
    """
    This function gets all the app directories inside the "/katana/katana.wapps" and "katana/katana.native"
    directories

    Returns:
        apps_list: list of app paths

    """
    apps_list = []
    apps_sub_dir = get_sub_folders(apps_directory_path)
    for i in range(0, len(apps_sub_dir)):
        apps_sub_dir[i] = "katana." + apps_package_name + apps_sub_dir[i]
    apps_list.extend(apps_sub_dir)
    return apps_list