Skip to content

Commit

Permalink
Add scripts for building and linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
crertel committed May 31, 2016
1 parent 3624e22 commit a784640
Show file tree
Hide file tree
Showing 10 changed files with 438 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ node_modules

# Optional REPL history
.node_repl_history

# ignore vim droppings
*.swp

# ignore sublime text droppings
*.sublime-project
*.sublime-workspace
8 changes: 8 additions & 0 deletions SwarmControlRedux.sublime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders":
[
{
"path": "/home/crertel/work/SwarmControlRedux"
}
]
}
141 changes: 141 additions & 0 deletions SwarmControlRedux.sublime-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"auto_complete":
{
"selected_items":
[
]
},
"buffers":
[
],
"build_system": "",
"command_palette":
{
"height": 0.0,
"selected_items":
[
],
"width": 0.0
},
"console":
{
"height": 0.0
},
"distraction_free":
{
"menu_visible": true,
"show_minimap": false,
"show_open_files": false,
"show_tabs": false,
"side_bar_visible": false,
"status_bar_visible": false
},
"file_history":
[
"/home/crertel/projects/phoenix/phoenix-lobster/web/router.ex",
"/home/crertel/projects/phoenix/phoenix-lobster/web/views/story_view.ex",
"/home/crertel/projects/phoenix/phoenix-lobster/web/controllers/story_controller.ex",
"/home/crertel/projects/phoenix/phoenix-lobster/test/controllers/story_controller/index_test.exs",
"/home/crertel/.config/sublime-text-2/Packages/User/Preferences.sublime-settings",
"/home/crertel/projects/mic-sad-2/letter.md",
"/home/crertel/projects/scicomp-book-chapter/chapter.md"
],
"find":
{
"height": 41.0
},
"find_in_files":
{
"height": 0.0,
"where_history":
[
]
},
"find_state":
{
"case_sensitive": false,
"find_history":
[
"OWF",
"status"
],
"highlight": true,
"in_selection": false,
"preserve_case": false,
"regex": false,
"replace_history":
[
],
"reverse": false,
"show_context": true,
"use_buffer2": true,
"whole_word": false,
"wrap": true
},
"groups":
[
{
"sheets":
[
]
}
],
"incremental_find":
{
"height": 0.0
},
"input":
{
"height": 41.0
},
"layout":
{
"cells":
[
[
0,
0,
1,
1
]
],
"cols":
[
0.0,
1.0
],
"rows":
[
0.0,
1.0
]
},
"menu_visible": true,
"replace":
{
"height": 0.0
},
"save_all_on_build": true,
"select_file":
{
"height": 0.0,
"selected_items":
[
],
"width": 0.0
},
"select_project":
{
"height": 0.0,
"selected_items":
[
],
"width": 0.0
},
"show_minimap": true,
"show_open_files": false,
"show_tabs": true,
"side_bar_visible": true,
"side_bar_width": 150.0,
"status_bar_visible": true
}
92 changes: 92 additions & 0 deletions client.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details

"maxerr" : 50, // {int} Maximum error before stopping

// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : true, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"indent" : 4, // {int} Number of spaces to use for indentation
"latedef" : true, // true: Require variables/functions to be defined before being used
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"noempty" : true, // true: Prohibit use of empty blocks
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
"nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
"plusplus" : false, // true: Prohibit use of `++` & `--`
"quotmark" : "single", // Quotation mark consistency:
// false : do nothing (default)
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : "strict", // Unused variables:
// true : all variables, last function parameter
// "vars" : all variables only
// "strict" : all variables, all function parameters
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
"maxparams" : false, // {int} Max number of formal params allowed per function
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
"maxstatements" : false, // {int} Max number statements per function
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
"maxlen" : false, // {int} Max number of characters per line

