Skip to content

Commit ca47f1d

Browse files
committed
Merge pull request #1 from bitovi/master
d
2 parents 098d63f + ce0280b commit ca47f1d

File tree

117 files changed

+872
-3174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+872
-3174
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
docs/*
12
.tmp*
23
cookbook*
34
site/docs/*

.gitmodules

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
[submodule "can"]
22
path = can
33
url = git://github.com/bitovi/canjs.git
4-
[submodule "canui"]
5-
path = canui
6-
url = git://github.com/bitovi/canui.git
7-
[submodule "jquery"]
8-
path = jquery
9-
url = git://github.com/bitovi/jquerypp.git
104
[submodule "steal"]
115
path = steal
126
url = git://github.com/bitovi/steal.git
@@ -16,3 +10,9 @@
1610
[submodule "documentjs"]
1711
path = documentjs
1812
url = git://github.com/bitovi/documentjs.git
13+
[submodule "jquerypp"]
14+
path = jquerypp
15+
url = https://github.com/bitovi/jquerypp.git
16+
[submodule "jmvc"]
17+
path = jmvc
18+
url = git://github.com/bitovi/jmvc-generators

Gruntfile.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = function (grunt) {
2+
3+
grunt.loadNpmTasks('grunt-contrib-connect');
4+
5+
grunt.initConfig({
6+
connect: {
7+
server: {
8+
options: {
9+
port: 8000,
10+
base: '.',
11+
keepalive: true
12+
}
13+
}
14+
}
15+
})
16+
17+
grunt.registerTask("server", "connect:server")
18+
};

build/changelog.ejs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__<%= version %>__ ( <%= date.toDateString().substring(4) %> )
2+
<% for(var i = 0; i < issues.length; i++) { %>
3+
- change: [<%= issues[i].title %>](<%= issues[i].url %>)<% } %>
4+

build/tasks/bannerize.js

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
var path = require('path');
22

3-
// A grunt task that strips multiline comments
3+
// A grunt task that writes the banner to every file
44
module.exports = function (grunt) {
55
grunt.registerMultiTask('bannerize', 'Adds the banner to a set of files', function () {
6-
var _ = grunt.utils._;
76
var options = grunt.config.process(['bannerize', this.target]);
8-
var banner = grunt.helper('banner');
9-
var defaults = _.extend({ exclude : [] }, grunt.config('strip')._options);
10-
grunt.file.expandFiles(this.file.src).forEach(function (file) {
11-
for(var i = 0; i < defaults.exclude.length; i++) {
12-
if(defaults.exclude[i].test(file)) {
13-
return;
14-
}
15-
}
7+
var banner = this.data.banner;
8+
9+
grunt.file.expand(this.data.files).forEach(function (file) {
1610
var outFile = options.out ? path.join(options.out, path.basename(file)) : file;
17-
grunt.log.writeln('Adding banner to ' + file);
1811

19-
var code = grunt.helper('file_strip_banner', file, { block : true });
20-
grunt.file.write(outFile, banner + code);
12+
grunt.log.writeln('Adding banner to ' + file);
13+
grunt.file.write(outFile, banner + grunt.file.read(file));
2114
});
2215
});
2316
}

build/tasks/beautify.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (c) 2012 Camille Moncelier
66
* Licensed under the MIT license.
77
*/
8+
var beautifier = require('js-beautify');
89

