blob: 6d349c0926fbae73b3d85bf43e58eb86afc8cd61 [file] [edit]
// Copyright 2015 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Gruntfile to describe and define grunt tasks.
*/
'use strict';
/**
* Method for driving the grunt actions.
*
* @param {grunt} grunt object for performing tasks.
*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jasmine: {
all: {
src: [
'./android_state_graph.js',
'./androidlog_summary.js',
'./log_helper.js',
'./log_summary.js',
'./manager.js',
'./netlog_summary.js',
'./network_event_log_summary.js',
'./process_log.js',
'./service.js',
'./state_graph.js',
'./syslog_summary.js',
'./wifi_state_machine.js'
],
options: {
'specs': 'test/spec/**/*.js'
}
}
}
});
// Load the plugin that provices jasmine testing.
grunt.loadNpmTasks('grunt-contrib-jasmine');
// Default task(s).
grunt.registerTask('test', ['jasmine:all']);
grunt.registerTask('copy', 'Copy node modules to lib dir', function() {
grunt.file.copy('./node_modules/d3/d3.min.js', './lib/d3.min.js');
let zipfiles = ['zip.js', 'z-worker.js', 'deflate.js', 'inflate.js']
for (let i = 0; i < zipfiles.length; i++) {
grunt.file.copy('./node_modules/zip-js/WebContent/' + zipfiles[i],
'./lib/' + zipfiles[i]);
}
});
grunt.registerTask('dist', 'Create distribution directory', function() {
let outDir = 'dist';
[
'android_state_graph.js',
'androidlog_summary.js',
'background.js',
'lib/d3.min.js',
'lib/inflate.js',
'lib/zip.js',
'listnr_content_script.js',
'log_helper.js',
'log_summary.js',
'manager.js',
'manifest.json',
'netlog_summary.js',
'network_event_log_summary.js',
'popup.js',
'process_log.js',
'service.js',
'service_states.html',
'service_summary.css',
'state_graph.js',
'syslog_summary.js',
'wifi_icon.png',
'wifi_state_machine.js',
].forEach(filename => {
grunt.file.copy(filename, outDir + '/' + filename);
});
});
grunt.registerTask('default', ['copy']);
};