Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
Change workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JustCarmen committed Feb 26, 2018
1 parent adb6ad5 commit 50e548d
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/nbproject/
61 changes: 61 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -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
]);
44 changes: 44 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -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
};
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 50e548d

Please sign in to comment.