-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8b054c3
Showing
10 changed files
with
282 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.DS_Store |
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,11 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
|
||
before_script: | ||
- curl -s http://getcomposer.org/installer | php | ||
- php composer.phar install --dev | ||
|
||
script: phpunit |
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,27 @@ | ||
{ | ||
"name": "joecwallace/artisan", | ||
"description": "A web interface for the Laravel Artisan CLI", | ||
"keywords": [ "laravel", "artisan" ], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Joe Wallace", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3.0", | ||
"illuminate/support": "4.0.x" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Joecwallace\\Artisan": "src/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.0.x-dev" | ||
} | ||
} | ||
} |
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,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
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,28 @@ | ||
<?php namespace Joecwallace\Artisan; | ||
|
||
use Illuminate\Console\Application; | ||
use Illuminate\Support\Facades\Config; | ||
|
||
class ArtisanRunner | ||
{ | ||
public static function run(array $args = array()) | ||
{ | ||
array_unshift($args, 'artisan'); | ||
|
||
$app = app(); | ||
$providers = $app->getLoadedProviders(); | ||
|
||
foreach (Config::get('app.providers') as $provider) | ||
{ | ||
if ( ! isset($providers[$provider])) | ||
{ | ||
$app->register(new $provider($app)); | ||
} | ||
} | ||
|
||
$_SERVER['argv'] = $args; | ||
$output = new HtmlOutput; | ||
|
||
Application::start($app)->run(null, $output); | ||
} | ||
} |
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,46 @@ | ||
<?php namespace Joecwallace\Artisan; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class ArtisanWebServiceProvider extends ServiceProvider { | ||
|
||
/** | ||
* Indicates if loading of the provider is deferred. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = false; | ||
|
||
/** | ||
* Bootstrap the application events. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
$this->package('joecwallace/artisan'); | ||
|
||
include __DIR__.'/routes.php'; | ||
} | ||
|
||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array | ||
*/ | ||
public function provides() | ||
{ | ||
return array(); | ||
} | ||
|
||
} |
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,126 @@ | ||
<?php namespace Joecwallace\Artisan; | ||
|
||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Formatter\OutputFormatterInterface; | ||
|
||
class HtmlOutput implements OutputInterface | ||
{ | ||
|
||
protected $verbosity = OutputInterface::VERBOSITY_VERBOSE; | ||
protected $decorated = true; | ||
protected $formatter = null; | ||
|
||
protected function formatOutput($message) | ||
{ | ||
return str_replace(PHP_EOL, '<br>', $message); | ||
} | ||
|
||
/** | ||
* Writes a message to the output. | ||
* | ||
* @param string|array $messages The message as an array of lines of a single string | ||
* @param Boolean $newline Whether to add a newline or not | ||
* @param integer $type The type of output (0: normal, 1: raw, 2: plain) | ||
* | ||
* @throws \InvalidArgumentException When unknown output type is given | ||
* | ||
* @api | ||
*/ | ||
public function write($messages, $newline = false, $type = 0) | ||
{ | ||
$messages = (array)$messages; | ||
|
||
foreach ($messages as $message) | ||
{ | ||
echo $this->formatOutput($message); | ||
} | ||
|
||
if ($newline) echo '<br>'; | ||
} | ||
|
||
/** | ||
* Writes a message to the output and adds a newline at the end. | ||
* | ||
* @param string|array $messages The message as an array of lines of a single string | ||
* @param integer $type The type of output (0: normal, 1: raw, 2: plain) | ||
* | ||
* @api | ||
*/ | ||
public function writeln($messages, $type = 0) | ||
{ | ||
$this->write($messages, true, $type); | ||
} | ||
|
||
/** | ||
* Sets the verbosity of the output. | ||
* | ||
* @param integer $level The level of verbosity | ||
* | ||
* @api | ||
*/ | ||
public function setVerbosity($level) | ||
{ | ||
$this->verbosity = $level; | ||
} | ||
|
||
/** | ||
* Gets the current verbosity of the output. | ||
* | ||
* @return integer The current level of verbosity | ||
* | ||
* @api | ||
*/ | ||
public function getVerbosity() | ||
{ | ||
return $this->verbosity; | ||
} | ||
|
||
/** | ||
* Sets the decorated flag. | ||
* | ||
* @param Boolean $decorated Whether to decorate the messages or not | ||
* | ||
* @api | ||
*/ | ||
public function setDecorated($decorated) | ||
{ | ||
$this->decorated = $decorated; | ||
} | ||
|
||
/** | ||
* Gets the decorated flag. | ||
* | ||
* @return Boolean true if the output will decorate messages, false otherwise | ||
* | ||
* @api | ||
*/ | ||
public function isDecorated() | ||
{ | ||
return $this->decorated; | ||
} | ||
|
||
/** | ||
* Sets output formatter. | ||
* | ||
* @param OutputFormatterInterface $formatter | ||
* | ||
* @api | ||
*/ | ||
public function setFormatter(OutputFormatterInterface $formatter) | ||
{ | ||
$this->formatter = $formatter; | ||
} | ||
|
||
/** | ||
* Returns current output formatter instance. | ||
* | ||
* @return OutputFormatterInterface | ||
* | ||
* @api | ||
*/ | ||
public function getFormatter() | ||
{ | ||
return $this->formatter; | ||
} | ||
|
||
} |
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,15 @@ | ||
<?php | ||
|
||
use Joecwallace\Artisan\ArtisanRunner as Runner; | ||
use Joecwallace\Artisan\HtmlOutput; | ||
|
||
Route::get(Config::get('artisan::handles').'{uri}', function($uri = '') | ||
{ | ||
$args = array(); | ||
|
||
if ( ! empty($uri)) { | ||
$args = explode('+', trim($uri, '/')); | ||
} | ||
|
||
Runner::run($args); | ||
})->where('uri', '^($|\/.*)'); |
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,7 @@ | ||
<?php | ||
|
||
return array( | ||
|
||
'handles' => 'artisan', | ||
|
||
); |
Empty file.