def publish(): entitypath = os.getcwd() username = gc.github_login().get_user().login sync_backend() localindex = gc.get_appsource_index() if localindex is None: localindex = gc.fork_on_github("bahusvel/AppSource-Index") if not os.path.exists(STORAGE_LOCAL_INDEX): os.chdir(APPSTORAGE) gc.gitclone(localindex.clone_url, aspath="localindex") os.chdir(STORAGE_LOCAL_INDEX) gc.gitpull() # create corfile here app_dict = {} app_id = click.prompt("Please enter the App ID for your application") app_dict["name"] = app_id[app_id.rfind(".")+1:] app_dict["description"] = click.prompt("Please enter a short description for your app") os.chdir(entitypath) app_dict["repo"] = gc.getremote() public_appfile_path = STORAGE_LOCAL_INDEX+"/ios/" + app_id + ".json" write_appfile(app_dict, public_appfile_path) os.chdir(STORAGE_LOCAL_INDEX) gc.gitadd(public_appfile_path) gc.gitcommit("Added " + app_id) gc.gitpush() try: gc.github_pull_request(localindex.full_name, username, "AppSource-Index", "Add " + app_id) except Exception: click.secho("Pull request failed, please create one manualy", err=True)
def update(): if not os.path.exists(STORAGEINDEX): os.chdir(APPSTORAGE) gc.gitclone(APPSOURCE_INDEX, aspath="index") else: os.chdir(STORAGEINDEX) gc.gitpull()
def build_backend(app_id): print("Building the App") app_file = app_id + ".json" app_dict = read_appfile(apps.STORAGEINDEX + "/ios/" + app_file) build_lock = "{}/{}.lock".format(STORAGEOTA, app_id) if not os.path.exists(build_lock): open(build_lock, "w").close() else: print("App is already building!!!") # TODO check if IPA already exists # build procedure here file = "{}/{}.json".format(apps.STORAGEIOS, app_id) assert os.path.exists(file) appdict = read_appfile(file) url = appdict["repo"] assert url is not None app_path = apps.STORAGEBUILD + "/" + app_id if os.path.exists(app_path): shutil.rmtree(app_path) gc.gitclone(url, aspath=app_path) identities = installer.get_identities() assert len(identities) == 1 # finished os.remove(build_lock) print("Finished building the app")
def upgrade(local): if not local: if not os.path.exists(STORAGECLI): os.chdir(APPSTORAGE) gc.gitclone(APPSOURCE_REPO, aspath="cli") os.chdir(STORAGECLI) else: os.chdir(STORAGECLI) gc.gitpull() if not local: os.system("pip install --upgrade .") else: os.system("pip install --upgrade --editable .")
def get_backend(url, name, path): if name is None and url is None: name = click.prompt("Enter the module name") if name is not None and url is None: file = "{}/{}.json".format(STORAGEIOS, name) if os.path.exists(file): appdict = read_appfile(file) url = appdict["repo"] else: click.secho("The module you requested is not in the index", err=True) url = click.prompt("Please enter the url for the module") if url is not None: github_id = as_extracting.extract_github_id(url) if name is not None: appid = name else: appid = "github.{}.{}".format(github_id[0], github_id[1]) app_path = path+"/"+appid if os.path.exists(app_path): shutil.rmtree(app_path) gc.gitclone(url, aspath=app_path) return appdict, app_path