Skip to content

Commit

Permalink
Исправления для v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
iiifx committed Jul 25, 2017
1 parent 96d36a4 commit e5ab0ec
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 63 deletions.
22 changes: 0 additions & 22 deletions .scrutinizer.yml

This file was deleted.

20 changes: 7 additions & 13 deletions README.RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/38baa1e0-54e8-4cf8-bd30-3c76e8a44d9b/big.png)](https://insight.sensiolabs.com/projects/38baa1e0-54e8-4cf8-bd30-3c76e8a44d9b)

[![Latest Version on Packagist][ico-version]][link-packagist] [![Build Status][ico-travis]][link-travis]
[![Total Downloads][ico-downloads]][link-downloads]
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Software License][ico-license]](LICENSE.md)

[[English documentation](README.md)] [Документация на русском]

Expand All @@ -18,7 +19,7 @@
Используя Composer:

```bash
composer require "iiifx-production/yii2-autocomplete-helper:^1.2"
composer require "iiifx-production/yii2-autocomplete-helper:^1.3"
```

## Настройка
Expand Down Expand Up @@ -56,10 +57,10 @@ php yii ide-components

Детектор генератора автоматически распознает тип приложения, прочитает все конфигурационные файлы и сгенерирует для них файл автодополнения, который будет сохранен в корне приложения.
```bash
Yii2 IDE Autocomplete Helper
Vitaliy IIIFX Khomenko (c) 2016
Yii2 IDE auto-completion helper
Vitaliy IIIFX Khomenko, 2017

Success: /domains/project.local/_ide_components.php
Success: /home/iiifx/Projects/myProject/_ide_components.php
```

**Важно:** Чтобы IDE не ругался на два экземпляра класса Yii необходимо файл основного класса Yii пометить как текстовый документ - [пример](images/mark-as-plain-text.png).
Expand Down Expand Up @@ -231,13 +232,6 @@ php yii my-custom-generator
php yii ide-components --config=api
```

## Тесты

[![Build Status][ico-travis]][link-travis] [![Code Coverage][ico-codecoverage]][link-scrutinizer]

## Лицензия

[![Software License][ico-license]](LICENSE.md)


[ico-version]: https://img.shields.io/packagist/v/iiifx-production/yii2-autocomplete-helper.svg
Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Autocompletion generator for custom components in Yii2.

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/38baa1e0-54e8-4cf8-bd30-3c76e8a44d9b/big.png)](https://insight.sensiolabs.com/projects/38baa1e0-54e8-4cf8-bd30-3c76e8a44d9b)

[![Latest Version on Packagist][ico-version]][link-packagist] [![Build Status][ico-travis]][link-travis]
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Software License][ico-license]](LICENSE.md)

[English documentation] [[Документация на русском](README.RU.md)]

Expand All @@ -18,7 +19,7 @@ This extension allows you to automatically generate a file with the autocomplete
Using Composer:

```bash
composer require "iiifx-production/yii2-autocomplete-helper:^1.2"
composer require "iiifx-production/yii2-autocomplete-helper:^1.3"
```

## Configuration
Expand Down Expand Up @@ -56,10 +57,10 @@ php yii ide-components

Generator automatically detects the type of application, read all configuration files and generate the autocomplete file to the application root.
```bash
Yii2 IDE Autocomplete Helper
Vitaliy IIIFX Khomenko (c) 2016
Yii2 IDE auto-completion helper
Vitaliy IIIFX Khomenko, 2017

Success: /domains/project.local/_ide_components.php
Success: /home/iiifx/Projects/myProject/_ide_components.php
```
**Important:** For IDE did not swear on the two copies of the Yii class must be main Yii class file marked as a text document - [example](images/mark-as-plain-text.png).
The main class is located on the way: **@vendor/yiisoft/yii2/Yii.php**
Expand Down Expand Up @@ -230,14 +231,6 @@ Now you can generate autocompletion for the desired group:
php yii ide-components --config=api
```

## Tests

[![Build Status][ico-travis]][link-travis] [![Code Coverage][ico-codecoverage]][link-scrutinizer]

