1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-12 09:34:36 +02:00

Added comments and script now fail if can't find icon name

This commit is contained in:
Thomas Bui
2020-12-30 10:57:06 -08:00
parent a9eb51aca5
commit a84cd46a9f
3 changed files with 43 additions and 6 deletions

View File

@@ -227,6 +227,10 @@ class SeleniumRunner:
def remove_color_from_icon(self):
"""
Remove the color from the most recent uploaded icon.
This is because some SVG have colors in them and we don't want to
force contributors to remove them in case people want the colored SVGs.
The color removal is also necessary so that the Icomoon-generated
icons fit within one font symbol/ligiature.
"""
color_tab = WebDriverWait(self.driver, self.SHORT_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.CSS_SELECTOR, "div.overlayWindow i.icon-droplet"))

View File

@@ -1,5 +1,6 @@
from typing import List
import re
import sys
from selenium.common.exceptions import TimeoutException
# pycharm complains that build_assets is an unresolved ref
@@ -20,18 +21,20 @@ def main():
print("Icons being uploaded:", *filtered_icons, sep = "\n")
if len(new_icons) == 0:
print("No files need to be uploaded. Ending script...")
return
sys.exit("No files need to be uploaded. Ending script...")
screenshot_folder = filehandler.create_screenshot_folder("./")
if len(filtered_icons) == 0:
print("No icons found matching the icon name in the PR's title. Fallback to uploading all new icons found.")
screenshot_folder = ""
sys.exit("No icons found matching the icon name in the PR's title.",
"Ensure that the PR title matches the convention here: ",
"https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview.",
"Ending script...",
sep='\n')
runner = None
try:
runner = SeleniumRunner(args.download_path, args.geckodriver_path, args.headless)
svgs = filehandler.get_svgs_paths(filtered_icons, args.icons_folder_path)
screenshot_folder = filehandler.create_screenshot_folder("./")
runner.upload_svgs(svgs, screenshot_folder)
print("Task completed.")
except TimeoutException as e: