Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
92b86ce
adding other facade ce aliases to functions
daison12006013 Feb 9, 2016
247c47c
removing flysystem client interface
daison12006013 Feb 9, 2016
6a377b6
adding option to always compile
daison12006013 Feb 9, 2016
9883ab6
updating to use debug instead of volt variable
daison12006013 Feb 9, 2016
65bed26
fixing if the debug is false or not for volt compileAlways
daison12006013 Feb 9, 2016
1e8b6a5
changing the operator to be OR
daison12006013 Feb 9, 2016
0427462
changing the flash bag function name
daison12006013 Feb 10, 2016
c56a3ef
adding strtotime() on volt adapter
daison12006013 Feb 11, 2016
f29ad75
Merge branch 'master' into dev
daison12006013 Feb 11, 2016
921dd69
adding the facade functions
daison12006013 Feb 12, 2016
429d233
adding ask(, ) and confirm() functions on slayer command; adding cons…
daison12006013 Feb 13, 2016
55bc636
Merge branch 'dev' of github.com:phalconslayer/framework into dev
daison12006013 Feb 13, 2016
16195d3
adding key on stack to be published
daison12006013 Feb 14, 2016
565a68a
including the tag name on every confirmation to be published
daison12006013 Feb 14, 2016
d9e076a
cleaning up providers
daison12006013 Feb 16, 2016
d01e526
moving phalcon application as service
daison12006013 Feb 16, 2016
03b98da
coding cleanup
daison12006013 Feb 16, 2016
2653e7c
adding an alias on console provider
daison12006013 Feb 16, 2016
a7a33fb
adding dispatcher function under the same facade key
daison12006013 Feb 17, 2016
6627f13
enhancing the helper's test case
daison12006013 Feb 17, 2016
ba44c92
adding configuration trait to override the config loader of phinx
daison12006013 Feb 18, 2016
4781c08
adding configuration trait to other phinx wrappers
daison12006013 Feb 18, 2016
a240cc8
normalizing the phinx configuration
daison12006013 Feb 18, 2016
81e2a58
moving and trimming the kernel class into a separated folder
daison12006013 Feb 23, 2016
b9bb9ca
updating the middleware logic and finished the TODO for options based
daison12006013 Feb 23, 2016
07abaee
moving the middleware and creating a wrapper class for phalcon reques…
daison12006013 Feb 23, 2016
bde4f68
updating the build
daison12006013 Feb 23, 2016
50ccb8b
moving the kernel to be on root not on src/ folder
daison12006013 Feb 23, 2016
4f9bbc5
fixing kernel composer psr-4
daison12006013 Feb 23, 2016
1f9078e
adding new service router annotations
daison12006013 Feb 24, 2016
e1a0e07
adding guzzlehttp/guzzle under the RESTful class; Request class wrapp…
daison12006013 Feb 24, 2016
c19a436
fixing full url as it does not providing slash on the end of the base…
daison12006013 Feb 24, 2016
650cb1f
adding exception() to handle exception object
daison12006013 Feb 24, 2016
f391d9f
adding env and timeout option on base command
daison12006013 Feb 25, 2016
b84e1e8
adding protected props to disable/enable the env and timeout
daison12006013 Feb 25, 2016
458bbc9
fixing the error calling the protected props
daison12006013 Feb 25, 2016
8f72037
handling env and timeout; adding env command class
daison12006013 Feb 26, 2016
ee2ee4a
comments and loop on define function
daison12006013 Feb 27, 2016
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
13 changes: 8 additions & 5 deletions build/clarity.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
git subsplit init git@github.com:phalconslayer/framework.git
git subsplit publish --heads="master dev" src/Clarity/Lang:git@github.com:ps-clarity/lang.git
git subsplit publish --heads="master dev" src/Clarity/Mail:git@github.com:ps-clarity/mail.git
git subsplit publish --heads="master dev" src/Clarity/Console:git@github.com:ps-clarity/console.git
git subsplit publish --heads="master dev" src/Clarity:git@github.com:ps-clarity/kernel.git
git subsplit publish --heads="master dev" src/Clarity/View:git@github.com:ps-clarity/view.git
git subsplit publish --heads="master dev" src/Clarity/Support:git@github.com:ps-clarity/support.git
git subsplit publish --heads="master dev" src/Clarity/Contracts:git@github.com:ps-clarity/contracts.git
git subsplit publish --heads="master dev" src/Clarity/Exceptions:git@github.com:ps-clarity/exceptions.git
#git subsplit publish --heads="master dev" src/Clarity/Facades:git@github.com:ps-clarity/facades.git
#git subsplit publish --heads="master dev" src/Clarity/Kernel:git@github.com:ps-clarity/kernel.git
git subsplit publish --heads="master dev" src/Clarity/Lang:git@github.com:ps-clarity/lang.git
git subsplit publish --heads="master dev" src/Clarity/Mail:git@github.com:ps-clarity/mail.git
#git subsplit publish --heads="master dev" src/Clarity/Providers:git@github.com:ps-clarity/providers.git
git subsplit publish --heads="master dev" src/Clarity/Support:git@github.com:ps-clarity/support.git
git subsplit publish --heads="master dev" src/Clarity/View:git@github.com:ps-clarity/view.git

