2014-02-26 19:12:37 +00:00
|
|
|
module.exports = function (grunt) {
|
2014-03-04 23:41:54 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
2014-03-03 18:35:46 +00:00
|
|
|
grunt.loadNpmTasks('grunt-karma');
|
2014-02-26 19:12:37 +00:00
|
|
|
grunt.loadNpmTasks('grunt-typescript');
|
|
|
|
|
2014-03-04 22:51:55 +00:00
|
|
|
var sauceConf = {
|
|
|
|
linux: {opera: {low: 12, high: 12}, googlechrome: {low: 26, high: 32}, firefox: {low: 3, high: 27}},
|
|
|
|
"OS X 10.9": {googlechrome: {low: 31, high: 31}, firefox: {low: 4, high: 26}},
|
|
|
|
"OS X 10.8": {googlechrome: {low: 27, high: 32}, safari: {low: 6, high: 6}},
|
|
|
|
"OS X 10.6": {googlechrome: {low: 27, high: 32}, safari: {low: 5, high: 5}, firefox: {low: 3, high: 27}},
|
|
|
|
"Windows XP": {googlechrome: {low: 26, high: 32}, safari: {low: 3, high: 5}, opera: {low: 9, high: 12}, firefox: {low: 4, high: 27}},
|
|
|
|
"Windows 7": {googlechrome: {low: 26, high: 32}, safari: {low: 5, high: 5}, opera: {low: 9, high: 12}, firefox: {low: 4, high: 27}},
|
|
|
|
"Windows 8": {googlechrome: {low: 26, high: 32}, opera: {low: 9, high: 10}, firefox: {low: 4, high: 27}},
|
|
|
|
"Windows 8.1": {googlechrome: {low: 26, high: 32}, opera: {low: 9, high: 10}, firefox: {low: 4, high: 27}}
|
|
|
|
};
|
|
|
|
|
|
|
|
var sauceBrowsers = [];
|
|
|
|
for (var operatingSystem in sauceConf) {
|
|
|
|
for (var browser in sauceConf[operatingSystem]) {
|
|
|
|
for (var i = sauceConf[operatingSystem][browser].low; i < sauceConf[operatingSystem][browser].high; i++) {
|
|
|
|
sauceBrowsers.push((operatingSystem + "_" + browser + "_" + i).toLowerCase().replace(" ", "-"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//TODO integrate with Sauce
|
|
|
|
var travisBrowsers = [];//sauceBrowsers.slice(0);
|
|
|
|
travisBrowsers.push("PhantomJS");
|
|
|
|
|
2014-02-26 19:12:37 +00:00
|
|
|
grunt.initConfig({
|
2014-03-03 18:35:46 +00:00
|
|
|
karma: {
|
2014-03-04 22:51:55 +00:00
|
|
|
local: {
|
2014-03-03 18:35:46 +00:00
|
|
|
configFile: "karma.conf.js",
|
|
|
|
singleRun: true,
|
2014-03-04 22:51:55 +00:00
|
|
|
browsers: ["Chrome", "PhantomJS"]
|
2014-03-03 23:44:34 +00:00
|
|
|
},
|
2014-03-04 23:56:57 +00:00
|
|
|
"local-min": {
|
|
|
|
configFile: "karma.conf.js",
|
|
|
|
singleRun: true,
|
|
|
|
browsers: ["Chrome", "PhantomJS"]
|
|
|
|
},
|
2014-03-04 22:51:55 +00:00
|
|
|
travis: {
|
2014-03-03 23:44:34 +00:00
|
|
|
configFile: "karma.conf.js",
|
|
|
|
singleRun: true,
|
2014-03-04 22:51:55 +00:00
|
|
|
browsers: travisBrowsers
|
2014-03-03 21:08:37 +00:00
|
|
|
},
|
2014-03-04 23:56:57 +00:00
|
|
|
"travis-min": {
|
|
|
|
configFile: "karma.conf.min.js",
|
|
|
|
singleRun: true,
|
|
|
|
browsers: travisBrowsers
|
|
|
|
},
|
2014-03-03 21:08:37 +00:00
|
|
|
watch: {
|
2014-03-04 22:51:55 +00:00
|
|
|
autoWatch: true,
|
2014-03-03 21:08:37 +00:00
|
|
|
configFile: "karma.conf.js",
|
|
|
|
browsers: ["PhantomJS", "Chrome"]
|
2014-03-03 18:35:46 +00:00
|
|
|
}
|
|
|
|
},
|
2014-02-26 19:12:37 +00:00
|
|
|
typescript: {
|
|
|
|
base: {
|
|
|
|
src: ["lib/**/*.ts"],
|
|
|
|
dest: "build/typertext.js",
|
|
|
|
options: {
|
|
|
|
declaration: true,
|
|
|
|
"sourcemap": true
|
|
|
|
}
|
|
|
|
}
|
2014-03-04 23:41:54 +00:00
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
base: {
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapIncludeSources: true,
|
|
|
|
inSourceMap: "<%= typescript.base.dest%>.map",
|
|
|
|
sourceMapName: "build/typertext.min.js.map",
|
|
|
|
mangle: true,
|
|
|
|
beautify: false,
|
|
|
|
compress: true
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
'build/typertext.min.js': [
|
|
|
|
'<%= typescript.base.dest %>'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2014-02-26 19:12:37 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-02-26 19:37:56 +00:00
|
|
|
grunt.registerTask('default', ['typescript']);
|
2014-03-03 18:35:46 +00:00
|
|
|
|
2014-03-04 23:56:57 +00:00
|
|
|
grunt.registerTask('build', ['build:base']);
|
|
|
|
grunt.registerTask('build:base', ['typescript:base', 'uglify:base']);
|
2014-03-04 23:41:54 +00:00
|
|
|
|
2014-03-04 23:56:57 +00:00
|
|
|
grunt.registerTask('test', ['karma:local']);
|
|
|
|
grunt.registerTask('test:local', ['karma:local','karma:local']);
|
|
|
|
grunt.registerTask('test:travis', ['build:base', 'karma:travis', 'karma:travis-min']);
|
2014-02-26 19:12:37 +00:00
|
|
|
};
|