From d9eea6a2d04b33db6edb3b3d205cf2fc7b5bafd6 Mon Sep 17 00:00:00 2001 From: ZhijunZhao Date: Fri, 14 Oct 2016 13:26:06 +0800 Subject: [PATCH] Enforce camel case naming rule (#41) * Enforce camel case naming rule * more cleanup --- .eslintrc | 8 +++++++- all.js | 2 +- arduino.js | 6 +++--- raspberrypi-c.js | 10 +++++----- raspberrypi-node.js | 4 ++-- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.eslintrc b/.eslintrc index 71833f2..97796b0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -26,6 +26,12 @@ "SwitchCase": 1 } ], - "no-trailing-spaces": "error" + "no-trailing-spaces": "error", + "camelcase": [ + "error", + { + "properties": "always" + } + ] } } \ No newline at end of file diff --git a/all.js b/all.js index 6325b70..27edef2 100644 --- a/all.js +++ b/all.js @@ -489,7 +489,7 @@ function writeConfigH() { } module.exports = function (options) { - config = readCombinedConfig(options.config_postfix); + config = readCombinedConfig(options.configPostfix); return { uploadFilesViaScp, diff --git a/arduino.js b/arduino.js index 145eb91..a7da646 100644 --- a/arduino.js +++ b/arduino.js @@ -18,7 +18,7 @@ function initTasks(gulp, options) { var config = all.getConfig(); // package:arch:board[:parameters] - var board_descriptor = options.board.package + ':' + + var boardDescriptor = options.board.package + ':' + options.board.arch + ":" + options.board.board + ((options.board.parameters.length > 0) ? (':' + options.board.parameters) : ''); @@ -87,13 +87,13 @@ function initTasks(gulp, options) { gulp.task('build', 'Builds sample code', function (cb) { all.writeConfigH(); all.localExecCmd(getArduinoCommand() + ' --verify --board ' + - board_descriptor + ' ' + process.cwd() + '/app/app.ino --verbose-build', args.verbose, cb); + boardDescriptor + ' ' + process.cwd() + '/app/app.ino --verbose-build', args.verbose, cb); }); gulp.task('deploy', 'Deploys binary to the device', function (cb) { all.writeConfigH(); if (!config.device_port.trim()) { - all.localExecCmd(getArduinoCommand() + ' --upload --board ' + board_descriptor + + all.localExecCmd(getArduinoCommand() + ' --upload --board ' + boardDescriptor + ' --port ' + config.device_port + ' ' + process.cwd() + '/app/app.ino --verbose-upload', args.verbose, cb); } else { cb(new Error('Port is not defined in config')); diff --git a/raspberrypi-c.js b/raspberrypi-c.js index bbd30f7..9fda4c3 100644 --- a/raspberrypi-c.js +++ b/raspberrypi-c.js @@ -22,8 +22,8 @@ function initTasks(gulp, options) { gulp.task('init', 'Initializes sample', function (cb) { - if (options.config_postfix && options.config_template) { - all.updateGlobalConfig(options.config_postfix, options.config_template); + if (options.configPostfix && options.configTemplate) { + all.updateGlobalConfig(options.configPostfix, options.configTemplate); } cb(); @@ -65,7 +65,7 @@ function initTasks(gulp, options) { fs.mkdirSync('out'); // in first step just compile sample file - var cmd_compile = getCompilerFolder() + '/arm-linux-gnueabihf-gcc ' + + var cmdCompile = getCompilerFolder() + '/arm-linux-gnueabihf-gcc ' + // XXX - don't include this //'-I' + PREBUILT_FOLDER + '/raspbian-jessie-sysroot/usr/include ' + '-I' + PREBUILT_FOLDER + '/inc/wiringpi ' + @@ -79,7 +79,7 @@ function initTasks(gulp, options) { '-c app/' + SAMPLE_NAME + '.c'; // second step -- link with prebuild libraries - var cmd_link = getCompilerFolder() + '/arm-linux-gnueabihf-gcc ' + + var cmdLink = getCompilerFolder() + '/arm-linux-gnueabihf-gcc ' + 'out/' + SAMPLE_NAME + '.o ' + '-o out/' + SAMPLE_NAME + ' -rdynamic ' + @@ -103,7 +103,7 @@ function initTasks(gulp, options) { '-Wl,-rpath,' + PREBUILT_FOLDER + '/raspbian-jessie-sysroot/usr/lib/arm-linux-gnueabihf,-rpath,' + PREBUILT_FOLDER + '/raspbian-jessie-sysroot/lib/arm-linux-gnueabihf'; - all.localExecCmds([cmd_compile, cmd_link], args.verbose, cb) + all.localExecCmds([cmdCompile, cmdLink], args.verbose, cb) }); gulp.task('check-raspbian', false, function (cb) { diff --git a/raspberrypi-node.js b/raspberrypi-node.js index 6e61673..50e1582 100644 --- a/raspberrypi-node.js +++ b/raspberrypi-node.js @@ -25,8 +25,8 @@ function initTasks(gulp, options) { gulp.task('init', 'Initializes sample', function (cb) { - if (options.config_postfix && options.config_template) { - all.updateGlobalConfig(options.config_postfix, options.config_template); + if (options.configPostfix && options.configTemplate) { + all.updateGlobalConfig(options.configPostfix, options.configTemplate); } cb();