mozart icon indicating copy to clipboard operation
mozart copied to clipboard

Bug: Files being copied into root of dep_directory

Open BrianHenryIE opened this issue 4 years ago • 1 comments

Using easypost/easypost-php which has autoloader:

"autoload": {
  "psr-0": {
    "EasyPost": "lib/"
  }
}

It copies files into Mozart's dep_directory that should be moved to expected dep_directory/EasyPost.

EasyPost's lib folder contains two files and a directory called EasyPost.

Output should be dep_directory/EasyPost/files.ext and dep_directory/EasyPost/EasyPost/morefiles.ext.

Output is dep_directory/files.ext and dep_directory/EasyPost/morefiles.ext.

{
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": {
    "easypost/easypost-php": "^3.4"
  },
  "require-dev": {
    "coenjacobs/mozart": "dev-master#3b1243ca8505fa6436569800dc34269178930f39"
  },
  "extra": {
    "mozart": {
      "dep_namespace": "Mozart",
      "dep_directory": "/src/Mozart/dep_directory/",
      "classmap_prefix": "Mozart_",
      "classmap_directory": "/src/Mozart/Classes/"
    }
  }
}

BrianHenryIE avatar Feb 18 '21 23:02 BrianHenryIE

I've managed to work around this by using override_autoload with:

"easypost/easypost-php": {
    "psr-4": {
        "EasyPost\\": "lib/"
    }
}

which moved the files as expected but the namespace of the library is just EasyPost (which doesn't look like it's conforming to PSR-0 standard anyway, but this doesn't seem to be an issue for other packages, e.g. Pimple) so won't be autoloaded by a PSR-4 autoloader, but shouldn't be a problem if I use a classmap.

Implementing the suggestion in #54 would help with this, i.e. rename the namespace to EasyPost\EasyPost to match the directory structure.

I'd still consider it a bug because there's no time copying files into the root of dep_directory makes sense. And they don't get removed if running mozart compose again, causing an issue then.

BrianHenryIE avatar Feb 21 '21 23:02 BrianHenryIE