@@ -45,13 +45,13 @@ |
||
| 45 | 45 | $io = $this->createIOMock(); |
| 46 | 46 | $io->method('getArgument')->willReturn('hook:pre-push'); |
| 47 | 47 | $io->expects($this->atLeastOnce()) |
| 48 | - ->method('getStandardInput') |
|
| 49 | - ->willReturn( |
|
| 50 | - [ |
|
| 51 | - 'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' . |
|
| 52 | - ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8' |
|
| 53 | - ] |
|
| 54 | - ); |
|
| 48 | + ->method('getStandardInput') |
|
| 49 | + ->willReturn( |
|
| 50 | + [ |
|
| 51 | + 'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' . |
|
| 52 | + ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8' |
|
| 53 | + ] |
|
| 54 | + ); |
|
| 55 | 55 | $operator = $this->createGitDiffOperator(['fiz.php', 'foo.txt']); |
| 56 | 56 | $repository = $this->createRepositoryMock(''); |
| 57 | 57 | $repository->expects($this->once())->method('getDiffOperator')->willReturn($operator); |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | ->method('getBranchRevFromRefLog') |
| 49 | 49 | ->willReturn('main'); |
| 50 | 50 | $info->expects($this->once()) |
| 51 | - ->method('getCurrentBranch') |
|
| 52 | - ->willReturn('foo'); |
|
| 51 | + ->method('getCurrentBranch') |
|
| 52 | + ->willReturn('foo'); |
|
| 53 | 53 | |
| 54 | 54 | $repo->expects($this->atLeastOnce())->method('getLogOperator')->willReturn($log); |
| 55 | 55 | $repo->expects($this->atLeastOnce())->method('getInfoOperator')->willReturn($info); |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | ->method('getChangedFilesSince') |
| 103 | 103 | ->willReturn(['file1.php', 'file2.php', 'README.md', 'foo.txt']); |
| 104 | 104 | $info->expects($this->once()) |
| 105 | - ->method('getCurrentBranch') |
|
| 106 | - ->willReturn('foo'); |
|
| 105 | + ->method('getCurrentBranch') |
|
| 106 | + ->willReturn('foo'); |
|
| 107 | 107 | |
| 108 | 108 | $repo->expects($this->atLeastOnce())->method('getLogOperator')->willReturn($log); |
| 109 | 109 | $repo->expects($this->atLeastOnce())->method('getInfoOperator')->willReturn($info); |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | ->method('getChangedFilesSince') |
| 130 | 130 | ->willReturn(['foo/file1.php', 'foo/file2.php', 'README.md']); |
| 131 | 131 | $info->expects($this->once()) |
| 132 | - ->method('getCurrentBranch') |
|
| 133 | - ->willReturn('foo'); |
|
| 132 | + ->method('getCurrentBranch') |
|
| 133 | + ->willReturn('foo'); |
|
| 134 | 134 | |
| 135 | 135 | $repo->expects($this->atLeastOnce())->method('getLogOperator')->willReturn($log); |
| 136 | 136 | $repo->expects($this->atLeastOnce())->method('getInfoOperator')->willReturn($info); |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | '<fg=red>Warning: Hook script is out of date</>', |
| 82 | 82 | 'The git hook script needs to be updated.', |
| 83 | 83 | 'Required version is <info>' . CH::MIN_REQ_INSTALLER . '</info>' |
| 84 | - . ' found <fg=red>' . $installerVersion . '</>.', |
|
| 84 | + . ' found <fg=red>' . $installerVersion . '</>.', |
|
| 85 | 85 | 'Please re-install your hook by running:', |
| 86 | 86 | ' <comment>captainhook install ' . $this->hook . '</comment>', |
| 87 | 87 | '', |
@@ -41,64 +41,64 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | parent::configure(); |
| 43 | 43 | $this->setName('install') |
| 44 | - ->setDescription('Install hooks to your .git/hooks directory') |
|
| 45 | - ->setHelp('Install git hooks to your .git/hooks directory') |
|
| 46 | - ->addArgument( |
|
| 47 | - 'hook', |
|
| 48 | - InputArgument::OPTIONAL, |
|
| 49 | - 'Limit the hooks you want to install. ' . |
|
| 50 | - 'You can specify multiple hooks with comma as delimiter. ' . |
|
| 51 | - 'By default all hooks get installed' |
|
| 52 | - ) |
|
| 53 | - ->addOption( |
|
| 54 | - 'only-enabled', |
|
| 55 | - null, |
|
| 56 | - InputOption::VALUE_NONE, |
|
| 57 | - 'Limit the hooks you want to install to those enabled in your conf. ' . |
|
| 58 | - 'By default all hooks get installed' |
|
| 59 | - ) |
|
| 60 | - ->addOption( |
|
| 61 | - 'force', |
|
| 62 | - 'f', |
|
| 63 | - InputOption::VALUE_NONE, |
|
| 64 | - 'Force install without confirmation' |
|
| 65 | - ) |
|
| 66 | - ->addOption( |
|
| 67 | - 'skip-existing', |
|
| 68 | - 's', |
|
| 69 | - InputOption::VALUE_NONE, |
|
| 70 | - 'Do not overwrite existing hooks' |
|
| 71 | - ) |
|
| 72 | - ->addOption( |
|
| 73 | - 'move-existing-to', |
|
| 74 | - null, |
|
| 75 | - InputOption::VALUE_OPTIONAL, |
|
| 76 | - 'Move existing hooks to given directory' |
|
| 77 | - ) |
|
| 78 | - ->addOption( |
|
| 79 | - 'bootstrap', |
|
| 80 | - 'b', |
|
| 81 | - InputOption::VALUE_OPTIONAL, |
|
| 82 | - 'Path to composers vendor/autoload.php' |
|
| 83 | - ) |
|
| 84 | - ->addOption( |
|
| 85 | - 'run-mode', |
|
| 86 | - 'm', |
|
| 87 | - InputOption::VALUE_OPTIONAL, |
|
| 88 | - 'Git hook run mode [php|shell|docker]' |
|
| 89 | - ) |
|
| 90 | - ->addOption( |
|
| 91 | - 'run-exec', |
|
| 92 | - 'e', |
|
| 93 | - InputOption::VALUE_OPTIONAL, |
|
| 94 | - 'The Docker command to start your container e.g. \'docker exec CONTAINER\'' |
|
| 95 | - ) |
|
| 96 | - ->addOption( |
|
| 97 | - 'run-path', |
|
| 98 | - 'p', |
|
| 99 | - InputOption::VALUE_OPTIONAL, |
|
| 100 | - 'The path to the CaptainHook executable \'/usr/bin/captainhook\'' |
|
| 101 | - ); |
|
| 44 | + ->setDescription('Install hooks to your .git/hooks directory') |
|
| 45 | + ->setHelp('Install git hooks to your .git/hooks directory') |
|
| 46 | + ->addArgument( |
|
| 47 | + 'hook', |
|
| 48 | + InputArgument::OPTIONAL, |
|
| 49 | + 'Limit the hooks you want to install. ' . |
|
| 50 | + 'You can specify multiple hooks with comma as delimiter. ' . |
|
| 51 | + 'By default all hooks get installed' |
|
| 52 | + ) |
|
| 53 | + ->addOption( |
|
| 54 | + 'only-enabled', |
|
| 55 | + null, |
|
| 56 | + InputOption::VALUE_NONE, |
|
| 57 | + 'Limit the hooks you want to install to those enabled in your conf. ' . |
|
| 58 | + 'By default all hooks get installed' |
|
| 59 | + ) |
|
| 60 | + ->addOption( |
|
| 61 | + 'force', |
|
| 62 | + 'f', |
|
| 63 | + InputOption::VALUE_NONE, |
|
| 64 | + 'Force install without confirmation' |
|
| 65 | + ) |
|
| 66 | + ->addOption( |
|
| 67 | + 'skip-existing', |
|
| 68 | + 's', |
|
| 69 | + InputOption::VALUE_NONE, |
|
| 70 | + 'Do not overwrite existing hooks' |
|
| 71 | + ) |
|
| 72 | + ->addOption( |
|
| 73 | + 'move-existing-to', |
|
| 74 | + null, |
|
| 75 | + InputOption::VALUE_OPTIONAL, |
|
| 76 | + 'Move existing hooks to given directory' |
|
| 77 | + ) |
|
| 78 | + ->addOption( |
|
| 79 | + 'bootstrap', |
|
| 80 | + 'b', |
|
| 81 | + InputOption::VALUE_OPTIONAL, |
|
| 82 | + 'Path to composers vendor/autoload.php' |
|
| 83 | + ) |
|
| 84 | + ->addOption( |
|
| 85 | + 'run-mode', |
|
| 86 | + 'm', |
|
| 87 | + InputOption::VALUE_OPTIONAL, |
|
| 88 | + 'Git hook run mode [php|shell|docker]' |
|
| 89 | + ) |
|
| 90 | + ->addOption( |
|
| 91 | + 'run-exec', |
|
| 92 | + 'e', |
|
| 93 | + InputOption::VALUE_OPTIONAL, |
|
| 94 | + 'The Docker command to start your container e.g. \'docker exec CONTAINER\'' |
|
| 95 | + ) |
|
| 96 | + ->addOption( |
|
| 97 | + 'run-path', |
|
| 98 | + 'p', |
|
| 99 | + InputOption::VALUE_OPTIONAL, |
|
| 100 | + 'The path to the CaptainHook executable \'/usr/bin/captainhook\'' |
|
| 101 | + ); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | $template = Template\Builder::build($config, $repo, $this->resolver); |
| 131 | 131 | $installer = new Installer($io, $config, $repo, $template); |
| 132 | 132 | $installer->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 133 | - ->setForce(IOUtil::argToBool($input->getOption('force'))) |
|
| 134 | - ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing'))) |
|
| 135 | - ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to'))) |
|
| 136 | - ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled'))) |
|
| 137 | - ->run(); |
|
| 133 | + ->setForce(IOUtil::argToBool($input->getOption('force'))) |
|
| 134 | + ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing'))) |
|
| 135 | + ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to'))) |
|
| 136 | + ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled'))) |
|
| 137 | + ->run(); |
|
| 138 | 138 | |
| 139 | 139 | return 0; |
| 140 | 140 | } |
@@ -37,32 +37,32 @@ |
||
| 37 | 37 | { |
| 38 | 38 | parent::configure(); |
| 39 | 39 | $this->setName('uninstall') |
| 40 | - ->setDescription('Remove all git hooks from your .git/hooks directory') |
|
| 41 | - ->setHelp('Remove all git hooks from your .git/hooks directory') |
|
| 42 | - ->addArgument( |
|
| 43 | - 'hook', |
|
| 44 | - InputArgument::OPTIONAL, |
|
| 45 | - 'Remove only this one hook. By default all hooks get uninstalled' |
|
| 46 | - ) |
|
| 47 | - ->addOption( |
|
| 48 | - 'force', |
|
| 49 | - 'f', |
|
| 50 | - InputOption::VALUE_NONE, |
|
| 51 | - 'Force install without confirmation' |
|
| 52 | - ) |
|
| 53 | - ->addOption( |
|
| 54 | - 'only-disabled', |
|
| 55 | - null, |
|
| 56 | - InputOption::VALUE_NONE, |
|
| 57 | - 'Limit the hooks you want to remove to those that are not enabled in your conf. ' . |
|
| 58 | - 'By default all hooks get uninstalled' |
|
| 59 | - ) |
|
| 60 | - ->addOption( |
|
| 61 | - 'move-existing-to', |
|
| 62 | - null, |
|
| 63 | - InputOption::VALUE_OPTIONAL, |
|
| 64 | - 'Move existing hooks to this directory' |
|
| 65 | - ); |
|
| 40 | + ->setDescription('Remove all git hooks from your .git/hooks directory') |
|
| 41 | + ->setHelp('Remove all git hooks from your .git/hooks directory') |
|
| 42 | + ->addArgument( |
|
| 43 | + 'hook', |
|
| 44 | + InputArgument::OPTIONAL, |
|
| 45 | + 'Remove only this one hook. By default all hooks get uninstalled' |
|
| 46 | + ) |
|
| 47 | + ->addOption( |
|
| 48 | + 'force', |
|
| 49 | + 'f', |
|
| 50 | + InputOption::VALUE_NONE, |
|
| 51 | + 'Force install without confirmation' |
|
| 52 | + ) |
|
| 53 | + ->addOption( |
|
| 54 | + 'only-disabled', |
|
| 55 | + null, |
|
| 56 | + InputOption::VALUE_NONE, |
|
| 57 | + 'Limit the hooks you want to remove to those that are not enabled in your conf. ' . |
|
| 58 | + 'By default all hooks get uninstalled' |
|
| 59 | + ) |
|
| 60 | + ->addOption( |
|
| 61 | + 'move-existing-to', |
|
| 62 | + null, |
|
| 63 | + InputOption::VALUE_OPTIONAL, |
|
| 64 | + 'Move existing hooks to this directory' |
|
| 65 | + ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | public function testStdInValue(): void |
| 29 | 29 | { |
| 30 | 30 | $expected = 'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' |
| 31 | - . ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8'; |
|
| 31 | + . ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8'; |
|
| 32 | 32 | |
| 33 | 33 | $io = $this->createIOMock(); |
| 34 | 34 | $repo = $this->createRepositoryMock(); |
@@ -37,40 +37,40 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | parent::configure(); |
| 39 | 39 | $this->setName('config:info') |
| 40 | - ->setAliases(['info']) |
|
| 41 | - ->setDescription('Displays information about the configuration') |
|
| 42 | - ->setHelp('Displays information about the configuration') |
|
| 43 | - ->addArgument('hook', InputArgument::OPTIONAL, 'Hook you want to investigate') |
|
| 44 | - ->addOption( |
|
| 45 | - 'list-actions', |
|
| 46 | - 'a', |
|
| 47 | - InputOption::VALUE_NONE, |
|
| 48 | - 'List all actions' |
|
| 49 | - ) |
|
| 50 | - ->addOption( |
|
| 51 | - 'list-conditions', |
|
| 52 | - 'p', |
|
| 53 | - InputOption::VALUE_NONE, |
|
| 54 | - 'List all conditions' |
|
| 55 | - ) |
|
| 56 | - ->addOption( |
|
| 57 | - 'list-options', |
|
| 58 | - 'o', |
|
| 59 | - InputOption::VALUE_NONE, |
|
| 60 | - 'List all options' |
|
| 61 | - ) |
|
| 62 | - ->addOption( |
|
| 63 | - 'list-config', |
|
| 64 | - 's', |
|
| 65 | - InputOption::VALUE_NONE, |
|
| 66 | - 'List all config settings' |
|
| 67 | - ) |
|
| 68 | - ->addOption( |
|
| 69 | - 'extensive', |
|
| 70 | - 'e', |
|
| 71 | - InputOption::VALUE_NONE, |
|
| 72 | - 'Show more detailed information' |
|
| 73 | - ); |
|
| 40 | + ->setAliases(['info']) |
|
| 41 | + ->setDescription('Displays information about the configuration') |
|
| 42 | + ->setHelp('Displays information about the configuration') |
|
| 43 | + ->addArgument('hook', InputArgument::OPTIONAL, 'Hook you want to investigate') |
|
| 44 | + ->addOption( |
|
| 45 | + 'list-actions', |
|
| 46 | + 'a', |
|
| 47 | + InputOption::VALUE_NONE, |
|
| 48 | + 'List all actions' |
|
| 49 | + ) |
|
| 50 | + ->addOption( |
|
| 51 | + 'list-conditions', |
|
| 52 | + 'p', |
|
| 53 | + InputOption::VALUE_NONE, |
|
| 54 | + 'List all conditions' |
|
| 55 | + ) |
|
| 56 | + ->addOption( |
|
| 57 | + 'list-options', |
|
| 58 | + 'o', |
|
| 59 | + InputOption::VALUE_NONE, |
|
| 60 | + 'List all options' |
|
| 61 | + ) |
|
| 62 | + ->addOption( |
|
| 63 | + 'list-config', |
|
| 64 | + 's', |
|
| 65 | + InputOption::VALUE_NONE, |
|
| 66 | + 'List all config settings' |
|
| 67 | + ) |
|
| 68 | + ->addOption( |
|
| 69 | + 'extensive', |
|
| 70 | + 'e', |
|
| 71 | + InputOption::VALUE_NONE, |
|
| 72 | + 'Show more detailed information' |
|
| 73 | + ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $editor = new Reader($io, $config, $repo); |
| 92 | 92 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 93 | - ->display(Reader::OPT_ACTIONS, $input->getOption('list-actions')) |
|
| 94 | - ->display(Reader::OPT_CONDITIONS, $input->getOption('list-conditions')) |
|
| 95 | - ->display(Reader::OPT_OPTIONS, $input->getOption('list-options')) |
|
| 96 | - ->extensive($input->getOption('extensive')) |
|
| 97 | - ->run(); |
|
| 93 | + ->display(Reader::OPT_ACTIONS, $input->getOption('list-actions')) |
|
| 94 | + ->display(Reader::OPT_CONDITIONS, $input->getOption('list-conditions')) |
|
| 95 | + ->display(Reader::OPT_OPTIONS, $input->getOption('list-options')) |
|
| 96 | + ->extensive($input->getOption('extensive')) |
|
| 97 | + ->run(); |
|
| 98 | 98 | |
| 99 | 99 | return 0; |
| 100 | 100 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $runner = new Reader($io, $config, $repo); |
| 38 | 38 | $runner->setHook('pre-commit') |
| 39 | - ->run(); |
|
| 39 | + ->run(); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testDoesNotAllowInvalidHookNames(): void |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $runner = new Reader($io, $config, $repo); |
| 51 | 51 | $runner->setHook('foo') |
| 52 | - ->run(); |
|
| 52 | + ->run(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function testItDisplaysOnlyActions(): void |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $runner = new Reader($io, $config, $repo); |
| 65 | 65 | $runner->setHook('pre-commit') |
| 66 | - ->display(Reader::OPT_ACTIONS, true) |
|
| 67 | - ->run(); |
|
| 66 | + ->display(Reader::OPT_ACTIONS, true) |
|
| 67 | + ->run(); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function testItDisplaysActionsAndConditions(): void |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $input = new ArrayInput(['--version' => true]); |
| 28 | 28 | $output = $this->getMockBuilder(NullOutput::class) |
| 29 | - ->disableOriginalConstructor() |
|
| 30 | - ->getMock(); |
|
| 29 | + ->disableOriginalConstructor() |
|
| 30 | + ->getMock(); |
|
| 31 | 31 | |
| 32 | 32 | $output->expects($this->once())->method('writeLn'); |
| 33 | 33 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $input = new ArrayInput(['command' => 'list']); |
| 48 | 48 | $output = $this->getMockBuilder(NullOutput::class) |
| 49 | - ->disableOriginalConstructor() |
|
| 50 | - ->getMock(); |
|
| 49 | + ->disableOriginalConstructor() |
|
| 50 | + ->getMock(); |
|
| 51 | 51 | |
| 52 | 52 | $app = new Application('captainhook'); |
| 53 | 53 | $app->setAutoExit(false); |