Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangut committed Sep 13, 2016
1 parent fa16e1f commit fbbe9e6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 72 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ Let Yeoman do the heavy lifting and get your projects scaffold and ready to star
* QA utilities configured and integrated into Gulp and Grunt
* [PHPUnit](http://phpunit.de/) testing environment already set up and integrated into Gulp and Grunt
* PHP syntax linting
* [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) for coding style checking
* [PHPMD](https://phpmd.org/) for code mess detection
* [PHPCPD](https://github.com/sebastianbergmann/phpcpd)
* Composer [outdated](https://getcomposer.org/doc/03-cli.md#outdated) for packages updates available
* [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) for PSR2 coding standard checking
* [PHPMD](https://phpmd.org/) for code mess detection (optional customizable rule set)
* [PHPCPD](https://github.com/sebastianbergmann/phpcpd) for copy/paste detection
* Composer [outdated](https://getcomposer.org/doc/03-cli.md#outdated) for packages updates availability check
* Initial documentation structure in Markdown
* Basic annotated kickoff code (with tests and coverage report!)
* "Free Software" and "Open Source" License selection
* [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html)
* [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html)
* [BSD-2-Clause](https://spdx.org/licenses/BSD-2-Clause.html)
* [BSD-4-Clause](https://spdx.org/licenses/BSD-4-Clause.html)
* [MIT](https://spdx.org/licenses/MIT.html)
* [GPL-3.0](https://spdx.org/licenses/GPL-3.0.html)
* [LGPL-3.0](https://spdx.org/licenses/LGPL-3.0.html)
* [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html)
* [MIT](https://spdx.org/licenses/MIT.html)

> And many, many more to come. Would like to see a tool, library, configuration, ... added to the generator? file an issue with your feature request
> Would you like to see a tool, library, configuration, ... added to the generator? file an issue with your feature request
#### Quick assistant / fast mode

As the options and tools configured is getting quite long a quick/fast mode has been introduced. In fast mode only the basics questions will be asked and then the generator will do its best guessing the rest for you to get the environment ready faster.
As the list options and tools configured is getting quite long a quick/fast mode has been introduced. In fast mode only the basics questions will be asked and then the generator will do its best guessing the rest for you to get the environment ready faster.

## Getting Started

Expand Down
45 changes: 14 additions & 31 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var BarePHP = module.exports = function BarePHP() {
controlRepository: true,
controlDirs: false,
controlLicense: true,
controlCustomPHPCS: false,
controlCustomPHPMD: false,
controlPackagist: true,
controlTravis: true,
Expand Down Expand Up @@ -256,9 +255,6 @@ BarePHP.prototype.askForRepository = function() {
if (!this.config.get('accountScrutinizer')) {
this.config.set('accountScrutinizer', accountRepository);
}
if (!this.config.get('accountStyleci')) {
this.config.set('accountStyleci', 'XXXXXXXX');
}

var repositoryUrl = 'https://';
switch (props.type.toLowerCase()) {
Expand Down Expand Up @@ -461,7 +457,7 @@ BarePHP.prototype.askCodeConfig = function() {
type: 'list',
name: 'phpVersion',
message: 'What is the minimum supported PHP version for the project?',
choices: ['5.3', '5.4', '5.5', '5.6', '7.0'/*, '7.1'*/],
choices: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'],
default: this.defaults.project.phpVersion.toFixed(1)
},
{
Expand Down Expand Up @@ -532,16 +528,6 @@ BarePHP.prototype.askForToolsInstall = function() {

var done = this.async();
var choiceList = [
{
value: 'customPHPCS',
name: 'Custom PHPCS ruleset',
checked: this.config.get('controlCustomPHPCS')
},
{
value: 'customPHPMD',
name: 'Custom PHPMD ruleset',
checked: this.config.get('controlCustomPHPMD')
},
{
value: 'packagist',
name: 'Packagist',
Expand Down Expand Up @@ -571,6 +557,11 @@ BarePHP.prototype.askForToolsInstall = function() {
value: 'docs',
name: 'Initial documentation',
checked: this.config.get('controlDocs')
},
{
value: 'customPHPMD',
name: 'Customizable PHPMD ruleset',
checked: this.config.get('controlCustomPHPMD')
}
];

Expand All @@ -596,13 +587,12 @@ BarePHP.prototype.askForToolsInstall = function() {
this.prompt(prompts, function(props) {
var hasMod = function(mod) { return props.tools.indexOf(mod) !== -1; };

this.config.set('controlCustomPHPCS', hasMod('customPHPCS'));
this.config.set('controlCustomPHPMD', hasMod('customPHPMD'));
this.config.set('controlPackagist', hasMod('packagist'));
this.config.set('controlTravis', hasMod('travis'));
this.config.set('controlCoveralls', hasMod('coveralls'));
this.config.set('controlScrutinizer', hasMod('scrutinizer'));
this.config.set('controlStyleci', hasMod('styleci'));
this.config.set('controlCustomPHPMD', hasMod('customPHPMD'));
this.config.set('controlHomestead', hasMod('homestead'));
if (!hasMod('homestead')) {
this.config.set('controlPhpMyAdmin', false);
Expand Down Expand Up @@ -706,7 +696,7 @@ BarePHP.prototype.askForScrutinizerAccount = function() {
};

BarePHP.prototype.askForStyleciAccount = function() {
if (this.defaults.quickMode || !this.config.get('controlStyleci')) {
if (this.defaults.quickMode || !this.config.get('controlStyleci') || !this.config.get('controlDocs')) {
return;
}

Expand All @@ -720,13 +710,10 @@ BarePHP.prototype.askForStyleciAccount = function() {
];

this.prompt(prompts, function(props) {
var accountStyleci = _.clean(props.account).replace(/\s+/g, '_');
if (accountStyleci === '') {
accountStyleci = 'XXXXXXXX';
}
var accountStyleci = _.clean(props.account).replace(/\s+/g, '');

if (accountStyleci === 'XXXXXXXX') {
console.log(chalk.yellow.bold(' Remember to assign StyleCI repository code on readme file'));
if (accountStyleci === '') {
console.log(chalk.yellow.bold(' Remember to assign StyleCI repository code on README file'));
}

this.config.set('accountStyleci', accountStyleci);
Expand Down Expand Up @@ -897,7 +884,6 @@ BarePHP.prototype.writing = {
repository: this.config.get('controlRepository'),
dirs: this.config.get('controlDirs'),
license: this.config.get('controlLicense'),
customPHPCS: this.config.get('controlCustomPHPCS'),
customPHPMD: this.config.get('controlCustomPHPMD'),
packagist: this.config.get('controlPackagist'),
travis: this.config.get('controlTravis'),
Expand Down Expand Up @@ -981,7 +967,7 @@ BarePHP.prototype.writing = {
travis: this.config.get('accountTravis'),
coveralls: this.config.get('accountCoveralls'),
scrutinizer: this.config.get('accountScrutinizer'),
styleci: this.config.get('accountStyleci')
styleci: this.config.get('accountStyleci') !== '' ? this.config.get('accountStyleci') : 'XXXXXXXX'
};

this.homestead = {
Expand Down Expand Up @@ -1033,9 +1019,6 @@ BarePHP.prototype.writing = {

this.template('../../templates/_phpunit.xml', 'phpunit.xml');

if (this.config.get('controlCustomPHPCS')) {
this.template('../../templates/_phpcs.xml', 'phpcs.xml');
}
if (this.config.get('controlCustomPHPMD')) {
this.template('../../templates/_phpmd.xml', 'phpmd.xml');
}
Expand All @@ -1050,7 +1033,7 @@ BarePHP.prototype.writing = {
this.template('../../templates/_Gruntfile.js', 'Gruntfile.js');
this.template('../../templates/grunt/_config.js', 'grunt/config.js');
this.copy('../../templates/grunt/phplint.js', 'grunt/phplint.js');
this.copy('../../templates/grunt/_phpcs.js', 'grunt/phpcs.js');
this.copy('../../templates/grunt/phpcs.js', 'grunt/phpcs.js');
this.copy('../../templates/grunt/_phpmd.js', 'grunt/phpmd.js');
this.copy('../../templates/grunt/phpcpd.js', 'grunt/phpcpd.js');
this.copy('../../templates/grunt/phpunit.js', 'grunt/phpunit.js');
Expand All @@ -1069,7 +1052,7 @@ BarePHP.prototype.writing = {
this.template('../../templates/_gulpfile.js', 'gulpfile.js');
this.template('../../templates/gulp/_config.js', 'gulp/config.js');
this.copy('../../templates/gulp/phplint.js', 'gulp/phplint.js');
this.copy('../../templates/gulp/_phpcs.js', 'gulp/phpcs.js');
this.copy('../../templates/gulp/phpcs.js', 'gulp/phpcs.js');
this.copy('../../templates/gulp/_phpmd.js', 'gulp/phpmd.js');
this.copy('../../templates/gulp/phpcpd.js', 'gulp/phpcpd.js');
this.copy('../../templates/gulp/phpunit.js', 'gulp/phpunit.js');
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-barephp",
"version": "0.15.1",
"version": "1.0.0-rc.1",
"description": "Barebones PHP project scaffold",
"keywords": [
"yeoman-generator",
Expand All @@ -20,6 +20,7 @@
"styleci",
"vagrant",
"homestead",
"phpmyadmin",
"browsersync"
],
"homepage": "https://github.com/juliangut/generator-barephp",
Expand Down
5 changes: 1 addition & 4 deletions templates/_gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ if (control.taskRunner === 'Gulp') { -%>
gulpfile.js export-ignore
<% } -%>
phpunit.xml export-ignore
<% if (control.customPHPCS) { -%>
phpcs.xml export-ignore
<% }
if (control.customPHPMD) { -%>
<% if (control.customPHPMD) { -%>
phpmd.xml export-ignore
<% } -%>
8 changes: 0 additions & 8 deletions templates/_phpcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion templates/grunt/_phpcs.js → templates/grunt/phpcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports.tasks = {
phpcs: {
options: {
bin: 'vendor/bin/phpcs',
standard: <% if (control.customPHPCS) { -%>'phpcs.xml'<% } else { -%>'PSR2'<% } -%>
standard: 'PSR2'
},
application: {
dir: [
Expand Down
2 changes: 1 addition & 1 deletion templates/gulp/_phpcs.js → templates/gulp/phpcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gulp.task('phpcs', function() {
return gulp.src([config.src + '/**/*.php', config.tests + '/**/*.php'])
.pipe(phpcs({
bin: 'vendor/bin/phpcs',
standard: <% if (control.customPHPCS) { -%>'phpcs.xml'<% } else { -%>'PSR2'<% } -%>,
standard: 'PSR2',
warningSeverity: 0
}))
.pipe(phpcs.reporter('log'));
Expand Down
3 changes: 3 additions & 0 deletions templates/tools/_scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ tools:
excluded_dirs: [<%= dir.dist %>, <%= dir.tests %>, vendor]
php_mess_detector:
enabled: true
config:
ruleset: <% if (control.customPHPMD) { -%>phpmd.xml<% } else { -%>'unusedcode,naming,design,controversial,codesize'<% } -%>

php_loc:
enabled: true
excluded_dirs: [<%= dir.dist %>, <%= dir.tests %>, vendor]
Expand Down
31 changes: 13 additions & 18 deletions templates/tools/_travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ sudo: false
php:
<% if (project.phpVersion <= 5.3) { -%>
- 5.3
<% } -%>
<% if (project.phpVersion <= 5.4) { -%>
<% }
if (project.phpVersion <= 5.4) { -%>
- 5.4
<% } -%>
<% if (project.phpVersion <= 5.5) { -%>
<% }
if (project.phpVersion <= 5.5) { -%>
- 5.5
<% } -%>
<% if (project.phpVersion <= 5.6) { -%>
<% }
if (project.phpVersion <= 5.6) { -%>
- 5.6
<% } -%>
<% if (project.phpVersion <= 7.0) { -%>
<% }
if (project.phpVersion <= 7.0) { -%>
- 7.0
<% }
if (project.phpVersion <= 7.1) { -%>
- 7.1
<% } -%>
- hhvm
Expand All @@ -37,25 +39,18 @@ install:
<% } -%>

script:
<% if (control.customPHPCS) { -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpcs --standard=PSR2 <%= dir.src %> <%= dir.tests %> ; fi
<% if (control.customPHPMD) { -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpmd <%= dir.src %> text phpmd.xml ; fi
<% } else { -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpcs --standard=phpcs.xml <%= dir.src %> <%= dir.tests %> ; fi
<% }
if (control.customPHPMD) { -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpmd <%= dir.src %> text unusedcode,naming,design,controversial,codesize ; fi
<% } else { -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpmd <%= dir.src %> phpmd.xml ; fi
<% } -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpcpd <%= dir.src %> ; fi
<% if (!control.coveralls) { -%>
- vendor/bin/phpunit
<% } -%>
<% if (control.coveralls) { -%>
<% } else { -%>
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml ; fi
- if [[ "$TRAVIS_PHP_VERSION" != "<%= project.testPhpVersion.toFixed(1) %>" ]]; then vendor/bin/phpunit ; fi
<% } -%>
<% if (control.coveralls) { -%>

after_script:
- if [[ "$TRAVIS_PHP_VERSION" == "<%= project.testPhpVersion.toFixed(1) %>" ]]; then travis_retry php vendor/bin/coveralls -v ; fi
Expand Down

0 comments on commit fbbe9e6

Please sign in to comment.