Example #1
0
 def test_create_new_dataset(self, mock_datalad_add, mock_dataset, mock_repo, mock_check_requirements,
                             mock_get_all_dataset_description, mock_create_zenodo_tracker,
                             mock_create_new_dats, mock_get_readme, mock_create_readme, mock_create_pr):
     try:
         ZenodoCrawler("github token", "path/to/config", True, False).run()
     except Exception as e:
         self.fail("Unexpected Exception raised: " + str(e))
Example #2
0
    ) = parse_args()

    # import the crawler packages
    sys.path.append(conp_dataset_dir_path)
    from scripts.Crawlers.ZenodoCrawler import ZenodoCrawler
    from scripts.Crawlers.OSFCrawler import OSFCrawler

    try:
        if verbose:
            print(
                "==================== Zenodo Crawler Running ===================="
                + os.linesep, )
        ZenodoCrawlerObj = ZenodoCrawler(
            github_token,
            config_path,
            verbose,
            force,
            no_pr,
        )
        ZenodoCrawlerObj.run()

        if verbose:
            print(
                os.linesep +
                "==================== OSF Crawler Running ===================="
                + os.linesep, )
        OSFCrawlerObj = OSFCrawler(github_token, config_path, verbose, force,
                                   no_pr)
        OSFCrawlerObj.run()

        # INSTANTIATE NEW CRAWLERS AND RUN HERE
Example #3
0
        config["github_token"] = github_token
        # Store newly passed github token into config file
        with open(config_path, "w") as f:
            json.dump(config, f, indent=4)
    else:  # Retrieve github token from config file
        github_token = config["github_token"]

    return github_token, config_path, args.verbose, args.force


if __name__ == "__main__":
    github_token, config_path, verbose, force = parse_args()
    try:
        if verbose:
            print("==================== Zenodo Crawler Running ====================" + os.linesep)
        ZenodoCrawler = ZenodoCrawler(github_token, config_path, verbose, force)
        ZenodoCrawler.run()

        if verbose:
            print(os.linesep + "==================== OSF Crawler Running ====================" + os.linesep)
        OSFCrawler = OSFCrawler(github_token, config_path, verbose, force)
        OSFCrawler.run()

        # INSTANTIATE NEW CRAWLERS AND RUN HERE

    except Exception:
        traceback.print_exc()
    finally:
        # Always switch branch back to master
        repository = Repo()
        if repository.active_branch.name != "master":