Move to grunt for building all distribution files.

* canonical version number of jasmine-core is now is package.json
* `grunt buildDistribution` builds jasmine.js, jasmine-html.js, jasmine.css and outputs them to the dist dir
* `grunt buildStandaloneDist` builds the example spec runner files and compresses them to dist/jasmine-VERSION.zip
* `grunt compass` compiles jasmine.css
* jasmine.Env handling of version is backwards compatible, but uses the version string directly (and nicely deprecated)
* Ruby/thor tasks that did the above deleted
This commit is contained in:
Dan Hansen and Davis W. Frank
2013-03-01 16:13:45 -08:00
parent 6eecc562ff
commit e09fd40933
31 changed files with 622 additions and 1113 deletions
+10
View File
@@ -0,0 +1,10 @@
module.exports = {
jasmine: {
options: {
cssDir: 'src/html',
sassDir: 'src/html',
outputStyle: 'compact',
lineComments: false
}
}
};
+57
View File
@@ -0,0 +1,57 @@
var standaloneLibDir = "lib/jasmine-" + jasmineVersion;
function root(path) { return "./" + path; }
function lib(path) { return root("lib/jasmine-core/" + path); }
function dist(path) { return root("dist/" + path); }
module.exports = {
standalone: {
options: {
archive: root("dist/jasmine-standalone-" + global.jasmineVersion + ".zip")
},
files: [
{ src: [ root("MIT.LICENSE") ] },
{
src: [ "jasmine_favicon.png"],
dest: standaloneLibDir,
expand: true,
cwd: root("images")
},
{
src: [
"jasmine.js",
"jasmine-html.js",
"jasmine.css"
],
dest: standaloneLibDir,
expand: true,
cwd: lib("")
},
{
src: [ "boot.js"],
dest: standaloneLibDir,
expand: true,
cwd: lib("boot")
},
{
src: [ "SpecRunner.html" ],
dest: root(""),
expand: true,
cwd: dist("tmp")
},
{
src: [ "*.js" ],
dest: "src",
expand: true,
cwd: lib("example/src/")
},
{
src: [ "*.js" ],
dest: "spec",
expand: true,
cwd: lib("example/spec/")
}
]
}
};
+33
View File
@@ -0,0 +1,33 @@
module.exports = {
'jasmine-html': {
src: [
'src/html/HtmlReporter.js',
'src/html/HtmlSpecFilter.js',
'src/html/ResultsNode.js',
'src/html/QueryString.js'
],
dest: 'lib/jasmine-core/jasmine-html.js'
},
jasmine: {
src: [
'src/core/base.js',
'src/core/util.js',
'src/core/Spec.js',
'src/core/Env.js',
'src/core/JsApiReporter.js',
'src/core/Matchers',
'src/core/PrettyPrinter',
'src/core/Suite',
'src/core/**/*.js',
'src/version.js'
],
dest: 'lib/jasmine-core/jasmine.js'
},
options: {
process: {
data: {
version: global.jasmineVersion
}
}
}
};
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
beforeConcat: ['src/**/*.js'],
afterConcat: [
'lib/jasmine-core/jasmine-html.js',
'lib/jasmine-core/jasmine.js'
],
options: {
/* While it's possible that we could be considering unwanted prototype methods, mostly
* we're doing this because the objects are being used as maps.
*/
forin: false,
/* We're fine with functions defined inside loops (setTimeout functions, etc) */
loopfunc: true
},
all: ['src/**/*.js']
};
+37
View File
@@ -0,0 +1,37 @@
var _ = require("underscore");
module.exports = function(grunt) {
return {
registerTasks: function() {
grunt.registerTask("build:compileSpecRunner",
"Processes the spec runner template and writes to a tmp file",
this.compileSpecRunner
);
grunt.registerTask("build:cleanSpecRunner",
"Deletes the tmp spec runner file",
this.cleanSpecRunner
);
grunt.registerTask("buildStandaloneDist",
"Builds a standalone distribution",
["build:compileSpecRunner", "compress:standalone", "build:cleanSpecRunner"]
);
},
compileSpecRunner: function() {
var runnerTemplate = _.template(grunt.file.read("lib/templates/SpecRunner.html.jst")),
runner = runnerTemplate({ jasmineVersion: global.jasmineVersion });
grunt.file.write(standaloneTmpDir("SpecRunner.html"), runner);
},
cleanSpecRunner: function() {
grunt.file.delete(standaloneTmpDir(""));
}
};
function standaloneTmpDir(path) {
return "dist/tmp/" + path;
}
};