910
module.exports = function (grunt) {
1011

@@ -18,8 +19,6 @@ module.exports = function (grunt) {
1819
};
1920

2021
grunt.registerMultiTask('beautify', 'Javascript beautifier', function () {
21-
var beautifier = require('node-beautify');
22-
2322
var options = null;
2423
var tmp = grunt.config(['beautifier', this.target, 'options']);
2524
if (typeof tmp === 'object') {
@@ -38,7 +37,13 @@ module.exports = function (grunt) {
3837

3938
// Beautify specified files.
4039
var excludes = grunt.config(['beautifier', this.target, 'exclude']);
41-
grunt.file.expandFiles(this.file.src).filter(function (file) {
40+
41+
grunt.file.expand(this.filesSrc).filter(function (file) {
42+
if(/\.min\./.test(file)) {
43+
grunt.log.writeln('Not beautifying ' + file);
44+
return false;
45+
}
46+
4247
for (var i = 0; i < excludes.length; i++) {
4348
if (excludes[i].test(file)) {
4449
grunt.log.writeln('Not beautifying ' + file);
@@ -48,7 +53,7 @@ module.exports = function (grunt) {
4853
return true;
4954
}).forEach(function (filepath) {
5055
grunt.log.writeln('Beautifying ' + filepath);
51-
var result = beautifier.beautifyJs(grunt.file.read(filepath), options);
56+
var result = beautifier(grunt.file.read(filepath), options);
5257
grunt.file.write(filepath, result);
5358
});
5459

build/tasks/build.js

+15-23
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,27 @@ module.exports = function( grunt ) {
55
grunt.registerMultiTask('build', 'Runs build files.', function() {
66
var done = this.async();
77
var target = this.target;
8-
var files = Array.isArray(this.file.src) ? this.file.src : [this.file.src];
9-
// TODO grunt.file.expandFiles(this.file.src);
10-
var series = files.map(function (file) {
11-
return function(callback) {
12-
var options = grunt.config.process(['build', target]);
13-
var args = [file, options.out || 'dist/', options.version || 'edge'];
14-
var libraries = Array.isArray(options.libraries) ? options.libraries : [];
158

16-
args.push.apply(args, libraries);
9+
var options = grunt.config.process(['build', target]);
10+
var args = [this.data.src, this.data.out || 'dist/', this.data.version || 'edge'];
11+
var libraries = Array.isArray(this.data.libraries) ? this.data.libraries : [];
1712

18-
grunt.verbose.writeflags(options, 'Options');
19-
grunt.log.writeln('Running ./js ' + args.join(' '));
13+
args.push.apply(args, libraries);
2014

21-
grunt.utils.exec({
22-
cmd : "./js",
23-
args : args,
24-
opts : {
25-
cwd: jsDir
26-
}
27-
}, function(error, result, code) {
28-
callback(error, result, code);
29-
});
15+
grunt.verbose.writeflags(this.data, 'Options');
16+
grunt.log.writeln('Running ./js ' + args.join(' '));
3017

31-
grunt.log.write("Building " + file + " with Steal...\n");
18+
grunt.util.spawn({
19+
cmd : "./js",
20+
args : args,
21+
opts : {
22+
cwd: jsDir
3223
}
33-
});
34-
grunt.utils.async.parallel(series, function(error, results) {
24+
}, function(error, result, code) {
3525
grunt.log.writeln('Done building');
3626
done();
37-
})
27+
});
28+
29+
grunt.log.write("Building " + this.data.src + " with Steal...\n");
3830
});
3931
};

build/tasks/changelog.js

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
var https = require('https'),
2+
querystring = require('querystring'),
3+
ejs = require('ejs');
4+
5+
module.exports = function(grunt) {
6+
7+
grunt.registerMultiTask('changelog', 'Updates changelog.md based on GitHub milestones', function() {
8+
var done = this.async(),
9+
10+
params = querystring.stringify({
11+
milestone: this.data.milestone,
12+
state: 'closed',
13+
per_page: 100
14+
}),
15+
16+
path = '/repos/' + this.data.user + '/' + this.data.repo + '/issues?' + params,
17+
18+
buffer = '',
19+
self = this;
20+
21+
var write = function() {
22+
var issues = JSON.parse(buffer),
23+
log = '';
24+
25+
if(grunt.file.exists('changelog.md')) {
26+
log = grunt.file.read('changelog.md');
27+
};
28+
29+
ejs.renderFile(__dirname + '/../changelog.ejs', {
30+
version: self.data.version,
31+
date: new Date(Date.now()),
32+
issues: issues
33+
}, function(e, template) {
34+
35+
if(e) {
36+
done(e);
37+
}
38+
39+
grunt.file.write('changelog.md', template + log);
40+
done();
41+
42+
});
43+
},
44+
45+
req = https.request({
46+
hostname: 'api.github.com',
47+
path: path
48+
}, function(res) {
49+
50+
res.on('data', function(data) {
51+
buffer += data;
52+
});
53+
54+
res.on('end', write);
55+
});
56+
57+
req.end();
58+
59+
req.on('error', function(e) {
60+
done(e);
61+
});
62+
63+
});
64+
65+
}

build/tasks/docco.js

+9-15
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,18 @@ var docco = require('docco');
55

66
module.exports = function(grunt) {
77
grunt.registerMultiTask('docco', 'Docco processor.', function() {
8-
var _ = grunt.utils._;
9-
var options = grunt.config.process(['docco', this.target]);
10-
var defaults = _.extend({
11-
exclude : [/\.min\./]
12-
}, grunt.config.process('docco')._options);
13-
grunt.verbose.writeflags(options, 'Options');
8+
var _ = grunt.util._;
149
var done = this.async();
15-
var src = grunt.file.expandFiles(this.file.src).filter(function(file) {
16-
for(var i = 0; i < defaults.exclude.length; i++) {
17-
if(defaults.exclude[i].test(file)) {
18-
return false;
19-
}
20-
}
21-
return true;
10+
var options = this.options();
11+
var src = grunt.file.expand(this.data.files).filter(function(file) {
12+
return !_.some(options.exclude, function(exclude) {
13+
return exclude.test(file);
14+
});
2215
});
2316

24-
docco.document(src, _.extend({}, defaults.docco, options.docco) || {}, function(err, result, code){
25-
grunt.log.writeln("Doccoed [" + src.join(", ") + "]; " + err ? err : "(No errors)" + "\n" + result + " " + code);
17+
docco.document( _.extend({ args: src }, this.data.docco, options.docco), function(err, result, code){
18+
grunt.log.writeln("Doccoed [" + src.join(", ") + "]; " +
19+
err ? err : "(No errors)" + "\n" + result + " " + code);
2620
done();
2721
});
2822
});

build/tasks/downloads.js

-103
This file was deleted.

0 commit comments

Comments
 (0)