libremail icon indicating copy to clipboard operation
libremail copied to clipboard

Include sync as a package

Open netandreus opened this issue 5 years ago • 3 comments

What problem or bug does this solve? Now we can use sync as a standalone composer package.

netandreus avatar Mar 20 '20 15:03 netandreus

@netandreus What problem is this solving? I'm not sure at first glance.

mikegioia avatar Mar 20 '20 15:03 mikegioia

Do you happen to have any info on why the paths are checked in that way? I'm unfamiliar with what a standalone composer package is.

mikegioia avatar Mar 21 '20 21:03 mikegioia

Let's try to introduce that we need to use libremail-sync like a common composer package for some project located in /var/www/mailsync/current. It's all about watcher app, we talked about earlier. Here is structure of my project. I use symfony 5 framework.

dependent-project-structure

Here is this projects composer.json file, located in /var/www/mailsync/current/composer.json

{
    "type": "project",
    "license": "mit",
    "minimum-stability": "dev",
    "repositories": [
        {
            "type":"package",
            "package": {
                "name": "netandreus/zend_mail",
                "version":"@dev",
                "source": {
                    "url": "[email protected]:netandreus/zend-mail.git",
                    "type": "git",
                    "reference":"develop-lsub"
                }
            },
            "comments": [
                "netandreus(particlebits)/zend-mail requires zendframework/zend-stdlib ~2.5",
                "but it is the cause of numerous errors, and i does not include it",
                "other netandreus(particlebits)/zend-mail requirements included to this file"
            ]
        },
        {
            "type":"package",
            "package": {
                "name": "netandreus/imap",
                "version":"2.0",
                "source": {
                    "url": "[email protected]:netandreus/imap.git",
                    "type": "git",
                    "reference":"develop-fixes"
                }
            }
        }
    ],
    "require": {
        "php": "^7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "symfony/console": "5.0.*",
        "symfony/dotenv": "5.0.*",
        "symfony/flex": "^1.3.1",
        "symfony/framework-bundle": "5.0.*",
        "symfony/orm-pack": "^1.0",
        "symfony/yaml": "5.0.*",
        "netandreus/ima-sync": "dev-master"
    },
    "require-dev": {
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/",
            "Zend\\Mail\\": "vendor/netandreus/zend_mail/src/",
            "Pb\\Imap\\": "vendor/netandreus/imap/src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "install-sync": [
            "ln -s -f ../vendor/netandreus/imap-sync/sync ./bin/sync"
        ],
        "post-install-cmd": [
            "@auto-scripts",
            "@install-sync"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.0.*"
        }
    }
}

Some comments:

netandreus/imap-sync - is composer package, making from my fork of libremail sync (with all issues resolved). netandreus/zend_mail - fork of your project with my fixes netandreus/imap - fork of your project with my fixes If you accept my PR - I can you direct links to your repos.

Task We need to run composer script from /var/www/mailsync/current/vendor/netandreus/imap-sync/sync When it started, it find autoload file in /var/www/mailsync/current/vendor/netandreus/imap-sync/sync/autoload.php but there is no such file. Compiled autoload.php for all dependencies of main project located in /var/www/mailsync/current/vendor/composer/autoload.php

Problem That is the problem. We need to add ability to sync / libremail /server load autoload.php not only them source dir:

/var/www/mailsync/current/vendor/netandreus/imap-sync/vendor/autoload.php

but from dependent projects dir:

/var/www/mailsync/current/vendor/autoload.php

netandreus avatar Mar 23 '20 07:03 netandreus