Skip to content

Commit

Permalink
- Passing arguments to Gitify build now restricts building to those…
Browse files Browse the repository at this point in the history
… specific data partition/folder
  • Loading branch information
Mark-H committed Apr 5, 2015
1 parent 7d42e2d commit e7b0f4e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Changes that may have an impact on backwards compatibility (i.e. they may break existing workflows) are marked with `[BC]`.

## Current development (master)
- Escape password in backup/restore commands so they work with special characters
- Passing arguments to `Gitify build` now restricts building to those specific data partition/folder
- Escape password in backup/restore commands so they work with special characters in the password

## 0.7.0 - 2015-03-31
- Add new `Gitify backup` and `Gitify restore` commands (#39)
Expand Down
19 changes: 19 additions & 0 deletions src/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use modmore\Gitify\BaseCommand;
use modmore\Gitify\Gitify;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -47,6 +48,12 @@ protected function configure()
InputOption::VALUE_NONE,
'When using the --force attribute, Gitify will automatically create a full database backup first. Specify --no-backup to skip creating the backup, at your own risk.'
)

->addArgument(
'partitions',
InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
'Specify the data partition key (folder name), or keys separated by a space, that you want to build. '
)
;
}

Expand All @@ -71,7 +78,19 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
}

$partitions = $input->getArgument('partitions');
if (!$partitions || empty($partitions)) {
$partitions = array_keys($this->config['data']);
}
foreach ($this->config['data'] as $folder => $type) {
if (!in_array($folder, $partitions, true)) {
if ($output->isVerbose()) {
$output->writeln('Skipping ' . $folder);
}
continue;
}

switch (true) {
case (!empty($type['type']) && $type['type'] == 'content'):
// "content" is a shorthand for contexts + resources
Expand Down

0 comments on commit e7b0f4e

Please sign in to comment.