-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from premanshup/feat-bsf-analytics
Feat: Users can now share non-personal usage data to help us test and develop better products.
- Loading branch information
Showing
20 changed files
with
6,383 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ignore PHPStorm extra directories | ||
.idea/ | ||
|
||
# Leave node_modules from git | ||
node_modules/ | ||
|
||
# sass cache | ||
.sass-cache | ||
|
||
# map files | ||
*.map | ||
|
||
# Skip package file from versoning | ||
*.zip | ||
|
||
# ignore git inside subproject | ||
admin/bsf-core/.git | ||
|
||
# ignore PHPCS report files | ||
phpcs-summary.log | ||
phpcs-full.log | ||
|
||
# Exclude OS specific files | ||
.DS_Store | ||
|
||
# Exclude composer's directories | ||
vendor/ | ||
|
||
# Exclude exported settings | ||
borders-for-default-menu.json | ||
defaults.json | ||
no-toggle-border-fix.json | ||
cghooks.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
module.exports = function (grunt) { | ||
'use strict'; | ||
// Project configuration | ||
var autoprefixer = require('autoprefixer'); | ||
var flexibility = require('postcss-flexibility'); | ||
|
||
var pkgInfo = grunt.file.readJSON('package.json'); | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
rtlcss: { | ||
options: { | ||
// rtlcss options | ||
config: { | ||
preserveComments: true, | ||
greedy: true | ||
}, | ||
// generate source maps | ||
map: false | ||
}, | ||
dist: { | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd: 'assets/css/unminified', | ||
src: [ | ||
'*.css', | ||
'!*-rtl.css', | ||
], | ||
dest: 'assets/css/unminified', | ||
ext: '-rtl.css' | ||
}, | ||
] | ||
} | ||
}, | ||
|
||
postcss: { | ||
options: { | ||
map: false, | ||
processors: [ | ||
flexibility, | ||
autoprefixer({ | ||
browsers: [ | ||
'Android >= 2.1', | ||
'Chrome >= 21', | ||
'Edge >= 12', | ||
'Explorer >= 7', | ||
'Firefox >= 17', | ||
'Opera >= 12.1', | ||
'Safari >= 6.0' | ||
], | ||
cascade: false | ||
}) | ||
] | ||
}, | ||
style: { | ||
expand: true, | ||
src: [ | ||
'assets/css/unminified/**.css', | ||
'!assets/css/unminified/**-rtl.css' | ||
] | ||
} | ||
}, | ||
|
||
cssmin: { | ||
options: { | ||
keepSpecialComments: 0 | ||
}, | ||
css: { | ||
files: [ | ||
{ | ||
src: 'assets/css/unminified/style.css', | ||
dest: 'assets/css/minified/style.min.css', | ||
}, | ||
{ | ||
src: 'assets/css/unminified/style-rtl.css', | ||
dest: 'assets/css/minified/style-rtl.min.css', | ||
}, | ||
] | ||
} | ||
}, | ||
|
||
copy: { | ||
main: { | ||
options: { | ||
mode: true | ||
}, | ||
src: [ | ||
'**', | ||
'!node_modules/**', | ||
'!build/**', | ||
'!css/sourcemap/**', | ||
'!.git/**', | ||
'!bin/**', | ||
'!.gitlab-ci.yml', | ||
'!bin/**', | ||
'!tests/**', | ||
'!phpunit.xml.dist', | ||
'!*.sh', | ||
'!*.map', | ||
'!Gruntfile.js', | ||
'!package.json', | ||
'!.gitignore', | ||
'!phpunit.xml', | ||
'!README.md', | ||
'!sass/**', | ||
'!codesniffer.ruleset.xml', | ||
'!vendor/**', | ||
'!composer.json', | ||
'!composer.lock', | ||
'!package-lock.json', | ||
'!phpcs.xml.dist', | ||
], | ||
dest: 'bsf-analytics/' | ||
} | ||
}, | ||
|
||
compress: { | ||
main: { | ||
options: { | ||
archive: 'bsf-analytics-' + pkgInfo.version + '.zip', | ||
mode: 'zip' | ||
}, | ||
files: [ | ||
{ | ||
src: [ | ||
'./bsf-analytics/**' | ||
] | ||
|
||
} | ||
] | ||
} | ||
}, | ||
|
||
clean: { | ||
main: ["bsf-analytics"], | ||
zip: ["*.zip"] | ||
|
||
}, | ||
|
||
replace: { | ||
|
||
analytics_const: { | ||
src: ['class-bsf-analytics.php'], | ||
overwrite: true, | ||
replacements: [ | ||
{ | ||
from: /BSF_ANALYTICS_VERSION', '.*?'/g, | ||
to: 'BSF_ANALYTICS_VERSION\', \'<%= pkg.version %>\'' | ||
} | ||
] | ||
}, | ||
|
||
analytics_function_comment: { | ||
src: [ | ||
'*.php', | ||
'**/*.php', | ||
'!node_modules/**', | ||
'!php-tests/**', | ||
'!bin/**', | ||
], | ||
overwrite: true, | ||
replacements: [ | ||
{ | ||
from: 'x.x.x', | ||
to: '<%=pkg.version %>' | ||
} | ||
] | ||
}, | ||
}, | ||
} | ||
); | ||
|
||
// Load grunt tasks | ||
grunt.loadNpmTasks('grunt-rtlcss'); | ||
grunt.loadNpmTasks( 'grunt-postcss' ); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-cssmin'); | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-contrib-compress'); | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
|
||
/* Version Bump Task */ | ||
grunt.loadNpmTasks( 'grunt-bumpup' ); | ||
grunt.loadNpmTasks( 'grunt-text-replace' ); | ||
|
||
// rtlcss, you will still need to install ruby and sass on your system manually to run this | ||
grunt.registerTask('rtl', ['rtlcss']); | ||
|
||
// Style | ||
grunt.registerTask('style', ['rtl']); | ||
|
||
// min all | ||
grunt.registerTask('minify', ['style', 'cssmin:css']); | ||
|
||
// Grunt release - Create installable package of the local files | ||
grunt.registerTask('release', ['clean:zip', 'copy:main', 'compress:main', 'clean:main']); | ||
|
||
// Version Bump `grunt bump-version --ver=<version-number>` | ||
grunt.registerTask( 'bump-version', function() { | ||
|
||
var newVersion = grunt.option('ver'); | ||
|
||
if ( newVersion ) { | ||
grunt.task.run( 'bumpup:' + newVersion ); | ||
grunt.task.run( 'replace' ); | ||
} | ||
} ); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#bsf-optin-notice { | ||
padding: 1px 12px; | ||
border-right-color: #007cba; | ||
} | ||
|
||
#bsf-optin-notice .notice-container { | ||
padding-top: 10px; | ||
padding-bottom: 12px; | ||
} | ||
|
||
#bsf-optin-notice .notice-content { | ||
margin: 0; | ||
} | ||
|
||
#bsf-optin-notice .notice-heading { | ||
padding: 0 0 12px 20px; | ||
} | ||
|
||
#bsf-optin-notice .button-primary { | ||
margin-left: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#bsf-optin-notice { | ||
padding: 1px 12px; | ||
border-left-color: #007cba; | ||
} | ||
|
||
#bsf-optin-notice .notice-container { | ||
padding-top: 10px; | ||
padding-bottom: 12px; | ||
} | ||
|
||
#bsf-optin-notice .notice-content { | ||
margin: 0; | ||
} | ||
|
||
#bsf-optin-notice .notice-heading { | ||
padding: 0 20px 12px 0; | ||
} | ||
|
||
#bsf-optin-notice .button-primary { | ||
margin-right: 5px; | ||
} |
19 changes: 19 additions & 0 deletions
19
admin/bsf-analytics/bin/block-commits-with-merge-conflict.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
## pre-commit script to prevent merge markers from being committed. | ||
|
||
changed=$(git diff --cached --name-only) | ||
|
||
if [[ -z "$changed" ]] | ||
then | ||
exit 0 | ||
fi | ||
|
||
echo $changed | xargs egrep '[><]{7}' -H -I --line-number | ||
|
||
## If the egrep command has any hits - echo a warning and exit with non-zero status. | ||
if [ $? == 0 ] | ||
then | ||
echo "\n\nWARNING: You have merge markers in the above files, lines. Fix them before committing.\n\n" | ||
exit 1 | ||
fi |
Oops, something went wrong.