Peru a repository synchronizer

Some projects upstream bind together lot of files which might not be of interest, but still the convenience of a git pull to get latest updates, makes you to download the whole repository for just a bunch of files or folders.

For example, this website uses Pelican to generate the webpages out of markdown files. Pelican does have a rich set of plugins but all of them are in the same folder in the git checkout.

Here, is where peru comes in to play. Peru (hosted at https://github.com/buildinspace/peru) comes handy at this task.

You can install peru from pipsi:

pipsi install peru

And will provide you a command-line tool that uses a yaml file for definition of repositories, like the one I do use here:

imports:
  # The dircolors file just goes at the root of our project.
  sitemap: plugins/
  better_codeblock_line_numbering: plugins/
  better_figures_and_images: plugins/
  yuicompressor: plugins/

git module sitemap:
  url: [email protected]:getpelican/pelican-plugins.git
  pick: sitemap
  rev: ead70548ce2c78ed999273e265e3ebe13b747d83

git module yuicompressor:
  url: [email protected]:getpelican/pelican-plugins.git
  pick: yuicompressor
  rev: ead70548ce2c78ed999273e265e3ebe13b747d83

git module better_figures_and_images:
  url: [email protected]:getpelican/pelican-plugins.git
  pick: better_figures_and_images
  rev: ead70548ce2c78ed999273e265e3ebe13b747d83

git module better_codeblock_line_numbering:
  url: [email protected]:getpelican/pelican-plugins.git
  pick: better_codeblock_line_numbering
  rev: ead70548ce2c78ed999273e265e3ebe13b747d83

In this way, peru sync will download from the provided repositories the specified folder into the destination indicated, allowing you to integrate “other repositories files” in your own workflow.

For example, if you want to use citellus repository at one specific point in time, to be integrated in your code, you could use:

imports:
  citellus: ./

git module citellus:
  url: [email protected]:citellusorg/citellus.git
  pick: citellusclient/plugins/
  rev: 1ee1c6a36f51e8a7c809d5162004fb57ee99b168

This will checkout citellus repository at one specific point in time and merge in your current folder.

Enjoy! (and if you do, you can Buy Me a Coffee )

Pablo