grony


Namegrony JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/luismedel/grony
SummaryAn utility to schedule git-related actions using crontab expressions.
upload_time2023-01-23 07:19:49
maintainer
docs_urlNone
authorLuis Medel
requires_python
license
keywords git automation cron crontab
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # grony

An utility to schedule git-related actions (`pull`, `commit` and `push` at this moment) using crontab expressions.

## Installation

> Note: you need Python 3.

```sh
> pip install grony
```

After that, should have a `grony` command available.

```sh
> grony
```

## Usage

`grony` consists of two components:

- A long running process (the scheduler) used to schedule and launch git commands.
- A client, used to manage the scheduler.

First things first. You need to start the scheduler.

## Starting the scheduler

Using whatever method you want (in a console, a startup script o anything supported in your OS) run:

```sh
> grony start
```

The tool will run in foreground. So it's advised yo use a way to leave it as a background process.

### Starting the scheduler as a service in Linux

TBD.

### Starting the scheduler as a service in macOS

Use the scripts located at `scripts/macOS` in this repo to add/remove a launchd for grony.

To enable the grony scheduler as a service and start automatically when the current user logs in.

```sh
> scripts/macOS/add-launchd.sh
```

To prevent the grony scheduler to start automatically when the current user logs in.

```sh
> scripts/macOS/remove-launchd.sh
```

## Add a repository

Say you want to execute an automatic commit on a repository located at `/sources/my-project`.

```sh
> grony add /sources/my-project
Repository friendly name [my-project]: <press enter>
Successfully added my-project
```

That's it. That command instructs grony to schedule tasks for that repository. No to the next ste.

## Configure actions

You need a way to tell grony what commands to run and when. Depending of your needs or personal preferences, you can use two ways:

- A centralized one, configured in (whichever is found first):
  - `$GRONY_CONFIG_PATH`
  - `$XDG_CONFIG_HOME/.grony/grony.conf`
  - `$HOME/.grony/grony.conf`.
- A decentralized one, configured in each repo's `.grony` file.

### Configuring actions in `grony.conf`

