Skip to content

Commit

Permalink
Merge pull request #26 from premanshup/feat-bsf-analytics
Browse files Browse the repository at this point in the history
Feat: Users can now share non-personal usage data to help us test and develop better products.
  • Loading branch information
Nikschavan authored Jun 15, 2020
2 parents a1d1d86 + 6f365f8 commit 935c299
Show file tree
Hide file tree
Showing 20 changed files with 6,383 additions and 14 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
**Donate link:** https://www.paypal.me/BrainstormForce
**Tags:** customizer, search
**Requires at least:** 4.6
**Tested up to:** 5.4
**Stable tag:** 1.1.3
**Tested up to:** 5.4.2
**Stable tag:** 1.1.4
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -26,6 +26,9 @@ https://www.youtube.com/watch?v=IBFfap_vGzg

## Changelog ##

### 1.1.4 ###
- New: Users can now share non-personal usage data to help us test and develop better products. ( https://store.brainstormforce.com/usage-tracking/?utm_source=wp_dashboard&utm_medium=general_settings&utm_campaign=usage_tracking )

### 1.1.3 ###
- Setup plugin translations through https://translate.wordpress.org/projects/wp-plugins/customizer-search/.

Expand Down
33 changes: 33 additions & 0 deletions admin/bsf-analytics/.gitignore
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
210 changes: 210 additions & 0 deletions admin/bsf-analytics/Gruntfile.js
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' );
}
} );
};
1 change: 1 addition & 0 deletions admin/bsf-analytics/assets/css/minified/style-rtl.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions admin/bsf-analytics/assets/css/minified/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions admin/bsf-analytics/assets/css/unminified/style-rtl.css
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;
}
21 changes: 21 additions & 0 deletions admin/bsf-analytics/assets/css/unminified/style.css
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 admin/bsf-analytics/bin/block-commits-with-merge-conflict.sh
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
Loading

0 comments on commit 935c299

Please sign in to comment.