Skip to content
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

Test script to render files as webpages #82

Merged
merged 3 commits into from
Feb 13, 2020

Conversation

TomKellyGenetics
Copy link
Member

@TomKellyGenetics TomKellyGenetics commented Feb 11, 2020

🚨work-in-progress 🚨

Script to render webpages and handle submodules for merge PO files (see #81)

# sh wrapper.sh --repo r-novice-gapmnder --account swcarpentry-ja --import --webpages

Additions

  • synchronises existing English lessons to the archived versions as submodules of i18n

  • temporarily removes locale files for all lessons so only English (source) -> Japanese (target language) PO files are generated, restores these from git history after po4gitbook scripts are run so these are not changed unless --update is called

  • creates branches and submodules as needed and updates or resets pre-existing ones

This allows the English lessons to be handled entirely as submodules rather than creating and updating external repos

To do (mostly notes to future me):

  • migrate translated repos (e.g., r-novice-gapminder-ja) to submodules of i18n rather than external repos, this will mean local changes can be done entirely within the i18n repo (we may need to organise this more and make sure po4gitbook only runs on English lessons)

  • scripts to pull updates from new English lessons, this can merge updated sections into the PO files but could be tricky since David uses master not gh-pages branches (let's leave this for another day)

  • now that I've figured out how to convert and English lesson to the multilingual format (menus with the 🌐icon), we could script this rather than forking carpentries-i18n / carpentries-ES versions (they seem to be inactive now they're using transifex), not sure how often we'll need it though so I'm okay to do it manually as required

  • figure out how to call it on travis CI to build new lessons when merged, this will be a lot easier if everything is contained as a submodule I think

🚨work-in-progress 🚨

this script has not been tested thoroughly

Please do not use it to push to the swcarpentry-ja organisation repos, we should test it on forks on a user account first.

@TomKellyGenetics TomKellyGenetics added bug Something isn't working duplicate This issue or pull request already exists enhancement New feature or request work-in-progress Proposal for a feature in development, don't merge and removed bug Something isn't working duplicate This issue or pull request already exists labels Feb 11, 2020
@@ -0,0 +1,100 @@
remote_theme: "carpentries-i18n/carp-theme"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is to reset the config for a multilingual English lesson. I've done this manually for the R-gapminder lessons but haven't scripted this yet. Ended up down a rabbit hole with submodules...

echo "update local submodules"
#git submodule update --recursive --merge

#remove _locale directory (only translate English lessons)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about what this is doing too much. The issue really is that we can't pull updates for submodules from the right branch as David uses the "master" branch renamed as "gh-pages" so the history doesn't match when you pull "origin".

Merging updates might be tricky because of this but I should be able to sort it out.

git add -u
git commit -m "reset branch"
git checkout HEAD
rm -rf _locale
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thing is we want a git repo of the "gh-pages" branch with the _locale directory deleted but not commited (so that we can restore it below)

if [ -d $dir ]
then
cd $dir
git reset --hard
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will restore the repo to the git HEAD commit (this undeletes the _locale directory).

git pull swc-ja master

# remove files provided by template
rm -rf bin/boilerplate
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be deleted for the template to work from carpentries-i18n/carp-theme

fi

#push updated locale lessons to English lesson
git add -u
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commits updates to the submodules (adding new lessons in repo/_locale/ja)

@TomKellyGenetics
Copy link
Member Author

This is stable in my opinion (except for updating English source lessons). As tested for PR #114.

Lessons updated: https://swcarpentry-ja.github.io/r-novice-gapminder/ja/index/

@joelnitta or @rikutakei should be able to do this by running this in future.

sh wrapper.sh --repo r-novice-gapminder --account swcarpentry-ja --webpages

@TomKellyGenetics TomKellyGenetics removed the work-in-progress Proposal for a feature in development, don't merge label Sep 12, 2020
@TomKellyGenetics TomKellyGenetics self-assigned this Nov 23, 2020
@TomKellyGenetics TomKellyGenetics added the technical For improvements to scripts and issues with webpages label Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request technical For improvements to scripts and issues with webpages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant