-
-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make a script to update python-novice-inflammation.zip #94
Comments
I'd like to have this as a tool at the lesson-template level, so it's available for other lessons too. Having some data files to download is more the norm than the exception. It'd be nice if we could have this as a git post-commit script, so if a commit changes the |
I was thinking about implementing this using git hooks with a script that goes something like: #!/bin/sh
ZIP_FILE=python-novice-inflammation-data.zip
DATA_DIR=data
zip --filesync --recurse-paths $ZIP_FILE $DATA_DIR Ideally, this would be a server-side hook (e.g. post-receive), but for very good reasons, GitHub won't allow us to execute arbitrary code on their servers as part of a server-side hook. So I think the remaining options are
I'd vote for the Makefile approach, but I don't really know much about webhooks so I might be overlooking a lot of the benefits. Anyone here have more experience with hooks? |
The client-side hook actually isn't too bad to do, as only the maintainers (me and @abostroem) need to actually have that hook installed. Makefile approach is good with me too, so either one IMO. |
For that matter, would the maintainers (@tbekolay and @abostroem) like I can certainly submit a PR adding the zip commands to the makefile. Would that be done for python-novice-inflammation or for lesson-template? If it went in lesson-template, it seems that everyone would have to agree on the same zip file name (e.g. But this got me thinking: why go through the trouble of typing make preview at all? It seems like the lesson change workflow goes something like this:
I think we could use hooks to get rid of step 3 above. The solution (borrowed from this thread) could look something like
#!/bin/sh
touch .commit
#!/bin/sh
if [ -f .commit ]
then
rm -f .commit
make preview
git add -u *.html
# Amend previous commit using same message
# Use --no-verify to bypass pre-commit hook so that we don't get caught in a loop
git commit --amend -C HEAD --no-verify
fi We could also use I'm fairly new to SWC and don't really know anything about the maintainer workflow, so my apologies if this isn't a useful suggestion. What do you think? And should this be moved to the lesson-template repo? I'm not really sure if/how the lesson repositories talk to each other. |
@richford, thanks for your suggestions. Some thoughts:
|
Thanks @iglpdc. I can open up a new issue in the lesson-template repo. Just to check, should this go in lesson-template or in lesson-example? Either way, from your comments and from @tbekolay's comments, it seems like a good approach would be:
ZIP_FILE=python-novice-inflammation-data.zip
DATA_DIR=data The nice thing about having to symlink the client-side hooks is that contributors who don't want to regenerate the HTML wouldn't run into the dependency issues that @iglpdc mentioned. Anyway, @tbekolay, @iglpdc, if you two like this approach, I'll go ahead and open an issue or submit a PR to the lesson-template repository. |
Lesson-template. This is the one with the tools we use across all lessons and gets merged periodically with them. Lesson-example has an example of the layout of the lesson and it's the one you should look to in you want to create a new lesson. |
update zip files. This enhancement grew out of [issue 94](swcarpentry/python-novice-inflammation#94 (comment)) in the python-novice-inflammation repository and the discussion in a [shell-novice PR](swcarpentry/shell-novice#141). It creates a maintainer_hooks directory in the tools directory. Lesson maintainers can use these hooks by symlinking to them in the .git/hooks directory. The pre-commit hook sets a "flag" file called .commit and the post-commit hook detects the presence of this flag and regenerates HTML and updates the data zip file if necessary. It then amends the previous commit by adding these files to the commit and keeping the same message.
update zip files. This enhancement grew out of [issue 94](swcarpentry/python-novice-inflammation#94) in the python-novice-inflammation repository and the discussion in a [shell-novice PR](swcarpentry/shell-novice#141). It creates a maintainer_hooks directory in the tools directory. Lesson maintainers can use these hooks by symlinking to them in the .git/hooks directory. The pre-commit hook sets a "flag" file called .commit and the post-commit hook detects the presence of this flag and regenerates HTML and updates the data zip file if necessary. It then amends the previous commit by adding these files to the commit and keeping the same message.
We have a zip file in the main directory to make it easy to get access to the necessary files used in the lesson. There's repetition here, but not repetition that we can avoid for pragmatic reasons. But, we should make sure that this zip always contains the right versions of the right files, so it would be helpful to have a little Python or Bash script that either checks that this zip is correct, or perhaps ideally, creates the appropriate zip file (which should be identical to the existing zip file if the files in it are the same).
The text was updated successfully, but these errors were encountered: