Exemplo n.º 1
0
    def run(self, run_command):
        """
            Run the crawler of a code project
        """

        import_user_module("crawlers")
        BaseProject.run(self, run_command, user_crawlers)
Exemplo n.º 2
0
    def _check_project_type(self):
        """
            Check for the project's type
        """

        if has_valid_attr(self.settings, "PROJECT_TYPE"):
            project_type = self.settings.PROJECT_TYPE
        else:
            meta_data = import_user_module("__init__")
            project_type = meta_data.project_type

        self.project_type = project_types[project_type]()
Exemplo n.º 3
0
    def _check_project_type(self):
        """
            Check for the project's type
        """

        if has_valid_attr(self.settings, "PROJECT_TYPE"):
            project_type = self.settings.PROJECT_TYPE
        else:
            meta_data = import_user_module("__init__")
            project_type = meta_data.project_type

        self.project_type = project_types[project_type]()
Exemplo n.º 4
0
    def _check_project_type(self):
        """
            Check for the project's type [code based project
            or dsl templates based project]
        """

        if check_for_file(self.settings, "config.ini") and check_for_file(self.settings, "template.crw"):
            self.project_type = TemplateProject()

        elif import_user_module("models", exit=False) is not None:
            self.project_type = CodeProject()

        else:
            exit_with_error("Unrecognized crawley project")
Exemplo n.º 5
0
    def _check_for_settings(self):
        """
            tries to import the user's settings file
        """

        (options, args) = self.parser.parse_args(self.args)

        if options.settings is not None:

            settings_dir, file_name = os.path.split(options.settings)

            sys.path.insert(0, settings_dir)
            settings_file = os.path.splitext(file_name)[0]

        else:
            sys.path.insert(0, os.getcwd())
            settings_file = "settings"

        settings = import_user_module(settings_file)

        sys.path.append(settings.PROJECT_ROOT)
        return settings
Exemplo n.º 6
0
    def _check_for_settings(self):
        """
            tries to import the user's settings file
        """

        (options, args) = self.parser.parse_args(self.args)

        if options.settings is not None:

            settings_dir, file_name = os.path.split(options.settings)

            add_to_path(settings_dir)
            settings_file = os.path.splitext(file_name)[0]

        else:
            add_to_path(os.getcwd())
            settings_file = "settings"

        settings = import_user_module(settings_file)

        add_to_path(settings.PROJECT_ROOT)
        return settings