diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index a4e4c0d..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,221 +0,0 @@ -// To use this file in WebStorm, right click on the file name in the Project Panel (normally left) and select "Open Grunt Console" - -/** @namespace __dirname */ -/* jshint -W097 */// jshint strict:false -/*jslint node: true */ -"use strict"; - -module.exports = function (grunt) { - - var srcDir = __dirname + '/'; - var pkg = grunt.file.readJSON('package.json'); - var adaptName = pkg.name.substring('iobroker.'.length); - var iopackage = grunt.file.readJSON('io-package.json'); - var version = (pkg && pkg.version) ? pkg.version : iopackage.common.version; - var newname = grunt.option('name'); - var author = grunt.option('author') || 'Pmant'; - var email = grunt.option('email') || 'patrickmo@gmx.de'; - var fs = require('fs'); - - // check arguments - if (process.argv[2] == 'rename') { - console.log('Try to rename to "' + newname + '"'); - if (!newname) { - console.log('Please write the new botvac name, like: "grunt rename --name=mywidgetset" --author="Author Name"'); - process.exit(); - } - if (newname.indexOf(' ') != -1) { - console.log('Name may not have space in it.'); - process.exit(); - } - if (newname.toLowerCase() != newname) { - console.log('Name must be lower case.'); - process.exit(); - } - if (fs.existsSync(__dirname + '/admin/botvac.png')) { - fs.renameSync(__dirname + '/admin/botvac.png', __dirname + '/admin/' + newname + '.png'); - } - if (fs.existsSync(__dirname + '/widgets/botvac.html')) { - fs.renameSync(__dirname + '/widgets/botvac.html', __dirname + '/widgets/' + newname + '.html'); - } - if (fs.existsSync(__dirname + '/widgets/botvac/js/botvac.js')) { - fs.renameSync(__dirname + '/widgets/botvac/js/botvac.js', __dirname + '/widgets/botvac/js/' + newname + '.js'); - } - if (fs.existsSync(__dirname + '/widgets/botvac')) { - fs.renameSync(__dirname + '/widgets/botvac', __dirname + '/widgets/' + newname); - } - } - - // Project configuration. - grunt.initConfig({ - pkg: pkg, - - replace: { - version: { - options: { - patterns: [ - { - match: /version: *"[\.0-9]*"/, - replacement: 'version: "' + version + '"' - }, - { - match: /"version": *"[\.0-9]*",/g, - replacement: '"version": "' + version + '",' - }, - { - match: /version: *"[\.0-9]*",/g, - replacement: 'version: "' + version + '",' - } - ] - }, - files: [ - { - expand: true, - flatten: true, - src: [ - srcDir + 'package.json', - srcDir + 'io-package.json' - ], - dest: srcDir - }, - { - expand: true, - flatten: true, - src: [ - srcDir + 'widgets/' + adaptName + '.html' - ], - dest: srcDir + 'widgets' - }, - { - expand: true, - flatten: true, - src: [ - srcDir + 'widgets/' + adaptName + '/js/' + adaptName + '.js' - ], - dest: srcDir + 'widgets/' + adaptName + '/js/' - } - ] - }, - name: { - options: { - patterns: [ - { - match: /botvac/g, - replacement: newname - }, - { - match: /Botvac/g, - replacement: newname ? (newname[0].toUpperCase() + newname.substring(1)) : 'Botvac' - }, - { - match: /Pmant/g, - replacement: author - }, - { - match: /patrickmo@gmx.de/g, - replacement: email - } - ] - }, - files: [ - { - expand: true, - flatten: true, - src: [ - srcDir + 'io-package.json', - srcDir + 'LICENSE', - srcDir + 'package.json', - srcDir + 'README.md', - srcDir + 'main.js', - srcDir + 'Gruntfile.js' - ], - dest: srcDir - }, - { - expand: true, - flatten: true, - src: [ - srcDir + 'widgets/' + newname + '.html' - ], - dest: srcDir + 'widgets' - }, - { - expand: true, - flatten: true, - src: [ - srcDir + 'admin/index.html' - ], - dest: srcDir + 'admin' - }, - { - expand: true, - flatten: true, - src: [ - srcDir + 'widgets/' + newname + '/js/' + newname + '.js' - ], - dest: srcDir + 'widgets/' + newname + '/js' - }, - { - expand: true, - flatten: true, - src: [ - srcDir + 'widgets/' + newname + '/css/*.css' - ], - dest: srcDir + 'widgets/' + newname + '/css' - } - ] - } - }, - // Javascript code styler - jscs: require(__dirname + '/tasks/jscs.js'), - // Lint - jshint: require(__dirname + '/tasks/jshint.js'), - - http: { - get_hjscs: { - options: { - url: 'https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/tasks/jscs.js' - }, - dest: 'tasks/jscs.js' - }, - get_jshint: { - options: { - url: 'https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/tasks/jshint.js' - }, - dest: 'tasks/jshint.js' - }, - get_jscsRules: { - options: { - url: 'https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/tasks/jscsRules.js' - }, - dest: 'tasks/jscsRules.js' - } - } - }); - - grunt.loadNpmTasks('grunt-replace'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-jscs'); - grunt.loadNpmTasks('grunt-http'); - - grunt.registerTask('default', [ - 'http', - 'replace:version', - 'jshint', - 'jscs' - ]); - - grunt.registerTask('prepublish', [ - 'http', - 'replace:version' - ]); - - grunt.registerTask('p', [ - 'http', - 'replace:version' - ]); - - grunt.registerTask('rename', [ - 'replace:name' - ]); -}; diff --git a/tasks/jscs.js b/tasks/jscs.js deleted file mode 100644 index 588b6f2..0000000 --- a/tasks/jscs.js +++ /dev/null @@ -1,17 +0,0 @@ -var srcDir = __dirname + "/../"; - -module.exports = { - all: { - src: [ - srcDir + "*.js", - srcDir + "lib/*.js", - srcDir + "adapter/example/*.js", - srcDir + "tasks/**/*.js", - srcDir + "www/**/*.js", - '!' + srcDir + "www/lib/**/*.js", - '!' + srcDir + 'node_modules/**/*.js', - '!' + srcDir + 'adapter/*/node_modules/**/*.js' - ], - options: require('./jscsRules.js') - } -}; \ No newline at end of file diff --git a/tasks/jscsRules.js b/tasks/jscsRules.js deleted file mode 100644 index ded301d..0000000 --- a/tasks/jscsRules.js +++ /dev/null @@ -1,36 +0,0 @@ -module.exports = { - force: true, - "requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"], /*"if",*/ - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], - "requireSpaceBeforeBlockStatements": true, - "requireParenthesesAroundIIFE": true, - "disallowSpacesInFunctionDeclaration": {"beforeOpeningRoundBrace": true}, - "disallowSpacesInNamedFunctionExpression": {"beforeOpeningRoundBrace": true}, - "requireSpacesInFunctionExpression": {"beforeOpeningCurlyBrace": true}, - "requireSpacesInAnonymousFunctionExpression": {"beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true}, - "requireSpacesInNamedFunctionExpression": {"beforeOpeningCurlyBrace": true}, - "requireSpacesInFunctionDeclaration": {"beforeOpeningCurlyBrace": true}, - "disallowMultipleVarDecl": true, - "requireBlocksOnNewline": true, - "disallowEmptyBlocks": true, - "disallowSpacesInsideObjectBrackets": true, - "disallowSpacesInsideArrayBrackets": true, - "disallowSpaceAfterObjectKeys": true, - "disallowSpacesInsideParentheses": true, - "requireCommaBeforeLineBreak": true, - //"requireAlignedObjectValues": "all", - "requireOperatorBeforeLineBreak": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], -// "disallowLeftStickedOperators": ["?", "+", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], -// "requireRightStickedOperators": ["!"], -// "requireSpaceAfterBinaryOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], - //"disallowSpaceAfterBinaryOperators": [","], - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "requireSpaceAfterBinaryOperators": ["?", ">", ",", ">=", "<=", "<", "+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - //"validateIndentation": 4, - //"validateQuoteMarks": { "mark": "\"", "escape": true }, - "disallowMixedSpacesAndTabs": true, - "disallowKeywordsOnNewLine": ["else", "catch"] - -}; diff --git a/tasks/jshint.js b/tasks/jshint.js deleted file mode 100644 index f823ebc..0000000 --- a/tasks/jshint.js +++ /dev/null @@ -1,17 +0,0 @@ -var srcDir = __dirname + "/../"; - -module.exports = { - options: { - force: true - }, - all: [ - srcDir + "*.js", - srcDir + "lib/*.js", - srcDir + "adapter/example/*.js", - srcDir + "tasks/**/*.js", - srcDir + "www/**/*.js", - '!' + srcDir + "www/lib/**/*.js", - '!' + srcDir + 'node_modules/**/*.js', - '!' + srcDir + 'adapter/*/node_modules/**/*.js' - ] -}; \ No newline at end of file