-
Notifications
You must be signed in to change notification settings - Fork 2
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 #18 from ashur/release/0.7.0
release/0.7.0
- Loading branch information
Showing
4 changed files
with
78 additions
and
26 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
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,51 @@ | ||
<?php | ||
|
||
use Huxtable\CLI\Command; | ||
use Huxtable\Core\File; | ||
|
||
/** | ||
* @name install | ||
* @description Symlink 'pug' to a convenient path | ||
* @usage install <dir> | ||
*/ | ||
$command = new Command( 'install', 'Symlink \'pug\' to a convenient path', function( $dir ) | ||
{ | ||
$pathSource = dirname( dirname( __DIR__ ) ) . '/bin/pug'; | ||
|
||
try | ||
{ | ||
$destinationDirectory = new File\Directory( $dir ); | ||
|
||
if( !$destinationDirectory->exists() ) | ||
{ | ||
throw new \Exception( "Invalid location: '{$dir}' does not exist" ); | ||
} | ||
} | ||
catch( \Exception $e ) | ||
{ | ||
throw new Command\CommandInvokedException( $e->getMessage(), 1 ); | ||
} | ||
|
||
if( !$destinationDirectory->isWritable() ) | ||
{ | ||
throw new Command\CommandInvokedException( "Invalid location: You do not have permission to write to '{$destinationDirectory}'" ); | ||
} | ||
|
||
$target = $destinationDirectory->child( 'pug' ); | ||
$source = new File\File( $pathSource ); | ||
|
||
if( !$source->exists() ) | ||
{ | ||
throw new Command\CommandInvokedException( "Invalid source: '{$source}' not found", 1 ); | ||
} | ||
|
||
if( $target->exists() || is_link( $target->getPathname() ) ) | ||
{ | ||
throw new Command\CommandInvokedException( "Invalid target: '{$target}' already exists", 1 ); | ||
} | ||
|
||
symlink( $source, $target ); | ||
echo "Linked to '{$target}'" . PHP_EOL; | ||
}); | ||
|
||
return $command; |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
/* | ||
* Application version | ||
*/ | ||
'version' => '0.6.0', | ||
'version' => '0.7.0', | ||
|
||
/* | ||
* PHP minimum version | ||
|