js: Migrate Grunt from 0.3 to 0.4

This commit is contained in:
Stein Magnus Jodal 2013-03-12 23:28:54 +01:00
parent 71e25e751d
commit 51b782e926
5 changed files with 103 additions and 101 deletions

83
js/Gruntfile.js Normal file
View File

@ -0,0 +1,83 @@
/*global module:false*/
module.exports = function (grunt) {
grunt.initConfig({
meta: {
banner: "/*! Mopidy.js - built " +
"<%= grunt.template.today('yyyy-mm-dd') %>\n" +
" * http://www.mopidy.com/\n" +
" * Copyright (c) <%= grunt.template.today('yyyy') %> " +
"Stein Magnus Jodal and contributors\n" +
" * Licensed under the Apache License, Version 2.0 */\n",
files: {
own: ["Gruntfile.js", "src/**/*.js", "test/**/*-test.js"],
concat: "../mopidy/frontends/http/data/mopidy.js",
minified: "../mopidy/frontends/http/data/mopidy.min.js"
}
},
buster: {
test: {
config: "buster.js"
}
},
concat: {
options: {
banner: "<%= meta.banner %>",
stripBanners: true
},
all: {
files: {
"<%= meta.files.concat %>": [
"lib/bane-*.js",
"lib/when-*.js",
"src/mopidy.js"
]
}
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
indent: 4,
latedef: true,
newcap: true,
noarg: true,
sub: true,
quotmark: "double",
undef: true,
unused: true,
eqnull: true,
browser: true,
devel: true,
globals: {}
},
files: "<%= meta.files.own %>"
},
uglify: {
options: {
banner: "<%= meta.banner %>"
},
all: {
files: {
"<%= meta.files.minified %>": ["<%= meta.files.concat %>"]
}
}
},
watch: {
files: "<%= meta.files.own %>",
tasks: ["default"]
}
});
grunt.registerTask("test", ["jshint", "buster"]);
grunt.registerTask("build", ["test", "concat", "uglify"]);
grunt.registerTask("default", ["build"]);
grunt.loadNpmTasks("grunt-buster");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-watch");
};

View File

@ -1,72 +0,0 @@
/*global module:false*/
module.exports = function (grunt) {
grunt.initConfig({
meta: {
banner: "/*! Mopidy.js - built " +
"<%= grunt.template.today('yyyy-mm-dd') %>\n" +
" * http://www.mopidy.com/\n" +
" * Copyright (c) <%= grunt.template.today('yyyy') %> " +
"Stein Magnus Jodal and contributors\n" +
" * Licensed under the Apache License, Version 2.0 */"
},
dirs: {
dest: "../mopidy/frontends/http/data"
},
lint: {
files: ["grunt.js", "src/**/*.js", "test/**/*-test.js"]
},
buster: {
test: {
config: "buster.js"
}
},
concat: {
dist: {
src: [
"<banner:meta.banner>",
"lib/bane-*.js",
"lib/when-*.js",
"src/mopidy.js"
],
dest: "<%= dirs.dest %>/mopidy.js"
}
},
min: {
dist: {
src: ["<banner:meta.banner>", "<config:concat.dist.dest>"],
dest: "<%= dirs.dest %>/mopidy.min.js"
}
},
watch: {
files: "<config:lint.files>",
tasks: "lint buster concat min"
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
indent: 4,
latedef: true,
newcap: true,
noarg: true,
sub: true,
quotmark: "double",
undef: true,
unused: true,
eqnull: true,
browser: true,
devel: true
},
globals: {}
},
uglify: {}
});
grunt.registerTask("test", "lint buster");
grunt.registerTask("build", "lint buster concat min");
grunt.registerTask("default", "build");
grunt.loadNpmTasks("grunt-buster");
};

View File

@ -1,15 +1,19 @@
{
"name": "mopidy",
"version": "0.0.0",
"devDependencies": {
"buster": "*",
"grunt": "*",
"grunt-buster": "*",
"phantomjs": "*"
},
"scripts": {
"test": "grunt test",
"build": "grunt build",
"watch": "grunt watch"
}
"name": "mopidy",
"version": "0.0.0",
"devDependencies": {
"buster": "~0.6.12",
"grunt": "~0.4.0",
"grunt-buster": "~0.1.2",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-uglify": "~0.1.2",
"grunt-contrib-watch": "~0.3.1",
"phantomjs": "~1.8.2"
},
"scripts": {
"test": "grunt test",
"build": "grunt build",
"watch": "grunt watch"
}
}

View File

@ -1,16 +1,7 @@
/*! Mopidy.js - built 2013-01-16
/*! Mopidy.js - built 2013-03-12
* http://www.mopidy.com/
* Copyright (c) 2013 Stein Magnus Jodal and contributors
* Licensed under the Apache License, Version 2.0 */
/**
* BANE - Browser globals, AMD and Node Events
*
* https://github.com/busterjs/bane
*
* @version 0.4.0
*/
((typeof define === "function" && define.amd && function (m) { define(m); }) ||
(typeof module === "object" && function (m) { module.exports = m(); }) ||
function (m) { this.bane = m(); }
@ -175,8 +166,6 @@
return { createEventEmitter: createEventEmitter };
});
/** @license MIT License (c) copyright B Cavalier & J Hann */
/**
* A lightweight CommonJS Promises/A and when() implementation
* when is part of the cujo.js family of libraries (http://cujojs.com/)
@ -907,8 +896,6 @@ define(['module'], function () {
// Boilerplate for AMD, Node, and browser global
);
/*global bane:false, when:false*/
function Mopidy(settings) {
if (!(this instanceof Mopidy)) {
return new Mopidy(settings);

File diff suppressed because one or more lines are too long