Skip to content

Commit

Permalink
Fix: PR Feedback and schema change from FCC
Browse files Browse the repository at this point in the history
- Update action to 'main' branch - Resolves: #5 (comment)
- Fix schema change issue with FCC. Challenge order is now a list
of dictionaries
- Linter fix
- Fix publisher and creator attributes - Resolves: #5 (comment)
and #5 (comment) and
#5 (comment)
- is_front on redirects only. Resolves: #5 (comment)
-
  • Loading branch information
mdp committed Jul 13, 2023
1 parent 4d36d2e commit 6317096
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: QA

on:
push:
branches: master
branches: main
pull_request:

env:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ prebuild:

zim:
python3 openzim/fcc2zim zim --clientdir ${CLIENTDIR} --outzim ${OUTPATH} \
--language ${LANG} --name ${NAME} --title ${TITLE} --description ${DESCRIPTION} --creator Makefile
--language ${LANG} --name ${NAME} --title ${TITLE} --description ${DESCRIPTION}

all: clean fetch prebuild zim

Expand All @@ -64,7 +64,7 @@ docker_build:
docker_run:
docker run --rm -it -v $(PWD)/tmp:/tmp/fcc2zim openzim/fcc2zim all --clientdir ${CLIENTDIR} --outdir=./client/dist/fcc --outzim ${OUTPATH} \
--language ${LANG} --tmpdir=/tmp/fcc2zim --course=${COURSE_CSV} \
--name ${NAME} --title ${TITLE} --description ${DESCRIPTION} --creator Docker
--name ${NAME} --title ${TITLE} --description ${DESCRIPTION}

docker_debug:
docker run --rm -it --entrypoint=/bin/bash openzim/fcc2zim
6 changes: 4 additions & 2 deletions openzim/fcc2zim
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ if __name__ == "__main__":
zim_cmd.add_argument('--title', type=str, help='Title of zim file', required=True)
zim_cmd.add_argument('--name', type=str, help='Name of zim file', required=True)
zim_cmd.add_argument('--description', type=str, help='Description of zim file', required=True)
zim_cmd.add_argument('--creator', type=str, help='Creator of the zim file', required=True)
zim_cmd.add_argument('--creator', type=str, help='Creator of the zim files content', required=False)
zim_cmd.add_argument('--publisher', type=str, help='Publisher of the zim file', required=False)

all_cmd = sub_parsers.add_parser('all', help='fetch, build and package up a zim file')
all_cmd.add_argument('--force', type=bool, help='force a re-download of the curriculum zip')
Expand All @@ -62,7 +63,8 @@ if __name__ == "__main__":
all_cmd.add_argument('--title', type=str, help='Title of zim file', required=True)
all_cmd.add_argument('--name', type=str, help='Name of zim file', required=True)
all_cmd.add_argument('--description', type=str, help='Description of zim file', required=True)
all_cmd.add_argument('--creator', type=str, help='Creator of the zim file', required=True)
all_cmd.add_argument('--creator', type=str, help='Creator of the zim files content', required=False)
all_cmd.add_argument('--publisher', type=str, help='Publisher of the zim file', required=False)

args = parser.parse_args()
if args.command:
Expand Down
6 changes: 4 additions & 2 deletions openzim/fcctozim/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def build(arguments):
name = arguments.name
title = arguments.title
description = arguments.description
creator = arguments.creator
creator = arguments.creator or "freeCodeCamp"
publisher = arguments.publisher or "openZIM"

logger.info(
f"Building {clientdir} for {language} => {outpath} - Version: {VERSION}"
Expand All @@ -66,7 +67,7 @@ def build(arguments):
with Creator(outpath, main_path.as_posix()).config_metadata(
Name=name,
Title=title,
Publisher="Kiwix",
Publisher=publisher,
Date=datetime.now(),
Creator=creator,
Description=description,
Expand Down Expand Up @@ -94,5 +95,6 @@ def build(arguments):
content=bytes(content, "utf-8"),
title=redir_title,
mimetype="text/html",
is_front=True,
)
# Example index.html#/english/regular-expressions/extract-matches
1 change: 0 additions & 1 deletion openzim/fcctozim/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
def read_yaml_frontmatter(filename: pathlib.Path):
with open(filename) as f:
return next(yaml.load_all(f, Loader=yaml.FullLoader))
return front_matter


class Challenge:
Expand Down
3 changes: 2 additions & 1 deletion openzim/fcctozim/prebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ def prebuild_command(arguments):

# eg. ['basic-javascript', 'debugging']
for course in course_list_str.split(","):
print(f"Prebuilding {course}")
meta = json.loads(
curriculum_dir.joinpath("_meta", course, "meta.json").read_text()
)

# Get the order that the challenges should be completed in for <course>
ids = [item[0] for item in meta["challengeOrder"]]
ids = [item["id"] for item in meta["challengeOrder"]]
superblock = meta["superBlock"]

challenge_list: List[Challenge] = []
Expand Down

0 comments on commit 6317096

Please sign in to comment.