## License

[![Software License][ico-license]](LICENSE.md)


[ico-version]: https://img.shields.io/packagist/v/iiifx-production/yii2-autocomplete-helper.svg
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"framework",
"ide",
"autocomplete",
"auto-completion",
"helper"
],
"homepage": "https://github.com/iiifx-production/yii2-autocomplete-helper",
Expand All @@ -19,7 +20,7 @@
}
],
"require": {
"php": ">=5.5",
"php": "^5.5|^7",
"yiisoft/yii2": "~2.0.8"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions source/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function readConfig ()
/** @noinspection PhpIncludeInspection */
$this->_config[ $file ] = require $path;
} catch ( Exception $exception ) {
# Игнорируем
# Ignore
}
}
}
Expand Down Expand Up @@ -105,7 +105,7 @@ protected function findClass ( $section )
return $section[ 'class' ];
}
} catch ( Exception $exception ) {
# Игнорируем
# Ignore
}
return false;
}
Expand Down
29 changes: 17 additions & 12 deletions source/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
use Yii;
use yii\base\InvalidCallException;
use yii\base\InvalidConfigException;
use yii\helpers\Console;
use yii\helpers\FileHelper;

/**
* Class Controller
* Automatically generate IDE auto-completion file
*
* @package iiifx\Yii2\Autocomplete
*/
Expand Down Expand Up @@ -55,17 +56,21 @@ public function optionAliases ()
return [];
}

public function echoInfo ()
/**
* Shows description
*/
public function showDescription ()
{
echo 'Yii2 IDE Autocomplete Helper' . PHP_EOL . 'Vitaliy IIIFX Khomenko, 2017' . PHP_EOL;
$this->stdout( "Yii2 IDE auto-completion helper\n" );
$this->stdout( "Vitaliy IIIFX Khomenko, 2017\n\n" );
}

/**
* Точка входа
* Generate IDE auto-completion file
*/
public function actionIndex ()
{
$this->echoInfo();
$this->showDescription();
try {
$component = $this->getComponent();
$configList = $this->getConfig( $component );
Expand All @@ -84,14 +89,14 @@ public function actionIndex ()
$result = Yii::getAlias( $component->result );
$result = FileHelper::normalizePath( $result );
if ( $builder->build( $result ) ) {
echo PHP_EOL . 'Success: ' . $result;
$this->stdout( "Success: {$result}\n", Console::FG_GREEN );
} else {
echo PHP_EOL . 'Fail!';
$this->stdout( "Fail!\n", Console::FG_RED );
}
} catch ( Exception $exception ) {
echo PHP_EOL . $exception->getMessage() .
PHP_EOL . 'Please read the package documentation: https://github.com/iiifx-production/yii2-autocomplete-helper' .
PHP_EOL;
$this->stdout( $exception->getMessage() . "\n\n", Console::FG_RED );
$this->stdout( "Please read the package documentation: https://github.com/iiifx-production/yii2-autocomplete-helper\n" );
$this->stdout( "or create new issue: https://github.com/iiifx-production/yii2-autocomplete-helper/issues/new\n" );
}
}

Expand All @@ -105,7 +110,7 @@ protected function getComponent ()
if ( isset( Yii::$app->{$this->component} ) && Yii::$app->{$this->component} instanceof Component ) {
return Yii::$app->{$this->component};
}
throw new InvalidConfigException( "Component '{$this->component}' not found in Yii::\$app" );
throw new InvalidConfigException( sprintf( 'Component "%s" not found in Yii::$app', $this->component ) );
}

/**
Expand Down Expand Up @@ -146,7 +151,7 @@ protected function getConfig ( Component $component )
if ( isset( $component->config[ $this->config ] ) ) {
$configList = $component->config[ $this->config ];
} else {
throw new InvalidCallException( "Scope '{$this->config}' not found in component config data" );
throw new InvalidCallException( sprintf( 'Scope "%s" not found in component config data', $this->config ) );
}
}
}
Expand Down

0 comments on commit e5ab0ec

Please sign in to comment.