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

OPENEUROPA-616: Add --tag option to release:create-archive command #72

Merged
merged 1 commit into from
Aug 28, 2018
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
11 changes: 9 additions & 2 deletions src/Commands/ReleaseCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use OpenEuropa\TaskRunner\Traits\RepositoryAwareTrait;
use OpenEuropa\TaskRunner\Traits\TimeAwareTrait;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Input\InputOption;

/**
* Project release commands.
Expand Down Expand Up @@ -60,6 +61,8 @@ public function setRuntimeConfig(ConsoleCommandEvent $event)
*
* If you wish to keep the directory use the "--keep" option.
*
* If you wish to override the current tag use the "--tag" option.
*
* Before the release directory is archived you can run a list of packaging
* commands in your runner.yml.dist, as shown below:
*
Expand All @@ -77,14 +80,18 @@ public function setRuntimeConfig(ConsoleCommandEvent $event)
*
* @command release:create-archive
*
* @option tag Release tag, will override current repository tag.
* @option keep Whereas to keep the temporary release directory or not.
*
* @aliases release:ca,rca
*/
public function createRelease(array $options = ['keep' => false])
public function createRelease(array $options = [
'tag' => InputOption::VALUE_OPTIONAL,
'keep' => false,
])
{
$name = $this->composer->getProject();
$version = $this->getVersionString();
$version = $options['tag'] !== null ? $options['tag'] : $this->getVersionString();
$archive = "$name-$version.tar.gz";

$tasks = [
Expand Down
4 changes: 2 additions & 2 deletions tests/Tasks/ProcessConfigFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProcessConfigFileTest extends AbstractTaskTest
* @param array $data
* @param array $expected
*
* @dataProvider testTaskDataProvider
* @dataProvider taskDataProvider
*/
public function testTask(array $data, array $expected)
{
Expand Down Expand Up @@ -58,7 +58,7 @@ public function extractTokensDataProvider()
/**
* @return array
*/
public function testTaskDataProvider()
public function taskDataProvider()
{
return $this->getFixtureContent('tasks/process-config-file/task.yml');
}
Expand Down
36 changes: 36 additions & 0 deletions tests/fixtures/commands/release-create-archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,42 @@
->remove('test_project')
not_contains: []

- configuration:
release:
tasks: []
options: "--tag=1.2.0"
repository:
hash: "19di3458"
revision: "refs/heads/master"
tag: "1.0.0"
branches:
- { name: "develop", local: false, revision: "refs/heads/develop" }
- { name: "master", local: true, revision: "refs/heads/master" }
contains:
- |
[Simulator] Simulating Filesystem\FilesystemStack()
->remove(array (
0 => 'test_project-1.2.0.tar.gz',
1 => 'test_project',
))
[Simulator] Simulating Vcs\GitStack('git')
->exec(array (
0 => 'archive',
1 => 'HEAD',
2 => '-o test_project.zip',
))
[Simulator] Simulating Archive\Extract('test_project.zip')
->to('test_project')
[Simulator] Simulating Filesystem\FilesystemStack()
->remove('test_project.zip')
[Simulator] Simulating OpenEuropa\TaskRunner\Tasks\CollectionFactory\CollectionFactory(array (
))
[Simulator] Simulating ExecStack()
->exec('tar -czf test_project-1.2.0.tar.gz test_project')
[Simulator] Simulating Filesystem\FilesystemStack()
->remove('test_project')
not_contains: []

- configuration:
release:
tasks: []
Expand Down