Open your `grony.conf` in a text editor. You should see something like this (you can ignore any value in the `[config]` section as it's used internally by the program)

```ini
[config]
ipc_port = 62830
secret = 4ac19f9d-7e18-4a0e-aa83-729c51bdddcf

[repo 'my-project']
path = /sources/my-project
```

You must setup what to do in `my-project` in the section `[repo 'my-project']`.

Available options are:

- `pull-on`: a crontab-like expression detailing when to run `git pull`.
- `pull-remote`: the remote name where to pull from (optional)
- `commit-on`: a crontab-like expression detailing when to run `git add -A && git commit`.
- `commit-message`: the commit message for `commit-on` (defaults to 'Auto commit at %Y%m%d %H:%M:%S').
- `push-on`: : a crontab-like expression detailing when to run `git push`.
- `push-remote`: the remote name where to push to (optional)

You don't have to set all values. Only those what you need. For example, if you only need to perform automatic commits every minute and you are ok with the default message, configure `commit-on` like this:

```ini
[repo 'my-project']
path = /sources/my-project
commit-on = * * * * *
```

You can configure all actions if you want. Remember that if they need to run at the same time, they'll run always in the this order: `pull-on`, `commit-on`, `push-on`.

```ini
[repo 'my-project']
path = /sources/my-project
push-on = @hourly         ; the config order you use does not matter
pull-on = @hourly
commit-on = @hourly
```

### Configuring actions in each repo's `.grony`

You can put a `.grony` file in the repository root with the following format:

```ini
[repo]
push-on = @hourly
pull-on = @hourly
commit-on = @hourly
```

Note:

- It does not contain a `[config]` section.
- The section is called `[repo]`.
- It does not contain the repository `path`.

Outside of that, the settings are exactly the same.

You can use the following command to initialize a basic `.grony` file with default settings in a repository root:

```sh
> grony init /sources/my-project
```

### Overriding `.grony` settings

You can have settings for a repo defined both in the `.grony` file and in your `grony.conf`.

Both settings will be merged at run time and any setting present in `grony.conf` **will override** the one in the `.grony` file.

> This is useful to override some settings on a per-machine basis, like the commit message, for example.

### Updating settings

You can update any setting in any moment. grony will reload all files periodically to update the scheduled tasks.

> Note: this interval can be user-defined in `grony start` (see below).

## More info

Just use the integrated help for the rest of the commands. It's pretty self-explanatory.

```
Usage: grony [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  add     Adds a repository to the grony.conf file.
  init    Initializes a .grony file in the specified path.
  list    List all configured repositories.
  remove  Removes a repository from the grony.conf file.
  show    Show the effeective settings for a repository.
  start   Starts the main process.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/luismedel/grony",
    "name": "grony",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "git,automation,cron,crontab",
    "author": "Luis Medel",
    "author_email": "luis@luismedel.com",
    "download_url": "https://files.pythonhosted.org/packages/80/bc/35869d2d029527ad4e7ad2fff9deba17af161c0099f27edab0ec8b4a5124/grony-0.4.2.tar.gz",
    "platform": null,
    "description": "# grony\n\nAn utility to schedule git-related actions (`pull`, `commit` and `push` at this moment) using crontab expressions.\n\n## Installation\n\n> Note: you need Python 3.\n\n```sh\n> pip install grony\n```\n\nAfter that, should have a `grony` command available.\n\n```sh\n> grony\n```\n\n## Usage\n\n`grony` consists of two components:\n\n- A long running process (the scheduler) used to schedule and launch git commands.\n- A client, used to manage the scheduler.\n\nFirst things first. You need to start the scheduler.\n\n## Starting the scheduler\n\nUsing whatever method you want (in a console, a startup script o anything supported in your OS) run:\n\n```sh\n> grony start\n```\n\nThe tool will run in foreground. So it's advised yo use a way to leave it as a background process.\n\n### Starting the scheduler as a service in Linux\n\nTBD.\n\n### Starting the scheduler as a service in macOS\n\nUse the scripts located at `scripts/macOS` in this repo to add/remove a launchd for grony.\n\nTo enable the grony scheduler as a service and start automatically when the current user logs in.\n\n```sh\n> scripts/macOS/add-launchd.sh\n```\n\nTo prevent the grony scheduler to start automatically when the current user logs in.\n\n```sh\n> scripts/macOS/remove-launchd.sh\n```\n\n## Add a repository\n\nSay you want to execute an automatic commit on a repository located at `/sources/my-project`.\n\n```sh\n> grony add /sources/my-project\nRepository friendly name [my-project]: <press enter>\nSuccessfully added my-project\n```\n\nThat's it. That command instructs grony to schedule tasks for that repository. No to the next ste.\n\n## Configure actions\n\nYou need a way to tell grony what commands to run and when. Depending of your needs or personal preferences, you can use two ways:\n\n- A centralized one, configured in (whichever is found first):\n  - `$GRONY_CONFIG_PATH`\n  - `$XDG_CONFIG_HOME/.grony/grony.conf`\n  - `$HOME/.grony/grony.conf`.\n- A decentralized one, configured in each repo's `.grony` file.\n\n### Configuring actions in `grony.conf`\n\nOpen your `grony.conf` in a text editor. You should see something like this (you can ignore any value in the `[config]` section as it's used internally by the program)\n\n```ini\n[config]\nipc_port = 62830\nsecret = 4ac19f9d-7e18-4a0e-aa83-729c51bdddcf\n\n[repo 'my-project']\npath = /sources/my-project\n```\n\nYou must setup what to do in `my-project` in the section `[repo 'my-project']`.\n\nAvailable options are:\n\n- `pull-on`: a crontab-like expression detailing when to run `git pull`.\n- `pull-remote`: the remote name where to pull from (optional)\n- `commit-on`: a crontab-like expression detailing when to run `git add -A && git commit`.\n- `commit-message`: the commit message for `commit-on` (defaults to 'Auto commit at %Y%m%d %H:%M:%S').\n- `push-on`: : a crontab-like expression detailing when to run `git push`.\n- `push-remote`: the remote name where to push to (optional)\n\nYou don't have to set all values. Only those what you need. For example, if you only need to perform automatic commits every minute and you are ok with the default message, configure `commit-on` like this:\n\n```ini\n[repo 'my-project']\npath = /sources/my-project\ncommit-on = * * * * *\n```\n\nYou can configure all actions if you want. Remember that if they need to run at the same time, they'll run always in the this order: `pull-on`, `commit-on`, `push-on`.\n\n```ini\n[repo 'my-project']\npath = /sources/my-project\npush-on = @hourly         ; the config order you use does not matter\npull-on = @hourly\ncommit-on = @hourly\n```\n\n### Configuring actions in each repo's `.grony`\n\nYou can put a `.grony` file in the repository root with the following format:\n\n```ini\n[repo]\npush-on = @hourly\npull-on = @hourly\ncommit-on = @hourly\n```\n\nNote:\n\n- It does not contain a `[config]` section.\n- The section is called `[repo]`.\n- It does not contain the repository `path`.\n\nOutside of that, the settings are exactly the same.\n\nYou can use the following command to initialize a basic `.grony` file with default settings in a repository root:\n\n```sh\n> grony init /sources/my-project\n```\n\n### Overriding `.grony` settings\n\nYou can have settings for a repo defined both in the `.grony` file and in your `grony.conf`.\n\nBoth settings will be merged at run time and any setting present in `grony.conf` **will override** the one in the `.grony` file.\n\n> This is useful to override some settings on a per-machine basis, like the commit message, for example.\n\n### Updating settings\n\nYou can update any setting in any moment. grony will reload all files periodically to update the scheduled tasks.\n\n> Note: this interval can be user-defined in `grony start` (see below).\n\n## More info\n\nJust use the integrated help for the rest of the commands. It's pretty self-explanatory.\n\n```\nUsage: grony [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  add     Adds a repository to the grony.conf file.\n  init    Initializes a .grony file in the specified path.\n  list    List all configured repositories.\n  remove  Removes a repository from the grony.conf file.\n  show    Show the effeective settings for a repository.\n  start   Starts the main process.\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An utility to schedule git-related actions using crontab expressions.",
    "version": "0.4.2",
    "split_keywords": [
        "git",
        "automation",
        "cron",
        "crontab"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73fbcdc9cf5c3dbeb0494713440150c5319db12b4c14793aa2e69b347de33a2d",
                "md5": "0f14f55e30ef7b567d834306d47d039a",
                "sha256": "631037315757fc35368add38b3da95f08d31592c7e87a9e53771dd475652a262"
            },
            "downloads": -1,
            "filename": "grony-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f14f55e30ef7b567d834306d47d039a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24554,
            "upload_time": "2023-01-23T07:19:48",
            "upload_time_iso_8601": "2023-01-23T07:19:48.050296Z",
            "url": "https://files.pythonhosted.org/packages/73/fb/cdc9cf5c3dbeb0494713440150c5319db12b4c14793aa2e69b347de33a2d/grony-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80bc35869d2d029527ad4e7ad2fff9deba17af161c0099f27edab0ec8b4a5124",
                "md5": "5975c6b9a29ae006e3aea9701359ae0f",
                "sha256": "2025b3a374f9a51650f831b2c8fad1c5e9a496e6a2d27648a8a386b209339d1d"
            },
            "downloads": -1,
            "filename": "grony-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5975c6b9a29ae006e3aea9701359ae0f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24247,
            "upload_time": "2023-01-23T07:19:49",
            "upload_time_iso_8601": "2023-01-23T07:19:49.495468Z",
            "url": "https://files.pythonhosted.org/packages/80/bc/35869d2d029527ad4e7ad2fff9deba17af161c0099f27edab0ec8b4a5124/grony-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-23 07:19:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "luismedel",
    "github_project": "grony",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "grony"
}
        
Elapsed time: 0.03225s