1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-13 18:14:21 +02:00

Fix a bug with the workflow

This commit is contained in:
Thomas Bui
2020-09-02 21:26:00 -07:00
parent ecf1012586
commit c6848be946
10 changed files with 1022 additions and 9 deletions

View File

@@ -5,12 +5,15 @@ from pathlib import Path
class PathResolverAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
path = Path(values).resolve()
if not self.dest == "download_path":
if not path.exists():
raise ValueError(f"{path} doesn't exist.")
if not path.exists():
raise ValueError(f"{path} doesn't exist.")
if self.dest == "icons_folder_path":
if not path.is_dir():
raise ValueError("icons_folder_path must be a directory")
elif self.dest == "download_path":
if not path.is_dir():
raise ValueError("download_path must be a directory")
setattr(namespace, self.dest, str(path))

View File

@@ -19,12 +19,12 @@ class SeleniumRunner:
"""
The long wait time for the driver in seconds.
"""
LONG_WAIT_IN_SEC = 20
LONG_WAIT_IN_SEC = 25
"""
The medium wait time for the driver in seconds.
"""
MED_WAIT_IN_SEC = 5
MED_WAIT_IN_SEC = 6
"""
The short wait time for the driver in seconds.
@@ -81,7 +81,7 @@ class SeleniumRunner:
Upload the icomoon.json to icomoon.io.
:raises TimeoutException: happens when elements are not found.
"""
print("Uploading JSON file...")
print("Uploading icomoon.json file...")
try:
# find the file input and enter the file path
import_btn = WebDriverWait(self.driver, SeleniumRunner.LONG_WAIT_IN_SEC).until(

View File

@@ -45,12 +45,11 @@ def main():
runner = SeleniumRunner(args.icomoon_json_path, args.download_path,
args.geckodriver_path, args.headless)
runner.upload_icomoon()
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path)
runner.upload_svgs(svgs)
# get the downloaded zip file
zip_name = next(Path(".").glob("devicon-*.zip"))
zip_name = "devicon-v1.0.zip"
zip_path = Path(args.download_path, zip_name)
runner.download_icomoon_fonts(zip_path)
filehandler.extract_files(str(zip_path), args.download_path)