magento-hackathon / magento-composer-installer

Composer installer for Magento modules
210 stars 154 forks source link

Prompt for Missing Magento Root Directory #97

Closed astorm closed 10 years ago

astorm commented 10 years ago

If a user attempt to install the package without first specifying a magento root directory in extra, composer halts installation in an unknown state with the error message magento root dir "" is not valid. If possible, the plugin should prompt for this missing value, and make it clear what has and has not been installed.

screen shot 2014-05-24 at 5 56 51 pm

Steps to Reproduce:

  1. Create a composer.json matching the file below
  2. Run composer install

Expected Behavior: Composer prompts user for Magento folder location and continues as normal

Actual Behavior: Composer halts with a ErrorException, leaving user confused as to what state their system is in.

{
    "require": {
        "magento-hackathon/magento-composer-installer": "2.0.0-beta4",
        "pulsestorm/magento-better404": "1.*"
    },
    "repositories":[     
        {
            "packagist": false
        },         
        {
            "type":"composer",
            "url":"http://packages.firegento.com"
        }
   ]
}
bragento commented 10 years ago

I just added the requested behavior with some additional teaks with the pull request #99

Flyingmana commented 10 years ago

Why shouldn't I expect the users of the installer to not read the README first? Also everything which happened is able to see in the output of the command, or did happen anything else?

bragento commented 10 years ago

En contraire. Now you are prompted for an input, the extra info is written into the composer.json and optionally the root dir can be created if not existent. It's just more comfortable this way. Exceptions on the other hand are not that helpful from the users point if view.

Flyingmana commented 10 years ago

For now I extended the exception with a few more informations:

You need to set an existing path for "magento-root-dir" in your composer.json
For more information please read about the "Usage" in the README of the installer Package

But will wait for a bit more feedback of others

SchumacherFM commented 10 years ago

+1 for Daniel. RTFM first

riconeitzel commented 10 years ago

Why not make it more bulletproof by prompting for the required information!?

Saying "RTFM!" feels more like "I don't want to play with others …"

:-1: for Daniel :+1: for bragento

SchumacherFM commented 10 years ago

It such a complex topic that you need to RTFM first. How many annoying prompts would you like to add? Should it end as a Windows app? A little more detailed explanation of the error is always good.

bragento commented 10 years ago

We should keep in mind that only those who don't define extra.magento-root-dir and/or those who don't have the root dir set up will be prompted. Actually I doubt if we should expect each and every USER who tries to install a Magento Module via composer to read any manuals. Using the magento composer installer should be as accessible and easy as possible. Imagine the composer itself requiring you to crate the vendor dir manually before allowing you to install anything, you wouldn't want that either. At some point in the near future I would like to run composer init, define my dependencies there and just start the installation without having to prepare anything beforehand and without having to edit the composer.json by hand.

Further there is actually one more prompt I would like to add: magento-force

Flyingmana commented 10 years ago

implemented by merge of another PR