rm -rf .subsplit/
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"classpreloader/classpreloader": "^2.0",
"classpreloader/console": "^1.0",
"fzaninotto/faker": "~1.4",
"guzzlehttp/guzzle": "6.1.*",
"illuminate/support": "5.2.*",
"illuminate/view": "5.2.*",
"paragonie/random_compat": "1.1.*",
Expand Down
5 changes: 3 additions & 2 deletions src/Clarity/Console/DB/SeedFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ class SeedFactory extends SlayerCommand

public function slash()
{
$factory = new Factory($this);
$files = folder_files(config()->path->database . 'factories');

$factory = new Factory;

if ( !empty($files) ) {

foreach ( $files as $file ) {
Expand All @@ -27,5 +26,7 @@ public function slash()
$this->info('Done.' . "\n");
}
}

return $this;
}
}
21 changes: 21 additions & 0 deletions src/Clarity/Console/Server/EnvCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace Clarity\Console\Server;

use Clarity\Console\CLI;
use Clarity\Console\SlayerCommand;

class EnvCommand extends SlayerCommand
{
protected $name = 'env';
protected $description = 'Get current environment';

public function slash()
{
$timeout = $this->getInput()->getOption('timeout');

$this->info(
"\n".'Your current environment ['.config()->environment.']'."\n"
// .' | Timeout: '.$timeout
);
}
}
117 changes: 113 additions & 4 deletions src/Clarity/Console/SlayerCommand.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<?php
namespace Clarity\Console;

use Phalcon\Config;
use Clarity\Services\ServiceMagicMethods;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Exception\InvalidOptionException;

abstract class SlayerCommand extends Command
{
use ServiceMagicMethods;

protected $input;
protected $output;
protected $environment_option = true;
protected $timeout_option = true;

abstract public function slash();

Expand All @@ -22,17 +28,68 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->input = $input;
$this->output = $output;

$this->loadEnv();

$this->loadTimeout();

$this->slash();
}

protected function loadEnv()
{
$env = $this->getInput()->getOption('env');

config()->merge(new Config(['environment' => $env]));

$folder = '';

if ( $env !== 'production') {
$folder = $env;
}

$folder_path = url_trimmer(config()->path->config.'/'.$folder);

if ( file_exists($folder_path) === false ) {
throw new InvalidOptionException("Environment [$env] not found.");
}

config()->merge(
new Config(
iterate_require(folder_files($folder_path))
)
);

return $this;
}

protected function loadTimeout()
{
$timeout = $this->getInput()->getOption('timeout');

if ( $timeout !== 30 ) {
set_time_limit($timeout);
}

return $this;
}

protected function getInput()
{
return $this->input;
}

protected function getOutput()
{
return $this->output;
}

