Skip to content

Commit 06b84fc

Browse files
authored
Merge pull request #15 from mgrundkoetter/patch-1
fix for #14
2 parents b046b9d + fa1383d commit 06b84fc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ScriptHandler.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ public static function copy(Event $event)
1717
$extras = $event->getComposer()->getPackage()->getExtra();
1818
$extraField = $event->isDevMode() && isset($extras['copy-file-dev']) ? 'copy-file-dev' : 'copy-file';
1919

20+
$io = $event->getIO();
2021
if (!isset($extras[$extraField])) {
21-
throw new \InvalidArgumentException('The dirs or files needs to be configured through the extra.copy-file setting.');
22+
$io->write("No dirs or files are configured through the extra.{$extraField} setting.");
23+
return;
2224
}
2325

2426
$files = $extras[$extraField];
2527

2628
if ($files === array_values($files)) {
27-
throw new \InvalidArgumentException('The extra.copy-file must be hash like "{<dir_or_file_from>: <dir_to>}".');
29+
$io->write("The extra.{$extraField} must be hash like \"\{<dir_or_file_from>: <dir_to>\}\".");
30+
return;
2831
}
2932

3033
$fs = new Filesystem;
31-
$io = $event->getIO();
3234

3335
foreach ($files as $from => $to) {
3436
// check pattern
@@ -42,7 +44,7 @@ public static function copy(Event $event)
4244
if (!$overwriteNewerFiles) {
4345
$to = substr($to, 0, -1);
4446
}
45-
47+
4648
// Check the renaming of file for direct moving (file-to-file)
4749
$isRenameFile = substr($to, -1) != '/' && !is_dir($from);
4850

0 commit comments

Comments
 (0)