@@ -144,16 +144,16 @@ discard block |
||
| 144 | 144 | $conditionConfig = new Config\Condition( |
| 145 | 145 | 'and', |
| 146 | 146 | [[ |
| 147 | - 'exec' => '\\' . Any::class, |
|
| 148 | - 'args' => [ |
|
| 149 | - ['foo.php', 'bar.php'] |
|
| 150 | - ] |
|
| 151 | - ], [ |
|
| 152 | - 'exec' => '\\' . Any::class, |
|
| 153 | - 'args' => [ |
|
| 154 | - ['foo.php', 'bar.php'] |
|
| 155 | - ] |
|
| 156 | - ]] |
|
| 147 | + 'exec' => '\\' . Any::class, |
|
| 148 | + 'args' => [ |
|
| 149 | + ['foo.php', 'bar.php'] |
|
| 150 | + ] |
|
| 151 | + ], [ |
|
| 152 | + 'exec' => '\\' . Any::class, |
|
| 153 | + 'args' => [ |
|
| 154 | + ['foo.php', 'bar.php'] |
|
| 155 | + ] |
|
| 156 | + ]] |
|
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | $runner = new Condition($io, $repository, $this->createConfigMock(), 'post-checkout'); |
@@ -175,21 +175,21 @@ discard block |
||
| 175 | 175 | $conditionConfig = new Config\Condition( |
| 176 | 176 | 'or', |
| 177 | 177 | [[ |
| 178 | - 'exec' => '\\' . FileStaged\All::class, |
|
| 179 | - 'args' => [ |
|
| 180 | - ['foo.php', 'bar.php'] |
|
| 181 | - ] |
|
| 182 | - ], [ |
|
| 183 | - 'exec' => '\\' . Any::class, |
|
| 184 | - 'args' => [ |
|
| 185 | - ['buz.php', 'bar.php'] |
|
| 186 | - ] |
|
| 187 | - ], [ |
|
| 188 | - 'exec' => '\\' . Any::class, |
|
| 189 | - 'args' => [ |
|
| 190 | - ['foo.php', 'bar.php'] |
|
| 191 | - ] |
|
| 192 | - ]] |
|
| 178 | + 'exec' => '\\' . FileStaged\All::class, |
|
| 179 | + 'args' => [ |
|
| 180 | + ['foo.php', 'bar.php'] |
|
| 181 | + ] |
|
| 182 | + ], [ |
|
| 183 | + 'exec' => '\\' . Any::class, |
|
| 184 | + 'args' => [ |
|
| 185 | + ['buz.php', 'bar.php'] |
|
| 186 | + ] |
|
| 187 | + ], [ |
|
| 188 | + 'exec' => '\\' . Any::class, |
|
| 189 | + 'args' => [ |
|
| 190 | + ['foo.php', 'bar.php'] |
|
| 191 | + ] |
|
| 192 | + ]] |
|
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | 195 | $runner = new Condition($io, $repository, $this->createConfigMock(), 'post-checkout'); |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $template = $this->createTemplateMock(); |
| 120 | 120 | |
| 121 | 121 | $template->expects($this->once()) |
| 122 | - ->method('getCode') |
|
| 123 | - ->with('pre-commit') |
|
| 124 | - ->willReturn(''); |
|
| 122 | + ->method('getCode') |
|
| 123 | + ->with('pre-commit') |
|
| 124 | + ->willReturn(''); |
|
| 125 | 125 | |
| 126 | 126 | $runner = new Installer($io, $config, $repo, $template); |
| 127 | 127 | $runner->setHook('pre-commit'); |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | $repo = new Repository($fakeRepo->getRoot()); |
| 157 | 157 | |
| 158 | 158 | $template->expects($this->once()) |
| 159 | - ->method('getCode') |
|
| 160 | - ->with('pre-commit') |
|
| 161 | - ->willReturn(''); |
|
| 159 | + ->method('getCode') |
|
| 160 | + ->with('pre-commit') |
|
| 161 | + ->willReturn(''); |
|
| 162 | 162 | |
| 163 | 163 | $runner = new Installer($io, $config, $repo, $template); |
| 164 | 164 | $runner->setHook('pre-commit') |
| 165 | - ->setMoveExistingTo('foo/bar/') |
|
| 166 | - ->run(); |
|
| 165 | + ->setMoveExistingTo('foo/bar/') |
|
| 166 | + ->run(); |
|
| 167 | 167 | |
| 168 | 168 | $this->assertFileExists($fakeRepo->getHookDir() . '/pre-commit'); |
| 169 | 169 | $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/pre-commit'); |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | $repo = new Repository($fakeRepo->getRoot()); |
| 195 | 195 | |
| 196 | 196 | $template->expects($this->once()) |
| 197 | - ->method('getCode') |
|
| 198 | - ->with('pre-commit') |
|
| 199 | - ->willReturn(''); |
|
| 197 | + ->method('getCode') |
|
| 198 | + ->with('pre-commit') |
|
| 199 | + ->willReturn(''); |
|
| 200 | 200 | |
| 201 | 201 | $runner = new Installer($io, $config, $repo, $template); |
| 202 | 202 | $runner->setHook('pre-commit') |
| 203 | - ->setMoveExistingTo('foo/bar/') |
|
| 204 | - ->run(); |
|
| 203 | + ->setMoveExistingTo('foo/bar/') |
|
| 204 | + ->run(); |
|
| 205 | 205 | |
| 206 | 206 | $this->assertFileExists($fakeRepo->getHookDir() . '/pre-commit'); |
| 207 | 207 | } |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | $runner = new Installer($io, $config, $repo, $template); |
| 237 | 237 | $runner->setHook('pre-commit') |
| 238 | - ->setMoveExistingTo('foo') |
|
| 239 | - ->run(); |
|
| 238 | + ->setMoveExistingTo('foo') |
|
| 239 | + ->run(); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | public function createResolverMock(string $executable = 'vendor/bin/captainhook', bool $isPhar = false): Resolver |
| 33 | 33 | { |
| 34 | 34 | $repo = $this->getMockBuilder(Resolver::class) |
| 35 | - ->disableOriginalConstructor() |
|
| 36 | - ->getMock(); |
|
| 35 | + ->disableOriginalConstructor() |
|
| 36 | + ->getMock(); |
|
| 37 | 37 | |
| 38 | 38 | $repo->method('getExecutable')->willReturn($executable); |
| 39 | 39 | $repo->method('isPharRelease')->willReturn($isPhar); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | |
| 53 | 53 | $repo = $this->getMockBuilder(Repository::class) |
| 54 | - ->disableOriginalConstructor() |
|
| 55 | - ->getMock(); |
|
| 54 | + ->disableOriginalConstructor() |
|
| 55 | + ->getMock(); |
|
| 56 | 56 | |
| 57 | 57 | $repo->method('getRoot')->willReturn($root); |
| 58 | 58 | $repo->method('getHooksDir')->willReturn($root . '/.git/hooks'); |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | public function createGitInfoOperator(string $tag = 'v1.0.0', string $branch = 'master'): Info |
| 71 | 71 | { |
| 72 | 72 | $operator = $this->getMockBuilder(Info::class) |
| 73 | - ->disableOriginalConstructor() |
|
| 74 | - ->getMock(); |
|
| 73 | + ->disableOriginalConstructor() |
|
| 74 | + ->getMock(); |
|
| 75 | 75 | |
| 76 | 76 | $operator->method('getCurrentTag')->willReturn($tag); |
| 77 | 77 | $operator->method('getCurrentBranch')->willReturn($branch); |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | public function createGitDiffOperator(array $changedFiles = []): Diff |
| 89 | 89 | { |
| 90 | 90 | $operator = $this->getMockBuilder(Diff::class) |
| 91 | - ->disableOriginalConstructor() |
|
| 92 | - ->getMock(); |
|
| 91 | + ->disableOriginalConstructor() |
|
| 92 | + ->getMock(); |
|
| 93 | 93 | |
| 94 | 94 | $operator->method('getChangedFiles')->willReturn($changedFiles); |
| 95 | 95 | |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | public function createGitIndexOperator(array $stagedFiles = []): Index |
| 120 | 120 | { |
| 121 | 121 | $operator = $this->getMockBuilder(Index::class) |
| 122 | - ->disableOriginalConstructor() |
|
| 123 | - ->getMock(); |
|
| 122 | + ->disableOriginalConstructor() |
|
| 123 | + ->getMock(); |
|
| 124 | 124 | |
| 125 | 125 | $operator->method('getStagedFiles')->willReturn($stagedFiles); |
| 126 | 126 | |
@@ -47,9 +47,9 @@ |
||
| 47 | 47 | { |
| 48 | 48 | parent::configure(); |
| 49 | 49 | $this->setName('hook:' . $this->hookName) |
| 50 | - ->setAliases([$this->hookName]) |
|
| 51 | - ->setDescription('Run git ' . $this->hookName . ' hook') |
|
| 52 | - ->setHelp('This command executes the ' . $this->hookName . ' hook'); |
|
| 50 | + ->setAliases([$this->hookName]) |
|
| 51 | + ->setDescription('Run git ' . $this->hookName . ' hook') |
|
| 52 | + ->setHelp('This command executes the ' . $this->hookName . ' hook'); |
|
| 53 | 53 | |
| 54 | 54 | $this->addOption( |
| 55 | 55 | 'bootstrap', |
@@ -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->setForce(IOUtil::argToBool($input->getOption('force'))) |
| 133 | - ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing'))) |
|
| 134 | - ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to'))) |
|
| 135 | - ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled'))) |
|
| 136 | - ->setHook(IOUtil::argToString($input->getArgument('hook'))) |
|
| 137 | - ->run(); |
|
| 133 | + ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing'))) |
|
| 134 | + ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to'))) |
|
| 135 | + ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled'))) |
|
| 136 | + ->setHook(IOUtil::argToString($input->getArgument('hook'))) |
|
| 137 | + ->run(); |
|
| 138 | 138 | |
| 139 | 139 | return 0; |
| 140 | 140 | } |
@@ -37,19 +37,19 @@ |
||
| 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 | - 'move-existing-to', |
|
| 49 | - null, |
|
| 50 | - InputOption::VALUE_OPTIONAL, |
|
| 51 | - 'Move existing hooks to this directory' |
|
| 52 | - ); |
|
| 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 | + 'move-existing-to', |
|
| 49 | + null, |
|
| 50 | + InputOption::VALUE_OPTIONAL, |
|
| 51 | + 'Move existing hooks to this directory' |
|
| 52 | + ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::configure(); |
| 38 | 38 | $this->setName('config:disable') |
| 39 | - ->setAliases(['disable']) |
|
| 40 | - ->setDescription('Disable the handling for a hook in your configuration') |
|
| 41 | - ->setHelp('Disable the handling for a hook in your configuration') |
|
| 42 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to disable'); |
|
| 39 | + ->setAliases(['disable']) |
|
| 40 | + ->setDescription('Disable the handling for a hook in your configuration') |
|
| 41 | + ->setHelp('Disable the handling for a hook in your configuration') |
|
| 42 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to disable'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $editor = new Editor($io, $config); |
| 60 | 60 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 61 | - ->setChange('DisableHook') |
|
| 62 | - ->run(); |
|
| 61 | + ->setChange('DisableHook') |
|
| 62 | + ->run(); |
|
| 63 | 63 | |
| 64 | 64 | return 0; |
| 65 | 65 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::configure(); |
| 38 | 38 | $this->setName('config:add') |
| 39 | - ->setAliases(['add']) |
|
| 40 | - ->setDescription('Add an action to your hook configuration') |
|
| 41 | - ->setHelp('Add an action to your hook configuration') |
|
| 42 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to add the action to'); |
|
| 39 | + ->setAliases(['add']) |
|
| 40 | + ->setDescription('Add an action to your hook configuration') |
|
| 41 | + ->setHelp('Add an action to your hook configuration') |
|
| 42 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to add the action to'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $editor = new Editor($io, $config); |
| 60 | 60 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 61 | - ->setChange('AddAction') |
|
| 62 | - ->run(); |
|
| 61 | + ->setChange('AddAction') |
|
| 62 | + ->run(); |
|
| 63 | 63 | |
| 64 | 64 | return 0; |
| 65 | 65 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::configure(); |
| 38 | 38 | $this->setName('config:enable') |
| 39 | - ->setAliases(['enable']) |
|
| 40 | - ->setDescription('Enable the handling for a hook in your configuration') |
|
| 41 | - ->setHelp('Enable the handling for a hook in your configuration') |
|
| 42 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to enable'); |
|
| 39 | + ->setAliases(['enable']) |
|
| 40 | + ->setDescription('Enable the handling for a hook in your configuration') |
|
| 41 | + ->setHelp('Enable the handling for a hook in your configuration') |
|
| 42 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to enable'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $editor = new Editor($io, $config); |
| 60 | 60 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 61 | - ->setChange('EnableHook') |
|
| 62 | - ->run(); |
|
| 61 | + ->setChange('EnableHook') |
|
| 62 | + ->run(); |
|
| 63 | 63 | |
| 64 | 64 | return 0; |
| 65 | 65 | } |