// Relaxing
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
"boss" : false, // true: Tolerate assignments where comparisons would be expected
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
"eqnull" : false, // true: Tolerate use of `== null`
"es5" : true, // true: Allow ES5 syntax (ex: getters and setters)
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// (ex: `for each`, multiple try/catch, function expression…)
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope" : false, // true: Tolerate defining variables inside control statements
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
"iterator" : false, // true: Tolerate using the `__iterator__` property
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
"laxcomma" : false, // true: Tolerate comma-first style coding
"loopfunc" : false, // true: Tolerate functions being defined in loops
"multistr" : false, // true: Tolerate multi-line strings
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
"notypeof" : false, // true: Tolerate invalid typeof operator values
"proto" : false, // true: Tolerate using the `__proto__` property
"scripturl" : false, // true: Tolerate script-targeted URLs
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
"validthis" : false, // true: Tolerate using this in a non-constructor function

// Environments
"browser" : true, // Web Browser (window, document, etc)
"browserify" : false, // Browserify (node.js code in the browser)
"couch" : false, // CouchDB
"devel" : true, // Development/debugging (alert, confirm, etc)
"dojo" : false, // Dojo Toolkit
"jasmine" : false, // Jasmine
"jquery" : false, // jQuery
"mocha" : true, // Mocha
"mootools" : false, // MooTools
"node" : false, // Node.js
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
"phantom" : false, // PhantomJS
"prototypejs" : false, // Prototype and Scriptaculous
"qunit" : false, // QUnit
"rhino" : false, // Rhino
"shelljs" : false, // ShellJS
"typed" : false, // Globals for typed array constructions
"worker" : false, // Web Workers
"wsh" : false, // Windows Scripting Host
"yui" : false, // Yahoo User Interface

// Custom Globals
"globals" : {} // additional predefined global variables
}
Empty file added client/.gitkeep
Empty file.
60 changes: 60 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
del = require('del');

gulp.task('build:styles', function() {
return gulp.src('styles/**/*.css')
.pipe(concat('main.css'))
.pipe(gulp.dest('static/css'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/css'))
.pipe(notify({ message: 'Built styles.'}));
});

gulp.task('lint:client', function() {
return gulp.src('client/**/*.js')
.pipe(jshint('client.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});

gulp.task('build:client', function() {
return gulp.src('client/**/*.js')
.pipe(concat('main-client.js'))
.pipe(gulp.dest('static/js'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/js'))
.pipe(notify({ message: 'Built client scripts.' }));
});

gulp.task('lint:server', function() {
return gulp.src('server/**/*.js')
.pipe(jshint('server.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});

gulp.task('build:server', function() {
return gulp.src('server/**/*.js')
.pipe(concat('main-server.js'))
.pipe(gulp.dest('static/js'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/js'))
.pipe(notify({ message: 'Built server scripts.' }));
});

gulp.task('clean', function(cb) {
return del(['static/css', 'static/js'], cb);
});

gulp.task('lint', function() {
return gulp.start('lint:client', 'lint:server');
});

gulp.task('default', ['clean'], function() {
return gulp.start('build:styles', 'lint:client', 'lint:server', 'build:client', 'build:server');
});
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "swarm-control-redux",
"version": "1.0.0",
"description": "This is the Node rewrite of swarmcontrol.net",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "gulp lint",
"build": "gulp default",
"clean": "gulp clean",
"start": "nodejs src/server/server.js",
"build:server": "gulp scripts-server",
"build:client": "gulp scripts-client"
},
"repository": {
"type": "git",
"url": "https://github.com/RoboticSwarmControl/SwarmControlRedux.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/RoboticSwarmControl/SwarmControlRedux/issues"
},
"homepage": "https://github.com/RoboticSwarmControl/SwarmControlRedux",
"dependencies": {
"del": "^2.2.0",
"express": "^4.13.3",
"gulp": "^3.9.0",
"gulp-cache": "^0.4.1",
"gulp-concat": "^2.6.0",
"gulp-jshint": "^2.0.0",
"gulp-notify": "^2.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.1.1",
"jshint": "^2.8.0",
"node-sass": "^3.4.2"
}
}
Loading

0 comments on commit a784640

Please sign in to comment.