protected function configure()
{
$this
->setName($this->name)
->setDescription($this->description);


if ( count($this->arguments()) ) {
if ( !empty($this->arguments()) ) {

foreach ( $this->arguments() as $arg ) {

Expand All @@ -45,9 +102,30 @@ protected function configure()
}
}

if ( count($this->options()) ) {
if ( $this->environment_option ) {
$this->addOption(
'env',
'e',
InputOption::VALUE_OPTIONAL,
'The environment to be used',
'production'
);
}

if ( $this->timeout_option ) {
$this->addOption(
'timeout',
't',
InputOption::VALUE_OPTIONAL,
'Set timeout to bypass default execution time',
30
);
}


foreach ($this->options() as $opt) {
if ( !empty($this->options()) ) {

foreach ( $this->options() as $opt ) {

$this->addOption(
isset($opt[0]) ? $opt[0] : null,
Expand Down Expand Up @@ -91,6 +169,37 @@ public function error($string)
$this->output->writeln("<error>$string</error>");
}

public function exception($e)
{
$message = sprintf(
'%s: %s (uncaught exception) at %s line %s',
get_class($e),
$e->getMessage(),
$e->getFile(),
$e->getLine()
);

$this->error("\n".$message."\n");
}

public function ask($message, $default)
{
$helper = $this->getHelper('question');

$question = new Question($message, $default);

return $helper->ask($this->input, $this->output, $question);
}

public function confirm($message)
{
$helper = $this->getHelper('question');

$question = new ConfirmationQuestion($message, false);

return $helper->ask($this->input, $this->output, $question);
}

public function callDumpAutoload()
{
CLI::bash([
Expand Down
26 changes: 20 additions & 6 deletions src/Clarity/Console/Vendor/PublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,46 @@

class PublishCommand extends SlayerCommand
{
protected $name = 'vendor:publish';

protected $name = 'vendor:publish';
protected $description = 'Publish a vendor package';

public function slash()
{
$tag_name = $this->input->getOption('tag');
$alias = $this->input->getArgument('alias');
$tag = $this->input->getOption('tag');

foreach (config()->app->services as $service) {

$obj = new $service;
if ($alias != $obj->getAlias()) {

if ( $alias != $obj->getAlias() ) {
continue;
}

$obj->boot();

try {
$tags = $obj->getToBePublished($tag);
$tags = $obj->getToBePublished($tag_name);

foreach ($tags as $tag_name => $tag) {

foreach ($tags as $tag) {
foreach ($tag as $source => $dest) {

$are_you_sure = 'Are you sure you want to '.
'publish "'.$tag_name.'"? [y/n]: ';

if ( ! $this->confirm($are_you_sure) ) {
continue;
}

cp($source, $dest);

$this->info("Publishing tag \"$tag_name\" from [$source] to [$dest]");
}
}

} catch (Exception $e) {

$this->error($e->getMessage());
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/Clarity/Contracts/Flysystem/ClientInterface.php

This file was deleted.

31 changes: 22 additions & 9 deletions src/Clarity/Kernel.php → src/Clarity/Kernel/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Clarity;
namespace Clarity\Kernel;

use Clarity\Providers\Log;
use Clarity\Services\Service\ServiceContainer;
Expand All @@ -9,7 +9,7 @@ class Kernel
use KernelTrait;

private $di;
private $app;
private $env;
private $path;
private $modules;

Expand All @@ -22,10 +22,6 @@ public function initialize()
$this->loadTimeZone();

$this->loadServices();

$this->di->set('app', function() {
return $this->app;
});
}

/**
Expand All @@ -52,14 +48,31 @@ public function setModules($modules)
return $this;
}

/**
* Set the environment
*
* @param string $env
*/
public function setEnvironment($env)
{
$this->env = $env;

return $this;
}

public function getEnvironment()
{
return $this->env;
}

/**
* Register modules
*
* @return mixed
*/
public function modules()
{
$this->app->registerModules($this->modules);
di()->get('application')->registerModules($this->modules);

return $this;
}
Expand All @@ -69,7 +82,7 @@ public function modules()
*/
public function render()
{
echo $this->app->handle()->getContent();
echo di()->get('application')->handle()->getContent();
}

/**
Expand All @@ -80,7 +93,7 @@ public function render()
*/
public function run($module_name)
{
$this->app->setDefaultModule($module_name);
di()->get('application')->setDefaultModule($module_name);

$path = url_trimmer(config()->path->app.'/'.$module_name.'/routes.php');

Expand Down
Loading