Giter Site home page Giter Site logo

luya-composer's Introduction

LUYA Composer Plugin

Build Status Test Coverage Total Downloads Latest Stable Version Join the chat at https://gitter.im/luyadev/luya

Following Tasks are done by the luya composer task:

  • Provides the symlink to the bin file inside the root directory of the application.
  • Bind blocks into the system without a module
  • Add files to the LUYA Bootstrapping process.

In order to enable luya extra section in your package, the package type must be either luya-extension or luya-module.

An example of define a blocks folder inside your composer json file.

"type" : "luya-extension",
"extra" : {
    "luya" : {
        "blocks": [
            "path/to/blocks",
            "path/to/one/Block.php"
        ],
        "bootstrap": [
            "namespace\\to\\my\\BootstrapFile"
        ]
    }
}

LUYA will now import those blocks when running the import command.

For root packages there is a symlink property available inside luya section of extra in order to disable the symlink of luya binary into application folder.

Local Testing for Composer Plugin Development

In order to test the luya composer plugins you have to create a new folder outside of the current luya-composer folder and include the the composer package with a composer.json as following:

{
    "minimum-stability" : "dev",
    "repositories": [
        {
            "type": "path",
            "url": "../luya-composer"
        }
    ],
    "require": {
        "luyadev/luya-composer": "*"
    }
}

Then you can create a test.sh file to test the plugin process like

#!/bin/bash

rm -rf vendor
rm -r composer.lock
composer update -v

Give the script test.sh the permissions with chmod +x test.sh and now run

./test

In order to test the installer events you have to create a sub package like

{
    "name" : "my/test",
    "extra" : {
        "luya" : {
            "blocks": [
                "path/to/blocks/*"
            ]
        }
    }
}

The sub package must be linked in your local testing composer.json

{
    "minimum-stability": "dev",
    "repositories": [
        {
            "type": "path",
            "url": "../luya-composer"
        }
        {
            "type": "path",
            "url": "../path/to/my/test/package"
        }
    ],
    "require": {
        "luyadev/luya-composer": "*",
        "my/test" : "*"
    },
    "extra" : {
        "luya" : {
            "blocks": [
                "path/to/blocks/*"
            ]
        }
    }
}

luya-composer's People

Contributors

boehsermoe avatar hbugdoll avatar nadar avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

luya-composer's Issues

If require-dev do not add to installer.php

If a package is in the require-dev section, the information should not be added to the installer.php this might make some problems with no-dev dependencies are used in production envs (or phar builder).

Use PackageInterface

HP Fatal error: Uncaught TypeError: Argument 1 passed to luya\composer\Plugin::ensureLuyaExtraSectionSymlinkIsDisabled() must be an instance of Composer\Package\Package, instance of Composer\Package\RootAliasPackage given, called in /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php on line 102 and defined in /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php:126
Stack trace:
#0 /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php(102): luya\composer\Plugin->ensureLuyaExtraSectionSymlinkIsDisabled(Object(Composer\Package\RootAliasPackage))
#1 [internal function]: luya\composer\Plugin->postUpdateScript(Object(Composer\Script\Event))
#2 phar:///home/travis/.phpenv/versions/7.1.11/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
#3 phar:///home/travis/.phpenv/versions/7.1.11/bin/composer/src/Composer/EventDispatcher/EventDispatch in /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php on line 126
Fatal error: Uncaught TypeError: Argument 1 passed to luya\composer\Plugin::ensureLuyaExtraSectionSymlinkIsDisabled() must be an instance of Composer\Package\Package, instance of Composer\Package\RootAliasPackage given, called in /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php on line 102 and defined in /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php:126
Stack trace:
#0 /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php(102): luya\composer\Plugin->ensureLuyaExtraSectionSymlinkIsDisabled(Object(Composer\Package\RootAliasPackage))
#1 [internal function]: luya\composer\Plugin->postUpdateScript(Object(Composer\Script\Event))
#2 phar:///home/travis/.phpenv/versions/7.1.11/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
#3 phar:///home/travis/.phpenv/versions/7.1.11/bin/composer/src/Composer/EventDispatcher/EventDispatch in /home/travis/build/luyadev/luya-module-contactform/vendor/luyadev/luya-composer/src/Plugin.php on line 126
The command "composer install --prefer-dist --no-interaction" exited with 255.

Luya failed to import blocks when running "php index.php import" command

What steps will reproduce the problem?

When i run the import command on windows 10, it only import 2 blocks, while bootstrap, generic and module-cms failed to import

What do you get instead? (A Screenshot can help us a lot!)

The errors i get are :
"Unable to process block definition 'vendor\luyadev\luya-bootstrap3\src\blocks'"
"Unable to process block definition 'vendor\luyadev\luya-generic\src\blocks'"
"Unable to process block definition 'vendor\luyadev\luya-module-cms\src\frontend\blocks'"

LUYA Check ouput (run this script and post the result: luyacheck.php)

this is the output :
PS C:\xampp\htdocs\dashboard\luya-kickstarter> php luyacheck.php PHP Fatal error: Uncaught Error: Call to undefined function apache_get_modules() in C:\xampp\htdocs\dashboard\luya-kickstarter\luyacheck.php(22) : eval()'d code:1
Stack trace:
#0 C:\xampp\htdocs\dashboard\luya-kickstarter\luyacheck.php(22): eval()
#1 {main}
thrown in C:\xampp\htdocs\dashboard\luya-kickstarter\luyacheck.php(22) : eval()'d code on line 1

Fatal error: Uncaught Error: Call to undefined function apache_get_modules() in C:\xampp\htdocs\dashboard\luya-kickstarter\luyacheck.php(22) : eval()'d code:1
Stack trace:
#0 C:\xampp\htdocs\dashboard\luya-kickstarter\luyacheck.php(22): eval()
#1 {main}
thrown in C:\xampp\htdocs\dashboard\luya-kickstarter\luyacheck.php(22) : eval()'d code on line 1

Additional infos

Q A
LUYA Version 1.0.24
PHP Version 7.3.11
Platform XAMPP
Operating system Windows.

Only 2 block success when import command the other fails

while import command

Unable to process block definition 'vendor\luyadev/luya-bootstrap3\src/blocks'
Unable to process block definition 'vendor\luyadev/luya-generic\src/blocks'
Unable to process block definition 'vendor\luyadev/luya-module-cms\src/frontend/blocks'
only 2 block success
how to resolve this issues

luya symlink is created as absolute path

When creating a luya project, the luya symlink in the project directory is created as an absolute path, e.g.:

$ ls -la |grep luya
lrwxrwxrwx  1 cebehosting cebehosting    61 Nov  7 09:40 luya -> /home/cebe/dev/cebe.cc/luya/vendor/luyadev/luya-core/bin/luya

when deploying this repo to a production environment, the link is not correct anymore. ideally it should be created relative to the current path:

luya -> vendor/luyadev/luya-core/bin/luya

the code for this is here:

if (!is_link('luya') && !is_file('luya')) {
symlink($this->_vendorDir . DIRECTORY_SEPARATOR . 'luyadev/luya-core/bin/luya', 'luya');
}

composer 2.0

PHP Fatal error: Class luya\composer\Plugin contains 2 abstract methods an
d must therefore be declared abstract or implement the remaining methods (C
omposer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface
::uninstall)

Bootstrap Blocks

Ability to provide extra section with blocks or a folder which will be imported when the import command runs.

This will the ability to add blocks like a plugin without adding a module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.