def process_repository(self, repo: Repository, template: Template,
                           args: Args):
        print(f"{Fore.BLUE}Initializing repository...")

        remote_url = (
            f"https://github.com/AppalachiaInteractive/{repo.package.value}.git"
        )

        if DRY_RUN:
            print(remote_url)
            return
        try:
            git_repo = git.Repo(repo.directory.value)

        except git.InvalidGitRepositoryError:

            can_create = do_ask(
                f'{Fore.YELLOW}The remote "origin" at {Fore.CYAN}[{remote_url}]{Fore.YELLOW} does not exist.  {Fore.MAGENTA}Should we create it?',
                args.createrepo)

            if not can_create:
                return

            public = do_ask(f"{Fore.MAGENTA}Is this repository public?",
                            args.repopublic)

            command = 'sh "{0}" "AppalachiaInteractive/{1}" {2} "{3}"'.format(
                os.path.join(get_home(), command_dir, "repo", "init.sh"),
                repo.package.value,
                "public" if public else "private",
                repo.description.value,
            )

            print(command)
            run(command)
    def process_license(self, repo: Repository, owner: Owner):
        license_type = repo.license.value

        if license_type == "NONE":
            return

        print(
            f"{Fore.CYAN}Updating license to use {Fore.YELLOW}{license_type}"
        )

        license_file = os.path.join(
            get_home(), license_dir, owner.key, f"LICENSE_{license_type}"
        )

        if DRY_RUN:
            print(license_file)
            return

        shutil.copy(license_file, "LICENSE")
    def parse_directory(self, repo: Repository, template: Template):
        home = get_home()
        absolute = os.path.abspath(repo.directory.value)
        package = (absolute.replace(home, "").replace("C:\\", "").replace(
            "D:\\", "").replace("E:\\", "").replace("F:\\", "").replace(
                "G:\\", "").replace("Assets", "").replace(
                    "Editor", "").replace("Library", "").replace(
                        "internal", "").replace("external", "").replace(
                            "common", "").replace("experimental", "").replace(
                                "\\\\", ".").replace("\\\\", ".").replace(
                                    "\\", ".").replace("/", ".").replace(
                                        "..", ".").replace("..", ".").replace(
                                            "..",
                                            ".").strip().strip(".").strip())

        parts = package.split(".")
        for part in parts:
            if part.lower() in repo.path_parts_lower:
                continue
            repo.path_parts_lower.append(part.lower())
            repo.path_parts.append(part)
예제 #4
0
 def releaselog(self):
     home = get_home()
     self.refresh_package()        
     version = self.json["version"]
     shell.run(f"bash {home}/com.appalachia/appa/appa.sh docs releaselog {version}")
예제 #5
0
 def releaselog(self):
     home = get_home()
     shell.run(f"bash {home}/com.appalachia/appa/appa.sh docs releaselog")
예제 #6
0
 def changelog(self):
     home = get_home()
     shell.run(f"bash {home}/com.appalachia/appa/appa.sh docs changelog")
    def process_license(self, repo: Repository, owner: Owner):
        license_type = repo.license.value
        license = ChoiceCollections.license_lookup[license_type]

        if repo.license.value == "NONE":
            return
        if repo.license.value != "DUAL":
            super(TemplateUNITYPKGFRK, self).process_license(repo, owner)
            return

        props = [repo.license1, repo.license2, repo.commit]

        for prop in props:
            repo.tokenized_properties.append(prop)
            repo.token_keys.append(prop.key)
            repo.token_lookup[prop.key] = prop

        print(
            f"{Fore.CYAN}Updating license to use {Fore.YELLOW}{0}".format(
                repo.license.value
            )
        )

        repo.license.value = license.key
        repo.licenseid.value = license.spdx_id

        license_index = do_selection_until_confirmed(
            repo.license1.confirmation_message,
            owner.license_options,
            repo.license1.selection_message,
        )

        repo.license1.value = owner.license_options[license_index].key

        license_index = do_selection_until_confirmed(
            repo.license2.confirmation_message,
            owner.license_options,
            repo.license2.selection_message,
        )
        repo.license2.value = owner.license_options[license_index].key

        repo.commit.value = shell.run_and_read("git rev-parse HEAD")
        repo.commit.value = do_ask_until_confirmed(
            repo.commit.value,
            repo.commit.confirmation_message,
            repo.commit.enter_message,
            commit_hash,
        )

        license_file = os.path.join(
            get_home(), license_dir, owner.key, f"LICENSE_{repo.license.value}"
        )
        license_file1 = os.path.join(
            get_home(), license_dir, owner.key, f"LICENSE_{repo.license1.value}"
        )
        license_file2 = os.path.join(
            get_home(), license_dir, "appa", f"LICENSE_{repo.license2.value}"
        )

        if DRY_RUN:
            print(license_file)
            return

        shutil.copy(license_file, "LICENSE")
        shutil.copy(license_file1, "LICENSE.ORIGINAL.md")
        shutil.copy(license_file2, "LICENSE.UPDATED.md")