This repository has been archived by the owner on May 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
122 lines (111 loc) · 2.81 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
'use strict';
var http = require('http');
var fs = require('fs');
module.exports = function(grunt) {
// Default tasks
grunt.registerTask('default', [
'bower',
'jshint'
// 'concat',
// 'uglify'
]);
// Planet - TODO
grunt.registerTask('planet', [
'download:node_webkit'
]);
grunt.registerTask('nodeunit', [
'nodeunit'
]);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower: {
install: true
},
jshint: {
all: [
'Gruntfile.js',
'star/**/*.js'
]
},
// concat: {
// js: {
// src: [
// 'planet/vendor/jquery-2.0.3.min.js',
// 'node_modules/async/lib/async.js',
// 'bower_components/bootstrap/js/bootstrap.min.js',
// 'planet/vendor/webrtc-adapter.js'
// // 'planet/js/planetfs.js',
// // 'planet/js/net.js',
// // 'planet/js/main.js'
// ],
// dest: 'planet/build/concat.js'
// },
// css: {
// src: [
// 'bower_components/bootstrap/css/bootstrap.min.css',
// 'bower_components/bootstrap/css/bootstrap-responsive.min.css'
// ],
// dest: 'planet/build/concat.css'
// }
// },
// uglify: {
// options: {
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
// },
// planet_bundle: {
// files: {
// 'planet/build/concat.min.js': ['planet/build/concat.js']
// }
// }
// build: {
// src: 'planet/build/<%= pkg.name %>.js',
// dest: 'build/<%= pkg.name %>.min.js'
// }
// },
download: {
node_webkit: {
file: 'node-webkit-v0.6.3-linux-ia32.tar.gz',
url: 'http://s3.amazonaws.com/node-webkit/v0.6.3/node-webkit-v0.6.3-linux-ia32.tar.gz'
}
},
nodeunit: {
//1. To run all tests:
// grunt nodeunit:all
//2. To run specific test:
// grunt nodeunit:<test name>
all: ['star/**/*_test.js'],
auth: 'star/routes/auth_test.js',
email: 'star/routes/email_test.js',
inode_api_test: 'star/routes/inode_api_test.js',
user_inodes: 'star/providers/user_inodes_test.js',
},
});
// Load the plugins
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
// Define custom tasks
grunt.task.registerMultiTask('bower', 'Bower', function() {
// Force task into async mode and grab a handle to the "done" function.
var done = this.async();
grunt.util.spawn({
cmd: './node_modules/.bin/bower',
args: [this.target]
}, done);
});
grunt.task.registerMultiTask('download', 'Download', function() {
// Force task into async mode and grab a handle to the "done" function.
var done = this.async();
var file = fs.createWriteStream(this.data.file);
http.get(this.data.url, function(res) {
res.on('end', function() {
done();
});
res.pipe(file);
}).on('error', function(err) {
done(false);
});
});
};