예제 #1
0
파일: code.py 프로젝트: wgfi110/crawley
    def run(self, run_command):
        """
            Run the crawler of a code project
        """

        import_user_module("crawlers")
        BaseProject.run(self, run_command, user_crawlers)
예제 #2
0
파일: command.py 프로젝트: cmcc/crawley
    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]()
예제 #3
0
파일: command.py 프로젝트: 4iji/crawley
    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]()
예제 #4
0
파일: command.py 프로젝트: aparo/crawley
    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")
예제 #5
0
파일: command.py 프로젝트: aparo/crawley
    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
예제 #6
0
파일: command.py 프로젝트: cmcc/crawley
    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