angelitolm/happor

Simple Repository Generator

dev-master / 2.0.x-dev 2019-07-04 01:21 UTC

This package is auto-updated.

Last update: 2020-01-04 02:21:26 UTC


README

Is the little Composer repository generator based on Satis.

Happor

Build Status codecov

Run from source

  • Install happor: composer create-project angelitolm/happor:dev-master
  • Build a repository: php bin/happor build <configuration-file> <output-dir>

Installation

Step 1

The first step is to clone it from github

composer create-project angelitolm/happor --stability=dev --keep-vcs

Step 2

Once it is finished we will initialize it so that it creates the configuration file (it could be done manually, too, but take advantage of the tool).

bin/happor init

We will assign the name and url of our local repository. The URL must have been previously created in a vhost beforehand.

Example:

    ServerAdmin admin@happor.example.com
    ServerName happor.example.com
    ErrorLog /var/log/error-happor.log
    LogLevel warn
    CustomLog /var/log/access-happor.log combined
    DocumentRoot /var/www/html/happor/web
    
       DirectoryIndex index.html index.php
       Options Indexes FollowSymLinks MultiViews
       AllowOverride all
       Order deny,allow
       Deny from all
       Allow from all
    

When initializing it, a file named happor.json has been created with this content:

{
    "name": "Happor, The little PHP Package Repository",
    "homepage": "http://happor.example.com",
    "repositories": [],
    "require-all": true
}

Step 3

Now it's time to add modules that are from remote repositories, which are those that will be served from Happor instead of using the original remote repository.

For that, while it can also be done manually, we will continue with the console of Happor. For the example I have created two modules (only the basic structure) that have their private repositories in Github).

bin/happor add git@github.com:symfony/symfony-standard.git

Manual example:

We must edit the file happor.json and add the following:

{
    "type": "vcs",
    "url": "git@github.com:symfony/symfony-standard.git"
}

Staying as follows:

{
    "name": "Happor, The little PHP Package Repository",
    "homepage": "http://happor.example.com",
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:symfony/symfony-standard.git"
        }
    ],
    "require-all": true
}

Step 4

Assuming we have added all the repositories that we needed, now we have to do our first build. For this, we execute:

bin/happor build happor.json web -n

To understand the command:

  • bin/happor: is the console.
  • build: is the command that we are wanting to execute.
  • happor.json: the name of the file from which the parameters will be taken.
  • web: the directory in which the build and the web interface will be created.
  • -n: we use the parameter to take credentials of the user who is executing the command (the ssh keys, for example, to access the repositories added).

Now we can navigate with our browser our instance of Happor and we would have the packages that we had added.

http://happor.example.com

Run as Docker container

Pull the image:

docker pull composer/happor

Run the image:

docker run --rm -it -v /build:/build composer/happor

Note: by default it will look for a configuration file named happor.json inside the /build directory and dump the generated output files in /build/output.

Run the image (with Composer cache from host):

docker run --rm -it -v /build:/build -v $COMPOSER_HOME:/composer composer/happor

If you want to run the image without implicitly running Happor, you have to override the entrypoint specified in the Dockerfile:

docker run --rm -it --entrypoint /bin/sh composer/happor

Purge

If you choose to archive packages as part of your build, over time you can be left with useless files. With the purge command, you can delete these files.

php bin/happor purge <configuration-file> <output-dir>

Note: don't do this unless you are certain your projects no longer reference any of these archives in their composer.lock files.

Updating

Updating Happor is as simple as running git pull && composer update in the Happor directory.

If you are running Happor as a Docker container, simply pull the latest image.

Contributing

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Fork the project, create a feature branch, and send us a pull request.

Authors

See the list of contributors who participate(d) in this project.

License

Happor is licensed under the MIT License - see the LICENSE file for details