Permalink
Browse files

Change workflow

  • Loading branch information...
JustCarmen committed Feb 26, 2018
1 parent 4fe7418 commit 4ad7c63568fe63bba01dba61baa24bd8ee0bf043
Showing with 127 additions and 6 deletions.
  1. +10 −6 .gitattributes
  2. +2 −0 .gitignore
  3. +61 −0 .php_cs
  4. +44 −0 Gruntfile.js
  5. +10 −0 package.json
@@ -1,6 +1,10 @@
#exclude files from export

README.md export-ignore
.gitattributes export-ignore
.gitignore export-ignore
language/*.po* export-ignore
#exclude files from export

README.md export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.php_cs export-ignore
.Gruntfile.js export-ignore
.package.json export-ignore
language/*.po* export-ignore
@@ -0,0 +1,2 @@
/node_modules/
/nbproject/
61 .php_cs
@@ -0,0 +1,61 @@
<?php
/*
* webtrees: online genealogy
* Copyright (C) 2018 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// https://github.com/FriendsOfPHP/PHP-CS-Fixer
$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
return PhpCsFixer\Config::create()
->setUsingCache(false)
->setIndent("\t")
->setFinder($finder)
->setRiskyAllowed(true)
->setRules([
// Mostly use PSR-2 ...
'@PSR2' => true,
// ... exceptions
'braces' => [
'position_after_functions_and_oop_constructs' => 'same',
],
// ... additions
'binary_operator_spaces' => [
'operators' => [
'===' => 'align_single_space_minimal',
'!==' => 'align_single_space_minimal',
'==' => 'align_single_space_minimal',
'!=' => 'align_single_space_minimal',
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
],
],
'array_syntax' => [
'syntax' => 'short',
],
'concat_space' => [
'spacing' => 'one',
],
// Custom config @JustCarmen
'no_unused_imports' => true,
'single_line_after_imports' =>false,
'line_ending' => false // to prevent mixed line endings
]);
@@ -0,0 +1,44 @@
module.exports = function(grunt) {

// load all grunt tasks with this command. No need to set grunt.loadNpmTasks(...) for each task separately;
require('load-grunt-tasks')(grunt);

// output time table
require('time-grunt')(grunt);

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

// ========================================================================================
// WATCH TASK
// ========================================================================================
watch: {
php: {
files: ['*.php'],
tasks: ['phpcsfixer'],
options: {
spawn: false
}
}
},

// ========================================================================================
// PHP CS FIXER
//
// Source: https://github.com/FriendsOfPHP/PHP-CS-Fixer //
// Configurator: https://mlocati.github.io/php-cs-fixer-configurator/
// ========================================================================================

phpcsfixer: {
app: {
dir: ''
},
options: {
bin: '../../vendor/bin/php-cs-fixer',
configfile: '.php_cs',
quiet: true
}
}
}); // end of grunt configuration
};
@@ -0,0 +1,10 @@
{
"private": true,
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-php-cs-fixer": "^1.0.0",
"load-grunt-tasks": "^3.5.2",
"time-grunt": "^1.4.0"
}
}

0 comments on commit 4ad7c63

Please sign in to comment.