Skip to content

Commit

Permalink
Merge pull request #115 from sebastienheyd/symlink
Browse files Browse the repository at this point in the history
Use of symlink with existing packages
  • Loading branch information
Jeroen-G authored Sep 2, 2020
2 parents 1fd2d4b + 56a9165 commit 2548282
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All Notable changes to Packager will be documented in this file.
### Updated
- Support for Laravel 7 and PHPUnit 9.
- `packager:new` now also supports separating vendor and name with a forward slash.
- `symlink` option is set to true as default for repositories in `composer.json`

## Version 2.4

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/GitPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function handle()

// Clone the repository
$this->info('Cloning repository...');
exec("git clone $source ".$this->conveyor->packagePath(), $output, $exit_code);
exec("git clone -q $source ".$this->conveyor->packagePath(), $output, $exit_code);

if ($exit_code != 0) {
$this->error('Unable to clone repository');
Expand Down
5 changes: 4 additions & 1 deletion src/Conveyor.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ public function addPathRepository()
$params = json_encode([
'type' => 'path',
'url' => $this->packagePath(),
'options' => [
'symlink' => true,
],
]);
$command = [
'composer',
Expand Down Expand Up @@ -150,7 +153,7 @@ public function requirePackage()
return $this->runProcess([
'composer',
'require',
$this->vendor.'/'.$this->package,
$this->vendor.'/'.$this->package.':@dev',
]);
}

Expand Down
21 changes: 20 additions & 1 deletion tests/IntegratedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public function test_new_package_is_created()
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);

$this->seeInConsoleOutput('Package created successfully!');
$this->assertTrue(is_link(base_path('vendor/myvendor/mypackage')));
}

public function test_new_package_is_installed()
Expand All @@ -35,14 +36,32 @@ public function test_new_package_is_installed_from_custom_skeleton()
$this->assertStringContainsString('AnotherVendor/AnotherPackage', $composer);
}

public function test_get_existing_package()
public function test_get_package()
{
Artisan::call('packager:get',
['url' => 'https://github.com/Jeroen-G/packager-skeleton', 'vendor' => 'MyVendor', 'name' => 'MyPackage']);

$this->seeInConsoleOutput('Package downloaded successfully!');
}

public function test_get_existing_package_with_git()
{
Artisan::call('packager:git',
['url' => 'https://github.com/Seldaek/monolog', 'vendor' => 'monolog', 'name' => 'monolog']);

$this->seeInConsoleOutput('Package cloned successfully!');
$this->assertTrue(is_link(base_path('vendor/monolog/monolog')));
}

public function test_get_existing_package_with_get()
{
Artisan::call('packager:get',
['url' => 'https://github.com/Seldaek/monolog', 'vendor' => 'monolog', 'name' => 'monolog']);

$this->seeInConsoleOutput('Package downloaded successfully!');
$this->assertTrue(is_link(base_path('vendor/monolog/monolog')));
}

public function test_list_packages()
{
Artisan::call('packager:new', ['vendor' => 'MyVendor', 'name' => 'MyPackage']);
Expand Down

0 comments on commit 2548282

Please sign in to comment.