Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved composer plugin #675

Merged
merged 21 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bump
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to delete this file

11 changes: 10 additions & 1 deletion doc/installation/exotic.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ You can manipulate how GrumPHP works based on settings in your composer file:
"extra": {
"grumphp": {
"config-default-path": "path/to/grumphp.yml",
"project-path": "path/to/your/project/folder"
"project-path": "path/to/your/project/folder",
"disable-plugin": false
}
}
}
Expand Down Expand Up @@ -48,6 +49,14 @@ After changing a parameter, you might want to re-initialize your git hooks:
php ./vendor/bin/grumphp git:init
```

**disable-plugin**

*Default: false*

In some cases, you don't want composer to initialise GrumPHP automatically.
For example: on global installations activating the plugin is questionable.
Luckily you can opt-out on this behaviour.


## Changing paths by using environment variables

Expand Down
1 change: 1 addition & 0 deletions resources/config/console.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
arguments:
- '@config'
- '@grumphp.util.filesystem'
- '@GrumPHP\Util\Paths'
tags:
- { name: 'console.command' }
GrumPHP\Console\Command\RunCommand:
Expand Down
13 changes: 4 additions & 9 deletions src/Composer/DevelopmentIntegrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Composer\Script\Event;
use GrumPHP\Collection\ProcessArgumentsCollection;
use GrumPHP\Process\ProcessFactory;
use Symfony\Component\Filesystem\Filesystem;
use GrumPHP\Util\Filesystem;

class DevelopmentIntegrator
{
Expand All @@ -19,11 +19,11 @@ public static function integrate(Event $event): void
$filesystem = new Filesystem();

$composerBinDir = $event->getComposer()->getConfig()->get('bin-dir');
$executable = getcwd().'/bin/grumphp';
$executable = dirname(__DIR__, 2).$filesystem->ensureValidSlashes('/bin/grumphp');
$composerExecutable = $composerBinDir.'/grumphp';
$filesystem->copy(
self::noramlizePath($executable),
self::noramlizePath($composerExecutable)
$filesystem->ensureValidSlashes($executable),
$filesystem->ensureValidSlashes($composerExecutable)
);

$commandlineArgs = ProcessArgumentsCollection::forExecutable($composerExecutable);
Expand All @@ -42,9 +42,4 @@ public static function integrate(Event $event): void

$event->getIO()->write('<fg=yellow>'.$process->getOutput().'</fg=yellow>');
}

private static function noramlizePath(string $path): string
{
return str_replace('/', DIRECTORY_SEPARATOR, $path);
}
}
Loading