{"id":18438663,"url":"https://github.com/seapagan/update_repo","last_synced_at":"2025-09-08T20:35:43.310Z","repository":{"id":5451568,"uuid":"52894328","full_name":"seapagan/update_repo","owner":"seapagan","description":"A Ruby Gem to keep multiple cloned Git Repositories up to date","archived":false,"fork":false,"pushed_at":"2024-09-02T22:41:28.000Z","size":5270,"stargazers_count":1,"open_issues_count":25,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T23:46:07.892Z","etag":null,"topics":["git","repository-management","ruby","rubygems"],"latest_commit_sha":null,"homepage":"https://updaterepo.grantramsay.dev/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seapagan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-01T17:04:21.000Z","updated_at":"2025-02-01T18:54:35.000Z","dependencies_parsed_at":"2024-06-10T12:18:57.794Z","dependency_job_id":"d9ae68d7-5e3a-4989-8aea-fcfb36146009","html_url":"https://github.com/seapagan/update_repo","commit_stats":{"total_commits":448,"total_committers":3,"mean_commits":"149.33333333333334","dds":"0.049107142857142905","last_synced_commit":"b5c51808f0f24e258df6a2b1248d9003e34ddb1f"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seapagan%2Fupdate_repo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seapagan%2Fupdate_repo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seapagan%2Fupdate_repo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seapagan%2Fupdate_repo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seapagan","download_url":"https://codeload.github.com/seapagan/update_repo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247732581,"owners_count":20986890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","repository-management","ruby","rubygems"],"created_at":"2024-11-06T06:21:03.893Z","updated_at":"2025-04-07T21:31:57.587Z","avatar_url":"https://github.com/seapagan.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# update_repo [![Gem Version](https://badge.fury.io/rb/update_repo.svg)](https://badge.fury.io/rb/update_repo) [![Build Status](https://app.travis-ci.com/seapagan/update_repo.svg?branch=main)](https://app.travis-ci.com/seapagan/update_repo)\n\n[![Coverage Status](https://coveralls.io/repos/github/seapagan/update_repo/badge.svg)](https://coveralls.io/github/seapagan/update_repo)\n[![Inline docs](https://inch-ci.org/github/seapagan/update_repo.svg?branch=main)](https://inch-ci.org/github/seapagan/update_repo)\n\nA Simple Gem to keep multiple locally-cloned Git Repositories up to date.\n\nThis is the conversion to a Gem of one of my standalone Ruby scripts. Still a\nwork in progress but the required base functionality is there. The script will\nsimply run `git pull` on every local clone of a git repository that it finds\nunder the specified directory or directories.\n\n**Note:** From version 0.9.0 onwards, the default mode of operation is\nnon-verbose. If you wish the same output as previous versions then specify\n`--verbose` on the command line or `verbose: true` in the configuration file.\n\n## Installation\n\n### Pre-requirements\n\nIt goes without saying that at the very least a working copy of both\n[`Git`][git] (version 1.8.5 or greater, the script will not run with an older\nversion) and [`Ruby`][ruby] (the script supports version 2.6.0 and above) need\nto be installed on your machine. Also, the script has currently only been tested\nunder Linux, not windows - it does work perfectly fine under the [Windows\nSubsystem for Linux][wsl] though.\n\nInstall this from the shell prompt as you would any other Ruby Gem\n\n```bash\ngem install update_repo\n```\n\n## Usage\n\n### Quick start\n\nCreate a [YAML][yaml]-formatted configuration file `.updaterepo` **in your home\ndirectory** that contains at least a 'location' tag pointing to the directory\ncontaining the git repositories you wish to have updated :\n\n```yaml\n---\nlocation:\n  - /media/myuser/git-repos\n  - /data/RepoDir\n```\n\nThis is the most basic example of a configuration file and there are other\noptions that can be added to fine-tune the operation - see the description of\nconfiguration options below and the [Website][website] for more information.\n\nThis file should be located in the users home directory (`~/.updaterepo`).\n\nRun the script :\n\n```bash\nupdate_repo\n```\n\n## Configuration\n\nThe below is a summary of the most common configuration options, see the\n[Website][website] for complete details and usage.\n\n### Configuration file\n\nThe configuration file defaults to `~/.updaterepo` and is a standard\n[YAML][yaml]-formatted text file. If this configuration file is not found, the\nscript will terminate with an error. The first line must contain the YAML\nfrontmatter of 3 dashes (`---`). After that, the following sections can follow\nin any order. Only the `location:` section is compulsory, and that must contain\nat least one entry.\n\n`location:` - at least one directory which contains the locally cloned\nrepository(s) to update. There is no limit on how many directories can be listed\n:\n\n```yaml\n---\nlocation:\n  - /media/myuser/git-repos\n  - /data/RepoDir\n```\n\n`exceptions:` - an (optional) list of repositories that will NOT be updated\nautomatically. Use this for repositories that need special handling, or should\nonly be manually updated. Note that the name specified is that of the\n**directory** holding the repository (has the `.git` directory inside)\n\n```yaml\nexceptions:\n  - ubuntu-trusty\n  - update_repo\n```\n\n`log:` - Log all output to the file `./.updaterepo`, defaults to FALSE\n(optional)\n\n```yaml\nlog: true\n```\n\n`timestamp:` - timestamp the output files instead of overwriting them, defaults\nto FALSE (optional)\n\n```yaml\ntimestamp: true\n```\n\n`verbose:` - display the output of the git command for each repo, defaults to\nFALSE (optional)\n\n```yaml\nverbose: true\n```\n\n`verbose_errors:` - List all the error output from a failing command in the\nsummary, not just the first line, defaults to FALSE (optional)\n\n```yaml\nverbose_errors: true\n```\n\n`brief:` - Do not print the header, footer or summary, defaults to FALSE\n(optional)\n\n```yaml\nbrief: true\n```\n\n`quiet:` - no output at all, not even the header and footer, defaults to FALSE\n(optional)\n\n```yaml\nquiet: true\n```\n\n`save_errors:` - Save any Git error messages from the last run for future\ndisplay, defaults to FALSE (optional)\n\n```yaml\nsave_errors: true\n```\n\n### Command line switches\n\nOptions are not required. If none are specified then the program will read from\nthe standard configuration file (~/.updaterepo) and automatically update the\nspecified Repositories. Command line options will take preference over those\nspecified in the configuration file. Again, see the [Website][website] for\ncomplete details and usage.\n\nEnter `update_repo --help` at the command prompt to get a list of available options :\n\n```text\nOptions:\n  -c, --color, --no-color    Use colored output (default: true)\n  -d, --dump                 Dump a list of Directories and Git URL's to STDOUT in CSV format\n  -p, --prune=\u003ci\u003e            Number of directory levels to remove from the --dump output\n                             Only valid when --dump or -d specified (Default: 0)\n  -l, --log                  Create a logfile of all program output to './update_repo.log'.\n                             Any older logs will be overwritten\n  -t, --timestamp            Timestamp the logfile instead of overwriting. Does nothing unless the\n                             --log option is also specified\n  -g, --log-local            Create the logfile in the current directory instead of in the users home\n                             directory\n  -r, --dump-remote          Create a dump to screen or log listing all the git remote URLS found in\n                             the specified directories\n  -V, --verbose              Display each repository and the git output to screen\n  -E, --verbose-errors       List all the error output from a failing command in the summary, not just the first line\n  -b, --brief                Do not print the header, footer or summary\n  -q, --quiet                Run completely silent, with no output to the terminal (except fatal errors)\n  -s, --save-errors          Save any Git error messages from the last run for future display\n  -S, --show-errors          Show any Git error messages from the last run of the script\n  -v, --version              Print version and exit\n  -h, --help                 Show this message\n```\n\n## To-Do\n\nAdd functionality, not in any specific order :\n\n- Either add an option 'variants' or similar to allow non-standard git pull\n  commands (eg Ubuntu kernel), or update the 'exceptions' option to do same.\n- Add command line option to specify an alternate config file.\n- Add ability to specify a new directory (containing Git repos) to search from\n  the command line, and optionally save this to the standard configuration.\n- Add new repo from the command line that will be cloned to the default repo\n  directory and then updated as usual. Extra flag added for \"add only, clone\n  later\" for offline use.\n- Add flag for 'default' repo directory (or another specific directory - if it\n  does not already exist it will be created and added to the standard list)\n  which will be used for new additions.\n- Add option to only display a (text) tree of the discovered git repositories,\n  not updating them.\n- Add ability to specify the colors used for each repository result (failure,\n  warning, skipped, updated, default etc). This should only be done from the\n  configuration file. The default settings will probably look pretty bad on a\n  white background for example. Specify from the safe defined list used by the\n  `colorize` gem.\n- Add Import \u0026 Export functionality :\n  - ability to export a text dump of each repo location and remote as a CSV\n    file. `[DONE]`\n  - re-import the above dump on a different machine or after reinstall. Modify\n    the '--prune' command to apply to this function also, removing the required\n    number of directory levels before importing.\n- Add option to use alternative git command if required, either globally or on a\n  case-by-case basis (see also comments on 'variants' above). Currently the\n  script just uses a blanket `git pull` command on all repositories.\n- Add option to specify a completely different directory for the log file other\n  than the 2 current options of home dir and local dir\n- Document configuration file format and options. `[IN PROGRESS]`\n- Add option to display the active config options, including those on command\n  line and config file.\n- Add option to create the config file with options from existing config and\n  command line\n- [WEB] Migrate to using Webpack instead of Gulp `[IN PROGRESS]`\n\nInternal Changes and refactoring :\n\n- Add testing!\n- Error checking and reporting for the git processes `[IN PROGRESS]`\n- Improve error-checking and recovery while parsing the configuration file\n  - Ignore and report invalid or missing directories\n  - Add more failure cases, there may be more git errors than \"fatal:\" or\n    \"error:\"\n- Retry for connection issues etc (config setting).\n- Fail gracefully with warning and useful information if there are no\n  `location:` entries or that tag is missing completely\n\n## Development\n\n### Developing for the Gem\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests (or simply `rake`). You can also run `bin/console`\nfor an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\nRun `rake` to run the RSpec tests, which also runs `RuboCop`, `Reek` and `inch\n--pedantic` too.\n\n### Developing for the Website\n\nThe source for the Gem’s website is also included in this repository. In fact,\nthere are 2 main folders related to the website :\n\n- [/web/](web/) folder - this is the SOURCE of the website, and all\n  modifications should be performed here.\n- [/docs/](docs/) folder - this is the GENERATED OUTPUT for the website, and\n  this folder is served up directly and live to the web using GitHub Pages. Do\n  not make any modifications to the files in this folder directly, your changes\n  will be overwritten when the website is generated. Alway make changes in the\n  `/web/` folder.\n\nThere are also a few support files to configure Node and Webpack which are used\nfor the build process.\n\nFor full details on how to update the website properly, please see the\n[WEBSITE.md](WEBSITE.md) file in the root of this repository.\n\nAny modifications that implement new functionality or user-facing API should\nalso come with the relevant update to the website documenting the new options or\nmodified functionality. Generally a Pull Request will not be accepted without\nthe related additions to the website, however help can be given on that side if\nthe process is unclear.\n\n### Using the provided Vagrant Box\n\nTo ease the setup of a consistent development environment under both Linux and\nWindows, we have provided a [Vagrantfile](Vagrantfile) with the project. This\nwill provide a virtual machine (running Ubuntu 16.04) that is already set up\nwith the required version of [Ruby][ruby], [Node.js][node] and the associated\ndevelopment deps. It will already have all the needed node packages and Ruby\ngems installed locally. The root of this project repository will be available\nunder the `/vagrant/` directory on this VM for ease of development. This means\nthat all the editing can be carried out on your normal system be it Windows,\nLinux or OSX, while the git control, testing, Gem building and Website\ngeneration (with Gulp) happens on the VM.\n\n#### Setting up Vagrant and VirtalBox\n\nThe easiest VM to use for both Windows, Linux and Mac is\n[VirtualBox][virtualbox] which is Free and Open Source.\n\n- Download and install Vagrant from their download pages [here][vagrantdl].\n  Follow the installation instructions depending on your operating system.\n- Download and install VirtualBox from their download pages\n  [here][virtualboxdl]. Follow the installation instructions depending on your\n  operating system.\n- Open a terminal (or Command Prompt in Windows) in the root directory of your\n  checked-out copy of this project, the one containing the\n  [Vagrantfile](Vagrantfile).\n- We need to install one Vagrant plugin, otherwise the VM Guest Additions will\n  be out of date and the `/vagrant/` share will not work. for this we install\n  the `vagrant-vbguest` plugin. To do this run the following at the terminal\n  prompt : `vagrant plugin install vagrant-vbguest`\n- Run `vagrant up` at the terminal prompt. This will proceed to download,\n  install and then provision an Ubuntu 16.04 Virtual Machine. For the first run,\n  this will take some time but thereafter it will be quicker.\n- Run `vagrant ssh` at the terminal prompt to ssh into the VM. Note that for the\n  first time, it will probably say that a reboot is required, simply type `sudo\n  reboot` at the prompt - the VM will reboot and you will be disconnected. Wait\n  a few minutes and then run `vagrant ssh` again.\n- Change to the `/vagrant` subdirectory which will contain the source for this\n  project and then develop away as normal.\n- For the first use only, if you change to `/vargrant` and there are no files\n  listed, this is generally because the VM Guest Additions have been updated\n  when bringing the VM up, but have not properly activated. In this case simply\n  `exit` the VM, run `vagrant halt` then `vagrant up` again which should fix it.\n\n#### Special comments for Windows users\n\nPrior to Windows 10, there was no default ssh client installed by default, so\n`vagrant ssh` will fail, giving you the settings required to use a third-party\nssh client (for example my preferred windows SSH client is\n[MobaXterm][mobaxterm]). If you prefer that `vagrant ssh` actually works from\nthe command line, it is possible to install the ssh command line programs if you\nalso install the [Git for Windows][git4windows] software. Install this, ensuring\nthat you choose the option 'Use Git and optional Unix tools from the Windows\nCommand Prompt'. After this, the ssh executable will be available from any\nwindows Command Shell and so `vagrant ssh` will work as expected. _Please note\nthe warning given by the installer related to this option though!_\n\n## Contributing\n\n**NOTE The default Branch has been renamed to 'main' from 'master'. Please ensure\nyou update any existing checkouts.**\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\nPlease note - This Gem currently aims to pass 100% on [RuboCop][rubocop],\n[Reek][reek] and [Inch-CI][inch] (on pedantic mode), so all pull requests should\ndo likewise. Ask for guidance if needed. Running `rake` will automatically test\nall 3 of those along with the RSpec tests.\n\n## Versioning\n\nThis Gem aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations\nof this scheme should be reported as bugs. Specifically, if a minor or patch\nversion is released that breaks backward compatibility, that version should be\nimmediately yanked and/or a new version should be immediately released that\nrestores compatibility. Breaking changes to the public API will only be\nintroduced with new major versions.\n\nOf course, currently we have not even reached version 1, so leave off the\nversion requirement completely. Expect any and all of the API and interface to\nchange!\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License][mit].\n\n[website]: http://updaterepo.seapagan.net\n[git]: http://git-scm.com\n[ruby]: http://www.ruby-lang.org\n[yaml]: http://yaml.org\n[rubocop]: https://github.com/bbatsov/rubocop\n[reek]: https://github.com/troessner/reek\n[inch]: https://inch-ci.org\n[semver]: http://semver.org/\n[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint\n[confoog]: http://confoog.seapagan.net\n[mit]: http://opensource.org/licenses/MIT\n[vagrant]: https://www.vagrantup.com/\n[vagrantdl]: https://www.vagrantup.com/downloads.html\n[virtualbox]: https://www.virtualbox.org\n[virtualboxdl]: https://www.virtualbox.org/wiki/Downloads\n[node]: http://nodejs.org\n[mobaxterm]: http://mobaxterm.mobatek.net/\n[git4windows]: https://git-scm.com/download/win\n[wsl]: https://docs.microsoft.com/en-us/windows/wsl/about\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseapagan%2Fupdate_repo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseapagan%2Fupdate_repo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseapagan%2Fupdate_repo/lists"}