# **Git-PM : A package manager for GitHub repositories** (sort of...)
Do you spend your days cloning repositories from **Github** ? Do you thoroughly install and use softwares that are still in **development stage** ? Do you wish there could be a simple way to keep those softwares **up-to-date even** though you keep using a dev version ? Well, **look no more !** Here is a **package manager**, or maybe just a script, that will **keep track** of the packages on your system and that will **upgrade** them for you. *Yay ! More time to do ~~nothing~~ something useful !*
Oh, and I almost forgot : the Git Package Manager can **upgrade itself**, as it is available on Git.
Right now the package manager allow installation of git repositories of the following languages: **Node.js** (`npm`), **Python** (`setup.py`), **Rust** (`cargo`), but it can also perform a *standalone install of any language* to a particular folder (default being /opt/git-pm).
This projects implements a simple system command : `git-pm`.
The syntax is close to a mix of **apt-get** *(Debian user spotted)* and **pip**, with *`install`, `uninstall`, `freeze`, `upgrade`,* or *`list`* among available **sub-commands**.
Basically running the command `git-pm install xx/yy` as a superuser will install the repository *yy* of author *xx* on your system. `git-pm install http://github.com/xx/yy` or `git-pm install yy` will also work.
The first time the command is run as a superuser, it will create an **ini file** containing some options and the database. The database is a simple **JSON** file keeping tracks of installed repositories. `git-pm` will also log every system-sensible operations (operations that must be run as superuser) to a log file. All of these can be found by typing `git-pm info --whereis` in the terminal.
The output is intended to be colored, so it may no look well depending on your terminal ! Submit a bug report if your terminal emulator does not work well with the formatting.
As you may have understood, this project is something done mostly for practicing **Python**. But as it may be useful to someone, I though it would be a good idea to upload it. But do not expect any **long-term support** or **new features** ~~or blahblahblah~~ beyond my capacities and my will !
Still, I am a **Biology Student** and my coding is not that sharp ; I hope I didn't break more than **a hundred _PEPs_ !**
Right now the project is available on [**GitHub**](http://github.com/althonos/git-pm), so you can clone the repository and install from the setup.py by doing:
git clone http://github.com/althonos/git-pm
python3 setup.py install
If git command line is not installed, or if you're just feeling too lazy to type three different commands, you can grab the package from **PyPI** instead with:
pip install git-pm
After installation, run the following command to bootstrap your new best friend (you know, it will basically upgrade itself from now on).
git-pm update && git-pm upgrade
It will tell you it needs an upgrade even though you installed it from the latest available version : that's absolutely normal, as I can't package the source with all the informations available on GitHub, so the latest release can't know it's the latest release *(dumbass)*.
This app was intended as a **system command** all along. So yeah, you could try to use it via **Python**, but even I can't properly explain what everything does. So if you're curious, you could still launch Python and try to import **git_pm** (caution, this is an underscore).
> Repoception ! Well, right now it doesn't work.
Still, take care : most of the commands requires to have **superuser privileges**, so you'll have to launch your homemade script as a superuser.
Several **subcommands** are available ; `git-pm` by itself won't do anything (excepted printing the documentation).
* #### `install [repo [repo ...]]`
This will install one or more git repositories on the local system and register it in the database. If repository has no way to be installed, if will be moved to *opt/git-pm/*. But if a **setup.py** file is present, it will be run (and git-pm will keep track of the installed files.)
* #### `uninstall [repo [repo ...]]`
This will uninstall repositories from the local system and deregister them from the database.
* #### `list`
This will list all installed packages on the local system along with some informations about those packages : author, url to gitpage, latest commit...
Filters are also available to only display certain database entries.
* #### `update`
This will check the repo webpage of each installed repository to look for a new available version
* #### `upgrade [repo [repo ...]]`
This will upgrade every installed repository to the latest version.
* #### `freeze [repo [repo ...]]`
This will prevent repositories from being upgraded even though a new commit was made.
* #### `roll [repo [repo ...]]`
This will allow frozen packages to be upgraded again.
* #### `info`
This will print various informations about the git-pm command itself
* #### `flush`
This will remove all files created by git-pm from the local system. **Use with caution !**
Use `git-pm -h` or `git-pm cmd -h` (replacing cmd with one of the previous commands) to get a more complete view of the available syntax and arguments.
If for some very sad reason you want to uninstall git-pm, you can perform
git-pm uninstall git-pm
as a superuser to remove git-pm from your system.
Me, myself and I.
**I love pull requests !**
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.