Metadata-Version: 2.1
Name: project-patcher
Version: 0.3.0
Summary: A project constructor, diff generator, and patcher rolled into one
Author-email: Aaron Haim <ahaim@ashwork.net>
License: MIT License
        
        Copyright (c) 2023 Aaron Haim
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: homepage, https://github.com/ahaim5357/project-patcher
Project-URL: issue_tracker, https://github.com/ahaim5357/project-patcher/issues
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: git
Provides-Extra: all
License-File: LICENSE

# project_patcher

`project_patcher` is a project constructor, diff generator, and patcher in one module to better improve and fix the reproducibility of other work.

## Project Files

'Project Files' indicate a method of grabbing a file(s) from some location to put into the working directory. Each project file can specify a relative directory to the working directory of where to extract to.

The following project file types are supported:

* osf - An Open Science Framework project
* git - A git repository
* url - An arbitrary url to obtain a file via a GET request

## Project Metadata Specification

The `project_metadata.json` generated with each project looks like so:

```js
{
    "files": [
        {
            "type": "xxx", // Must be "osf", "url", or "git"
            "dir": "<path>", // The directory relative to the working directory to put the file in (default: the working directory)
            "extra": {
                // An object containing user-defined data
            }
        }
        {
            "type": "osf",
            "id": "<project_id>" // The five alphanumeric character OSF project identifier 
        },
        {
            "type": "url",
            "url": "<url>" // A url to query a file from via a GET request
        },
        {
            "type": "git",
            "repository": "<git_repo>", // The git repository to checkout
            "branch|tag|commit": "<branch_name>|<tag_name>|<commit_id>" // The location to checkout to (default: the default branch when cloning the repository)
        }
    ],
    "ignore": [
        // A list of file patterns to ignore instead of patching if it exists.
        "xxx"
    ],
    "overwrite": [
        // A list of file patterns to overwrite instead of patching if it exists.
        "xxx"
    ],
    "extra": {
        // An object containing user-defined data
    }
}
```

## Commands

The following commands can be accessed from the command line interface:

* `project_patcher init [--import_metadata/-I <path_or_url>]`
    * Initializes a new project to be patched either from the metadata in the current directory, an import, or provided via the builder.
    * Optional Parameters:
        * `--import_metadata/-I` - Takes in a path or url to the metadata JSON to build the project for.
* `project_patcher clean [--import_metadata/-I <path_or_url>]`
    * Initializes a clean workspace either from the metadata in the current directory, an import, or provided via the builder.
    * Optional Parameters:
        * `--import_metadata/-I` - Takes in a path or url to the metadata JSON to build the project for.
* `project_patcher src [--import_metadata/-I <path_or_url>]`
    * Initializes a patched workspace either from the metadata in the current directory, an import, or provided via the builder.
    * Optional Parameters:
        * `--import_metadata/-I` - Takes in a path or url to the metadata JSON to build the project for.
* `project_patcher output`
    * Generates any patches from the original files and clones the new files to an output directory.
