RaspberryPiFoundation / lesson_format

Lesson formatter
17 stars 28 forks source link

Downloadable resources need rebuilding #194

Closed rik-cross closed 7 years ago

rik-cross commented 7 years ago

The downloadable project resources are out of date:

screen shot 2016-09-02 at 12 12 04

Is there a way to rebuild the website and force the .zip files to be regenerated? I'm sure this has been done in the past, but I forget how.

There are probably a few inconsistencies, so if all project resources could be rebuilt, that'd be great.

martinpeck commented 7 years ago

How can I show that they're out of date? What should I be looking for?

rik-cross commented 7 years ago

For example, the files in the "Create Your Own World" should... https://github.com/CodeClub/scratch-curriculum/tree/master/en-GB/Term%202/Create%20Your%20Own%20World/Project%20Resources

...are different to those in the .zip... http://projects.codeclubworld.org/en-GB/02_scratch_02/06/scratch_02_2-06_Create_Your_Own_World_resources.zip

rik-cross commented 7 years ago

This is also true of the files in "Catch the Dots" and "Paint Box". I think they may be the only ones that need updating.

rik-cross commented 7 years ago

...oh, and the HTML & CSS projects.

martinpeck commented 7 years ago

I know what the issue is...it's that the code explicity goes out of its way to NEVER create a zip file if one already exists...

https://github.com/CodeClub/lesson_format/blob/master/build.py#L1305

I'm going to suggest a work around, but want to test it first. The work around is going to be "delete the zip files from the website you want to be regenerated".

I could add some flag in the code that allows zip files to be generated regardless of their current state, or find some other way to force a regen, but if the "delete the file" approach works it'll do for now.

rik-cross commented 7 years ago

Hi Martin, deleting the .zips sounds good to me. Even if this adds to the build time, it's almost always done overnight anyway.

martinpeck commented 7 years ago

I'm not sure my initial suggestion is an option.

andylolz commented 7 years ago

Looks like this lovely feature was added in cad6f810.

I think the idea was to run autobuild.py with --clean to bin everything and rebuild.

martinpeck commented 7 years ago

Yeah, but neither --clean or --rebuild appear to help. Every nightly build is run with --clean.

andylolz commented 7 years ago

Yeah, I guess that’s due to the git checkout -- filename. Really not sure what that’s doing there… I think I had an idea about determining whether to generate zips / pdfs according to git diff, but it didn’t work for zips (two zip files created at different times from identical contents are different according to git, due to some metadata contents). I think I decided #44 was a better course of action.

Anyway – I guess removing L1300-L1303 and using --clean will fix it.

martinpeck commented 7 years ago

Yeah, so it's related to the "dirty hack" that was added in https://github.com/CodeClub/lesson_format/commit/b682de2dafe5a45c5772017cd19c977150749387 as part of "stop generating PDFs"

It looks like the PDF generation hack is circumvented by --rebuild where zipfile generation is not, so I'm considering adding check for rebuild around that zipfile hack such that a rebuild does not pull the file from git at all.

martinpeck commented 7 years ago

@rik-cross can you please confirm that this is now fixed? I'll close this on the assumption that it is, but feel free to open if the zipfiles don't appear to have been rebuilt (from my point of view, and looking at the last PR into the gh-pages repo, the zip files all look nice and fresh).

The change I've made in https://github.com/CodeClub/lesson_format/commit/ce8965f1499a3fc72a6938f033510e91bf651fda means that you can now cause zipfiles to be regenerated by using both the --clean and --rebuild flags of autobuild.py

--clean makes sure that the output folder is deleted prior to building things. Otherwise, the existing zip file is used.

--rebuild makes sure that the PDFs and zipfiles are rebuilt. Otherwise, it'll use the ones that already exist.

Only by specifying both of these flags will you get zip files to generate.

The nightly build uses just --clean, and not the --rebuild flag. This could certainly be altered easily, but it might add quite some time to the build. If you'd rather have the zipfiles always be rebuilt then we can add this flag, but if zipfile regeneration is rare then it's easy enough to invoke the build from the heroku command line with...

heroku run python autobuild.py --rebuild --clean --verbose

... where --verbose is optional, but will give you plenty of feedback on what's going on.

rik-cross commented 7 years ago

All looks good to me. Thanks @martinpeck and @andylolz :) Manually running with --rebuild if needed works for me.