bldr-io / bldr

Awesome Task Runner
http://bldr.io
MIT License
219 stars 21 forks source link

bin/bldr update removes all composer dependencies - composer.json not found? #149

Closed lastzero closed 8 years ago

lastzero commented 8 years ago

Bldr comes with predefined install and update commands that can not be overwritten in .bldr.yml.dist. Those commands execute composer install / composer update, but don't seem to find composer.json:

# bin/bldr update
Loading composer repositories with package information
Updating dependencies                                 
  - Removing bldr-io/bldr (8.4.0)
  - Removing bldr-io/composer-plugin (1.0.6)
  - Removing dflydev/embedded-composer (dev-master)
  - Removing composer/composer (dev-master)
  - Removing composer/spdx-licenses (1.1.2)
  - Removing composer/semver (1.2.0)
...

Basically, Bldr removes itself, which doesn't seem to be the intended behaviour. It probably looks for composer.json in bin instead of the main directory?

My composer.json looks like this (only the important parts):

{
  "autoload": {
    "psr-0": {
      "": "src/"
    }
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "require": {
    "symfony/symfony": "2.8.*"
  },
  "require-dev": {
    "bldr-io/bldr": "@stable"
  },
  "config": {
    "bin-dir": "bin"
  }
}
cryptiklemur commented 8 years ago

Those two arent supposed to be used for running your own composer install. Those are for installing third party blocks for bldr.

lastzero commented 8 years ago

But right now they uninstall existing project dependencies without asking. Are you sure, this is what you want?

cryptiklemur commented 8 years ago

Its not actually bldr code: https://github.com/bldr-io/bldr/blob/master/src/Application.php#L118

Its embedded composer

lastzero commented 8 years ago

Maybe you want to rename the arguments to install-blocks and update-blocks then, as a quick fix? We're using Bldr as a task runner / automation tool. If bin/bldr build works and executes a project build, any sane person would expect bin/bldr update to execute a project update!? (Most devs don't read the docs, when they are in a hurry.)

cryptiklemur commented 8 years ago

I can't change that command. It's not my command to change.

And i have to disagree. A developer should know what executable they are executing.

lastzero commented 8 years ago

I understand, but it worries me a bit. Bldr seems like a hack to me now. Bldr is not just a random executable, but a configurable task runner. Nothing you want to be surprised of. Think of Murphy’s Law.

k-k commented 8 years ago

@aequasi You can change the command names. The argument you pass to the constructor on those commands sets the prefix for the command name, which you're setting as empty ('').

Maybe blocks-install and blocks-update would be a good compromise.

lastzero commented 8 years ago

While all build profiles work without using "run", update still doesn't work as expected:

# bin/bldr update

  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "run" is not defined.                                   

Might be due to

$nonContainerCommands = ['install', 'update', 'dumpautoload', 'help'];

in src/Application.php?