Permalink
Browse files

Init

  • Loading branch information...
0 parents commit 5dc9de54dd6d2221b1acbf23a15e6f0a372e916a @sarahgp committed Jun 9, 2015
Showing 433 changed files with 94,858 additions and 0 deletions.
@@ -0,0 +1,2 @@
+.DS_Store
+node_modules
@@ -0,0 +1,20 @@
+{
+ "boss": true,
+ "curly": true,
+ "eqeqeq": true,
+ "eqnull": true,
+ "immed": true,
+ "latedef": "nofunc",
+ "newcap": false,
+ "noarg": true,
+ "quotmark": "single",
+ "trailing": true,
+ "undef": true,
+ "unused": "vars",
+
+ "node": true,
+
+ "trailing": true,
+ "curly": true,
+ "indent": 2
+}
@@ -0,0 +1,227 @@
+/**
+ * This is the Gruntfile for p5sensors.
+ * It is a modified version of the Gruntfile for p5.js. Grunt is a task
+ * runner/builder, used to build the source code into the library
+ * and handle other housekeeping tasks.
+ *
+ * There are three main tasks:
+ *
+ * grunt - This is the default task, which builds the code, tests it
+ * using both jslint and mocha, and then minifies it.
+ *
+ * grunt yui - This will build the inline documentation for p5.js.
+ *
+ * grunt test - This only runs the automated tests, which is faster than
+ * rebuilding entirely from source because it skips minification
+ * and concatination.
+ *
+ * And there are several secondary tasks:
+ *
+ *
+ * grunt watch - This watches the source for changes and rebuilds on
+ * every file change, running the linter and tests.
+ *
+ * grunt watch:main - This watches the source for changes and rebuilds on
+ * every file change, but does not rebuild the docs.
+ * It's faster than the default watch.
+ *
+ * grunt update_json - This automates updating the bower file
+ * to match the package.json
+ */
+
+/* global module:false */
+module.exports = function(grunt) {
+
+ // Specify what reporter we'd like to use for Mocha
+ var reporter = 'Nyan';
+
+ // For the static server used in running tests, configure the keepalive.
+ // (might not be useful at all.)
+ var keepalive = false;
+ if (grunt.option('keepalive')) {
+ keepalive = true;
+ }
+
+
+ grunt.initConfig({
+
+ // read in the package, used for knowing the current version, et al.
+ pkg: grunt.file.readJSON('package.json'),
+
+ // Configure hinting for this file, the source, and the tests.
+ jshint: {
+ build: {
+ options: {
+ jshintrc: '.jshintrc'
+ },
+ src: ['Gruntfile.js']
+ },
+ source: {
+ options: {
+ jshintrc: '.jshintrc',
+ ignores: [ 'src/external/**/*.js' ]
+ },
+ src: ['src/**/*.js']
+ },
+ test: {
+ options: {
+ jshintrc: 'test/.jshintrc'
+ },
+ src: ['test/unit/**/*.js']
+ }
+ },
+
+ // Set up the watch task, used for live-reloading during development.
+ // This watches both the codebase and the yuidoc theme. Changing the
+ // code touches files within the theme, so it will also recompile the
+ // documentation.
+ watch: {
+ // Watch the codebase for changes
+ main: {
+ files: ['src/**/*.js'],
+ tasks: ['newer:jshint:source','requirejs:sensors_unminified','mocha'],
+ options: {
+ livereload: true
+ }
+ },
+ // watch the theme for changes
+ reference_build: {
+ files: ['docs/yuidoc-p5-theme/**/*'],
+ tasks: ['yuidoc'],
+ options: {
+ livereload: true,
+ interrupt: true
+ }
+ },
+ // watch the yuidoc/reference theme scripts for changes
+ yuidoc_theme_build: {
+ files: ['docs/yuidoc-p5-theme-src/scripts/**/*'],
+ tasks: ['requirejs:yuidoc_theme']
+ },
+ // Watch the codebase for doc updates
+ yui:{
+ files:['src/**/*.js'],
+ task:['yuidoc']
+ }
+ },
+
+ // Set up the mocha task, used for running the automated tests.
+ mocha: {
+ test: {
+ src: ['test/**/*.html'],
+ options: {
+ reporter: reporter,
+ run: true,
+ log: true,
+ logErrors: true
+ }
+ },
+ },
+
+ // The actual compile step: This should collect all the dependencies
+ // and compile them into a single file.
+ requirejs: {
+ sensors_unminified: {
+ options: {
+ baseUrl: 'src', // from whence do the files come?
+ optimize: 'none', // skip running uglify on the concatenated code
+ out: 'lib/p5sensors.js', // name of the output file
+ useStrict: true, // Allow "use strict"; be included in the RequireJS files.
+ //findNestedDependencies: true, // automatically find nested deps. Doesn't appear to effect the code?
+ include: ['app'], // this is the file which we are actually building
+
+
+ // This is a list of all dependencies, mapped to their AMD identifier.
+ paths: {
+ // external library
+ 'reqwest': '../node_modules/reqwest/reqwest'
+ },
+ done: function(done, output) {
+ require('concat-files')([
+ 'lib/p5sensors.js',
+ ], 'lib/p5sensors.js', function() {
+ done();
+ });
+ }
+ }
+ },
+
+ // This generates the theme for the documentation from the theme source
+ // files.
+ yuidoc_theme: {
+ options: {
+ baseUrl: './docs/yuidoc-p5-theme-src/scripts/',
+ mainConfigFile: './docs/yuidoc-p5-theme-src/scripts/config.js',
+ name: 'main',
+ out: './docs/yuidoc-p5-theme/assets/js/reference.js',
+ optimize: 'none',
+ generateSourceMaps: true,
+ findNestedDependencies: true,
+ wrap: true,
+ paths: {
+ 'jquery': 'empty:'
+ }
+ }
+ }
+ },
+
+ // this builds the documentation for the codebase.
+ yuidoc: {
+ compile: {
+ name: '<%= pkg.name %>',
+ description: '<%= pkg.description %>',
+ version: '<%= pkg.version %>',
+ url: '<%= pkg.homepage %>',
+ options: {
+ paths: ['src/', 'lib/addons/'],
+ themedir: 'docs/yuidoc-p5-theme/',
+ outdir: 'docs/reference/'
+ }
+ }
+ },
+ release: {
+ options: {
+ github: {
+ repo: 'processing/p5.js', //put your user/repo here
+ usernameVar: process.env.GITHUB_USERNAME, //ENVIRONMENT VARIABLE that contains Github username
+ passwordVar: process.env.GITHUB_PASSWORD //ENVIRONMENT VARIABLE that contains Github password
+ }
+ }
+ },
+ // This is a static server which is used when testing connectivity for the
+ // p5 library. This avoids needing an internet connection to run the tests.
+ // It serves all the files in the test directory at http://localhost:9001/
+ connect: {
+ server: {
+ options: {
+ base: './test',
+ port: 9001,
+ keepalive: keepalive,
+ middleware: function(connect, options, middlewares) {
+ middlewares.unshift(function(req, res, next) {
+ res.setHeader('Access-Control-Allow-Origin', '*');
+ res.setHeader('Access-Control-Allow-Methods', '*');
+ return next();
+ });
+ return middlewares;
+ }
+ }
+ }
+ }
+ });
+
+ // Load the external libraries used.
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-requirejs');
+ grunt.loadNpmTasks('grunt-mocha');
+ grunt.loadNpmTasks('grunt-contrib-yuidoc');
+ grunt.loadNpmTasks('grunt-update-json');
+ grunt.loadNpmTasks('grunt-contrib-connect');
+ grunt.loadNpmTasks('grunt-newer');
+
+ // Create the multitasks.
+ grunt.registerTask('test', ['connect', 'newer:jshint', 'requirejs', 'mocha']);
+ grunt.registerTask('yui', ['yuidoc']);
+ grunt.registerTask('default', ['connect', 'jshint', 'requirejs', 'mocha']);
+};
@@ -0,0 +1,2 @@
+# p5.sensors
+A work in progress. Someday will work to connect hardware with p5.js sketches.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 5dc9de5

Please sign in to comment.