diff --git a/.gitignore b/.gitignore index 51324e9f7..54d12d0f2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ nodes/node-red-nodes/ /coverage .config.json .sessions.json - +public +.dist diff --git a/.travis.yml b/.travis.yml index 7da65ca45..82148451c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ before_install: - npm install -g npm@~1.4.18 node_js: - "0.10" - - "0.8" script: - istanbul cover ./node_modules/.bin/grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage before_script: diff --git a/Gruntfile.js b/Gruntfile.js index 0e68c900a..db93ad48d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,5 @@ /** - * Copyright 2013, 2014 IBM Corp. + * Copyright 2013, 2015 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,82 +14,279 @@ * limitations under the License. **/ +var path = require("path"); + module.exports = function(grunt) { - // Project configuration. grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - simplemocha: { - options: { - globals: ['expect'], - timeout: 3000, - ignoreLeaks: false, - ui: 'bdd', - reporter: 'spec' - }, - all: { src: ['test/**/*_spec.js'] }, - core: { src: ["test/_spec.js","test/red/**/*_spec.js"]}, - nodes: { src: ["test/nodes/**/*_spec.js"]} + pkg: grunt.file.readJSON('package.json'), + paths: { + dist: ".dist" + }, + simplemocha: { + options: { + globals: ['expect'], + timeout: 3000, + ignoreLeaks: false, + ui: 'bdd', + reporter: 'spec' }, - jshint: { - options: { - // http://www.jshint.com/docs/options/ - "asi": true, // allow missing semicolons - "curly": true, // require braces - "eqnull": true, // ignore ==null - "forin": true, // require property filtering in "for in" loops - "immed": true, // require immediate functions to be wrapped in ( ) - "nonbsp": true, // warn on unexpected whitespace breaking chars - //"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually - "loopfunc": true, // allow functions to be defined in loops - "sub": true // don't warn that foo['bar'] should be written as foo.bar - }, - all: [ - 'Gruntfile.js', - 'red.js', - 'red/**/*.js', - 'nodes/**/*.js', - 'public/red/**/*.js' - ], - - core: { - files: { - src: [ - 'Gruntfile.js', - 'red.js', - 'red/**/*.js' - ] - } - }, - nodes: { - files: { - src: [ 'nodes/**/*.js' ] - } - }, - editor: { - files: { - src: [ 'public/red/**/*.js' ] - } - }, - tests: { - files: { - src: ['test/**/*.js'] - }, - options: { - "expr": true - } + all: { src: ['test/**/*_spec.js'] }, + core: { src: ["test/_spec.js","test/red/**/*_spec.js"]}, + nodes: { src: ["test/nodes/**/*_spec.js"]} + }, + jshint: { + options: { + // http://www.jshint.com/docs/options/ + "asi": true, // allow missing semicolons + "curly": true, // require braces + "eqnull": true, // ignore ==null + "forin": true, // require property filtering in "for in" loops + "immed": true, // require immediate functions to be wrapped in ( ) + "nonbsp": true, // warn on unexpected whitespace breaking chars + //"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually + "loopfunc": true, // allow functions to be defined in loops + "sub": true // don't warn that foo['bar'] should be written as foo.bar + }, + all: [ + 'Gruntfile.js', + 'red.js', + 'red/**/*.js', + 'nodes/**/*.js', + 'editor/js/**/*.js' + ], + + core: { + files: { + src: [ + 'Gruntfile.js', + 'red.js', + 'red/**/*.js' + ] + } + }, + nodes: { + files: { + src: [ 'nodes/**/*.js' ] + } + }, + editor: { + files: { + src: [ 'editor/js/**/*.js' ] + } + }, + tests: { + files: { + src: ['test/**/*.js'] + }, + options: { + "expr": true } - } + }, + concat: { + options: { + separator: ";", + }, + build: { + src: [ + // Ensure editor source files are concatenated in + // the right order + "editor/js/main.js", + "editor/js/settings.js", + "editor/js/user.js", + "editor/js/comms.js", + "editor/js/ui/state.js", + "editor/js/nodes.js", + "editor/js/history.js", + "editor/js/validators.js", + "editor/js/ui/deploy.js", + "editor/js/ui/menu.js", + "editor/js/ui/keyboard.js", + "editor/js/ui/tabs.js", + "editor/js/ui/workspaces.js", + "editor/js/ui/view.js", + "editor/js/ui/sidebar.js", + "editor/js/ui/palette.js", + "editor/js/ui/tab-info.js", + "editor/js/ui/tab-config.js", + "editor/js/ui/editor.js", + "editor/js/ui/clipboard.js", + "editor/js/ui/library.js", + "editor/js/ui/notifications.js", + "editor/js/ui/subflow.js", + "editor/js/ui/touch/radialMenu.js" + ], + dest: "public/red/red.js" + } + }, + uglify: { + build: { + files: { + 'public/red/red.min.js': 'public/red/red.js' + } + } + }, + sass: { + build: { + options: { + outputStyle: 'compressed' + }, + files: [{ + dest: 'public/red/style.min.css', + src: 'editor/sass/style.scss' + }] + } + }, + clean: { + build: { + src: [ + "public/red", + "public/index.html", + "public/favicon.ico", + "public/icons", + "public/vendor" + ] + }, + release: { + src: [ + '<%= paths.dist %>' + ] + } + }, + watch: { + js: { + files: [ + 'editor/js/**/*.js' + ], + tasks: ['concat','uglify'] + }, + sass: { + files: [ + 'editor/sass/**/*.scss' + ], + tasks: ['sass'] + } + }, + + nodemon: { + /* uses .nodemonignore */ + dev: { + script: 'red.js', + options: { + args:['-v'], + ext: 'js,html' + } + } + }, + + concurrent: { + dev: { + tasks: ['nodemon', 'watch'], + options: { + logConcurrentOutput: true + } + } + }, + + copy: { + build: { + files:[{ + cwd: 'editor/images', + src: '**', + expand: true, + dest: 'public/red/images/' + }, + { + cwd: 'editor/vendor', + src: '**', + expand: true, + dest: 'public/vendor/' + }, + { + cwd: 'editor/icons', + src: '**', + expand: true, + dest: 'public/icons/' + }, + { + expand: true, + src: ['editor/index.html','editor/favicon.ico'], + dest: 'public/', + flatten: true + }] + }, + release: { + files: [{ + expand: true, + src: [ + '*.md', + 'LICENSE', + 'package.json', + 'settings.js', + 'red.js', + 'lib/.gitignore', + 'nodes/*.demo', + 'nodes/core/**', + 'red/**', + 'public/**' + ], + dest: path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>') + }] + } + }, + + compress: { + release: { + options: { + archive: '<%= paths.dist %>/node-red-<%= pkg.version %>.zip' + }, + expand: true, + cwd: '<%= paths.dist %>/', + src: ['node-red-<%= pkg.version %>/**'] + } + } }); grunt.loadNpmTasks('grunt-simple-mocha'); grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-concurrent'); + grunt.loadNpmTasks('grunt-sass'); + grunt.loadNpmTasks('grunt-nodemon'); + grunt.loadNpmTasks('grunt-contrib-compress'); + grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.registerTask('default', ['test-core','test-editor','test-nodes']); + grunt.registerTask('default', + 'Builds editor content then runs code style checks and unit tests on all components', + ['build','test-core','test-editor','test-nodes']); - grunt.registerTask('test-core', ['jshint:core','simplemocha:core']); - grunt.registerTask('test-editor', ['jshint:editor']); - grunt.registerTask('test-nodes', ['simplemocha:nodes']); + grunt.registerTask('test-core', + 'Runs code style check and unit tests on core runtime code', + ['jshint:core','simplemocha:core']); + + grunt.registerTask('test-editor', + 'Runs code style check on editor code', + ['jshint:editor']); + + grunt.registerTask('test-nodes', + 'Runs unit tests on core nodes', + ['simplemocha:nodes']); + + grunt.registerTask('build', + 'Builds editor content', + ['clean:build','concat:build','uglify:build','sass:build','copy:build']); + + grunt.registerTask('dev', + 'Developer mode: run node-red, watch for source changes and build/restart', + ['build','concurrent:dev']); + + grunt.registerTask('release', + 'Create distribution zip file', + ['build','clean:release','copy:release','compress:release']); + }; diff --git a/README.md b/README.md index 142db0a9f..96d57142a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,31 @@ More documentation can be found [here](http://nodered.org/docs). For further help, or general discussion, please use the [mailing list](https://groups.google.com/forum/#!forum/node-red). +## Developers + +If you want to run the latest code from git, here's how to get started: + +1. Install grunt, the build tool + + npm install -g grunt-cli + +2. Clone the code: + + git clone git@github.com:node-red/node-red.git + cd node-red + +3. Install the node-red dependencies + + npm install + +4. Build the code + + grunt build + +5. Run + + node red.js + ## Contributing Before raising a pull-request, please read our diff --git a/public/favicon.ico b/editor/favicon.ico similarity index 100% rename from public/favicon.ico rename to editor/favicon.ico diff --git a/public/icons/alert.png b/editor/icons/alert.png similarity index 100% rename from public/icons/alert.png rename to editor/icons/alert.png diff --git a/public/icons/arduino.png b/editor/icons/arduino.png similarity index 100% rename from public/icons/arduino.png rename to editor/icons/arduino.png diff --git a/public/icons/arrow-in.png b/editor/icons/arrow-in.png similarity index 100% rename from public/icons/arrow-in.png rename to editor/icons/arrow-in.png diff --git a/public/icons/bluetooth.png b/editor/icons/bluetooth.png similarity index 100% rename from public/icons/bluetooth.png rename to editor/icons/bluetooth.png diff --git a/public/icons/bridge-dash.png b/editor/icons/bridge-dash.png similarity index 100% rename from public/icons/bridge-dash.png rename to editor/icons/bridge-dash.png diff --git a/public/icons/bridge.png b/editor/icons/bridge.png similarity index 100% rename from public/icons/bridge.png rename to editor/icons/bridge.png diff --git a/public/icons/comment.png b/editor/icons/comment.png similarity index 100% rename from public/icons/comment.png rename to editor/icons/comment.png diff --git a/public/icons/db.png b/editor/icons/db.png similarity index 100% rename from public/icons/db.png rename to editor/icons/db.png diff --git a/public/icons/debug.png b/editor/icons/debug.png similarity index 100% rename from public/icons/debug.png rename to editor/icons/debug.png diff --git a/public/icons/envelope.png b/editor/icons/envelope.png similarity index 100% rename from public/icons/envelope.png rename to editor/icons/envelope.png diff --git a/public/icons/feed.png b/editor/icons/feed.png similarity index 100% rename from public/icons/feed.png rename to editor/icons/feed.png diff --git a/public/icons/file.png b/editor/icons/file.png similarity index 100% rename from public/icons/file.png rename to editor/icons/file.png diff --git a/public/icons/function.png b/editor/icons/function.png similarity index 100% rename from public/icons/function.png rename to editor/icons/function.png diff --git a/public/icons/hash.png b/editor/icons/hash.png similarity index 100% rename from public/icons/hash.png rename to editor/icons/hash.png diff --git a/public/icons/inject.png b/editor/icons/inject.png similarity index 100% rename from public/icons/inject.png rename to editor/icons/inject.png diff --git a/public/icons/leveldb.png b/editor/icons/leveldb.png similarity index 100% rename from public/icons/leveldb.png rename to editor/icons/leveldb.png diff --git a/public/icons/light.png b/editor/icons/light.png similarity index 100% rename from public/icons/light.png rename to editor/icons/light.png diff --git a/public/icons/mongodb.png b/editor/icons/mongodb.png similarity index 100% rename from public/icons/mongodb.png rename to editor/icons/mongodb.png diff --git a/public/icons/mouse.png b/editor/icons/mouse.png similarity index 100% rename from public/icons/mouse.png rename to editor/icons/mouse.png diff --git a/public/icons/node-changed.png b/editor/icons/node-changed.png similarity index 100% rename from public/icons/node-changed.png rename to editor/icons/node-changed.png diff --git a/public/icons/node-error.png b/editor/icons/node-error.png similarity index 100% rename from public/icons/node-error.png rename to editor/icons/node-error.png diff --git a/public/icons/range.png b/editor/icons/range.png similarity index 100% rename from public/icons/range.png rename to editor/icons/range.png diff --git a/public/icons/redis.png b/editor/icons/redis.png similarity index 100% rename from public/icons/redis.png rename to editor/icons/redis.png diff --git a/public/icons/rpi.png b/editor/icons/rpi.png similarity index 100% rename from public/icons/rpi.png rename to editor/icons/rpi.png diff --git a/public/icons/serial.png b/editor/icons/serial.png similarity index 100% rename from public/icons/serial.png rename to editor/icons/serial.png diff --git a/public/icons/subflow.png b/editor/icons/subflow.png similarity index 100% rename from public/icons/subflow.png rename to editor/icons/subflow.png diff --git a/public/icons/swap.png b/editor/icons/swap.png similarity index 100% rename from public/icons/swap.png rename to editor/icons/swap.png diff --git a/public/icons/switch.png b/editor/icons/switch.png similarity index 100% rename from public/icons/switch.png rename to editor/icons/switch.png diff --git a/public/icons/template.png b/editor/icons/template.png similarity index 100% rename from public/icons/template.png rename to editor/icons/template.png diff --git a/public/icons/timer.png b/editor/icons/timer.png similarity index 100% rename from public/icons/timer.png rename to editor/icons/timer.png diff --git a/public/icons/trigger.png b/editor/icons/trigger.png similarity index 100% rename from public/icons/trigger.png rename to editor/icons/trigger.png diff --git a/public/icons/twitter.png b/editor/icons/twitter.png similarity index 100% rename from public/icons/twitter.png rename to editor/icons/twitter.png diff --git a/public/icons/watch.png b/editor/icons/watch.png similarity index 100% rename from public/icons/watch.png rename to editor/icons/watch.png diff --git a/public/icons/white-globe.png b/editor/icons/white-globe.png similarity index 100% rename from public/icons/white-globe.png rename to editor/icons/white-globe.png diff --git a/public/images/deploy-flows-o.png b/editor/images/deploy-flows-o.png similarity index 100% rename from public/images/deploy-flows-o.png rename to editor/images/deploy-flows-o.png diff --git a/public/images/deploy-flows.png b/editor/images/deploy-flows.png similarity index 100% rename from public/images/deploy-flows.png rename to editor/images/deploy-flows.png diff --git a/public/images/deploy-full-o.png b/editor/images/deploy-full-o.png similarity index 100% rename from public/images/deploy-full-o.png rename to editor/images/deploy-full-o.png diff --git a/public/images/deploy-full.png b/editor/images/deploy-full.png similarity index 100% rename from public/images/deploy-full.png rename to editor/images/deploy-full.png diff --git a/public/images/deploy-nodes-o.png b/editor/images/deploy-nodes-o.png similarity index 100% rename from public/images/deploy-nodes-o.png rename to editor/images/deploy-nodes-o.png diff --git a/public/images/deploy-nodes.png b/editor/images/deploy-nodes.png similarity index 100% rename from public/images/deploy-nodes.png rename to editor/images/deploy-nodes.png diff --git a/public/grip.png b/editor/images/grip.png similarity index 100% rename from public/grip.png rename to editor/images/grip.png diff --git a/public/node-red-256.png b/editor/images/node-red-256.png similarity index 100% rename from public/node-red-256.png rename to editor/images/node-red-256.png diff --git a/public/node-red.png b/editor/images/node-red.png similarity index 100% rename from public/node-red.png rename to editor/images/node-red.png diff --git a/public/pw_maze_white.png b/editor/images/pw_maze_white.png similarity index 100% rename from public/pw_maze_white.png rename to editor/images/pw_maze_white.png diff --git a/public/spin.svg b/editor/images/spin.svg similarity index 100% rename from public/spin.svg rename to editor/images/spin.svg diff --git a/public/index.html b/editor/index.html similarity index 78% rename from public/index.html rename to editor/index.html index b928e6a6f..ba1dbeee3 100644 --- a/public/index.html +++ b/editor/index.html @@ -4,7 +4,6 @@ - Node-RED - - - - - + + + + +