-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from ByteInternet/cleanup_by_labels
- Loading branch information
Showing
9 changed files
with
220 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hypernode\Deploy; | ||
|
||
use Deployer\Deployer; | ||
use Deployer\Exception\Exception; | ||
use Deployer\Exception\GracefulShutdownException; | ||
use Hypernode\DeployConfiguration\Configuration; | ||
use Throwable; | ||
|
||
class ConfigurationLoader | ||
{ | ||
/** | ||
* @throws Exception | ||
* @throws GracefulShutdownException | ||
* @throws Throwable | ||
*/ | ||
public function load(string $file): Configuration | ||
{ | ||
if (!is_readable($file)) { | ||
throw new \RuntimeException(sprintf('No %s file found in project root %s', $file, getcwd())); | ||
} | ||
|
||
$configuration = \call_user_func(function () use ($file) { | ||
return require $file; | ||
}); | ||
|
||
if (!$configuration instanceof Configuration) { | ||
throw new \RuntimeException( | ||
sprintf('%s/deploy.php did not return object of type %s', getcwd(), Configuration::class) | ||
); | ||
} | ||
|
||
return $configuration; | ||
} | ||
} |
Oops, something went wrong.