Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
niksamokhvalov committed Feb 20, 2016
1 parent e788274 commit 5c3d406
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
23 changes: 18 additions & 5 deletions src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace Notamedia\ConsoleJedi\Console;

use Bitrix\Main\DB\ConnectionException;
use Bitrix\Main\IO\File;
use Bitrix\Main\Loader;
use Bitrix\Main\ModuleManager;
use Notamedia\ConsoleJedi\Console\Command\Agents;
Expand Down Expand Up @@ -106,7 +105,16 @@ protected function getDefaultCommands()

return $commands;
}


/**
* Loading application configuration.
*
* @param string $path Path to configuration file.
*
* @return bool
*
* @throws \Exception
*/
public function loadConfiguration($path = self::CONFIG_DEFAULT_FILE)
{
if (!is_file($path))
Expand All @@ -130,7 +138,12 @@ public function loadConfiguration($path = self::CONFIG_DEFAULT_FILE)

return true;
}


/**
* Gets application configuration.
*
* @return null|array
*/
public function getConfiguration()
{
return $this->configuration;
Expand All @@ -153,11 +166,11 @@ protected function getModulesCommands()
$moduleLocalDir = $_SERVER['DOCUMENT_ROOT'] . '/local/modules/' . $module['ID'];
$cliFile = '/cli.php';

if (File::isFileExists($moduleBitrixDir . $cliFile))
if (is_file($moduleBitrixDir . $cliFile))
{
$cliFile = $moduleBitrixDir . $cliFile;
}
elseif (File::isFileExists($moduleLocalDir . $cliFile))
elseif (is_file($moduleLocalDir . $cliFile))
{
$cliFile = $moduleLocalDir . $cliFile;
}
Expand Down
6 changes: 6 additions & 0 deletions src/Console/Command/BitrixCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@

namespace Notamedia\ConsoleJedi\Console\Command;

/**
* Base class for Bitrix console command.
*/
class BitrixCommand extends Command
{
/**
* {@inheritdoc}
*/
public function isEnabled()
{
if ($this->getApplication()->getBitrixStatus())
Expand Down
5 changes: 3 additions & 2 deletions src/Console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

namespace Notamedia\ConsoleJedi\Console\Command;

use Notamedia\ConsoleJedi\Console\Application;

/**
* Base class for console command.
*/
class Command extends \Symfony\Component\Console\Command\Command
{
/**
Expand Down
9 changes: 6 additions & 3 deletions src/Console/Command/Environment/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Filesystem\Filesystem;

/**
* Installation environment settings.
*/
class InitCommand extends Command
{
/**
Expand All @@ -31,11 +34,11 @@ class InitCommand extends Command
*/
protected $config = [];
/**
* @var array
* @var array Methods which be running in the first place.
*/
protected $bootstrap = ['copyFiles'];
/**
* @var array
* @var array Files that do not need to copy to the application when initializing the environment settings.
*/
protected $excludedFiles = ['config.php'];

Expand All @@ -47,7 +50,7 @@ protected function configure()
parent::configure();

$this->setName('env:init')
->setDescription('Init environment settings')
->setDescription('Installation environment settings')
->setHelp('Run command and select environment from the list')
->addArgument('type', InputArgument::OPTIONAL, 'Type of the environments')
->addOption('memcache-cold-start', null, null, 'All memcache servers adds with status "ready"');
Expand Down

0 comments on commit 5c3d406

Please sign in to comment.