def install_theme(name): theme = find_theme(theme_name=name, silence=True) if theme: # Update theme if not os.path.exists(os.path.join(theme.path, '.git')): logger.warn("%s is not installed via git." "Can't update it." % theme.name) else: logger.info("Updating theme %s" % theme.name) call("git pull", cwd=theme.path) exit(0) if ".git" in name or "//" in name: install_from_git(name) else: search_github(name)
def search_and_install(name): logger.info("Searching theme {name} on GitHub..".format(name=name)) item = search_github(name=name) if not item: logger.error("Can't find theme {name}.".format(name=name)) exit(1) logger.info("Fount {name} on GitHub.".format(name=item["name"])) install_from_git(item["clone_url"])
def install_theme(name): theme = find_theme(theme_name=name, silence=True) if theme: # Update theme if not os.path.exists(os.path.join(theme.path, '.git')): logger.warn("%s is not installed via git." "Can't update it." % theme.name) else: logger.info("Updating theme %s" % theme.name) call("git pull", cwd=theme.path) exit(0) if ".git" in name or "//" in name: install_from_git(name) else: item = search_github(name) if not item: logger.error("Can't find {} on GitHub.".format(name)) exit(1) install_from_git(item["clone_url"])
def test_search_github(): theme = search_github("clean") assert theme["name"] == "catsup-theme-clean" assert theme[ "clone_url"] == "https://github.com/whtsky/catsup-theme-clean.git"