Ajout exercices supplémentaires formation JS

This commit is contained in:
2015-04-01 22:05:05 +02:00
parent 9a2452b334
commit b00c6dd3f4
3012 changed files with 363655 additions and 126 deletions

View File

@ -0,0 +1,6 @@
#!/usr/bin/env node
var shjs = require("shelljs");
var url = "https://github.com/jshint/jshint/pull/" + process.argv[2] + ".diff";
shjs.exec('curl "' + url + '" | git apply');

View File

@ -0,0 +1,38 @@
#!/usr/bin/env node
/*jshint shelljs:true */
"use strict";
var browserify = require("browserify");
var bundle = browserify();
var path = require("path");
var version = require("../package.json").version;
require("shelljs/make");
var distDir = path.join(__dirname, "../dist");
var srcDir = path.join(__dirname, "../src");
if (!test("-e", distDir))
mkdir(distDir);
bundle.require(srcDir + "/jshint.js", { expose: "jshint" });
bundle.bundle(function (err, src) {
var web = distDir + "/jshint.js";
var rhino = distDir + "/jshint-rhino.js";
[ "/*! " + version + " */",
"var JSHINT;",
"if (typeof window === 'undefined') window = {};",
"(function () {",
"var require;",
src,
"JSHINT = require('jshint').JSHINT;",
"if (typeof exports === 'object' && exports) exports.JSHINT = JSHINT;",
"}());"
].join("\n").to(web);
("#!/usr/bin/env rhino\nvar window = {};\n" + cat(web, srcDir + "/platforms/rhino.js")).to(rhino);
chmod("+x", rhino);
echo("Built: " + version);
});

View File

@ -0,0 +1,39 @@
#!/usr/bin/env node
/*jshint shelljs:true, lastsemic:true, -W101*/
"use strict";
var version = require("../package.json").version;
require("shelljs/make");
exec("git log --format='%H|%h|%an|%s' " + version + "..HEAD", { silent: true }, function (code, output) {
if (code !== 0)
return void console.log("git log return code is non-zero");
var commits = output.split("\n")
.filter(function (cmt) { return cmt.trim() !== ""; })
.map(function (cmt) { return cmt.split("|"); });
var html = "";
var authors = {};
commits.forEach(function (cmt) {
if (cmt[3].indexOf("Merge") === 0) {
return;
}
var tr = "";
tr += "<td class='commit'><a href='https://github.com/jshint/jshint/commit/" + cmt[0] + "'>" + cmt[1] + "</a></td>";
tr += "<td class='desc'>" + cmt[3].replace(/(#(\d+))/, "<a href='https://github.com/jshint/jshint/issues/$2/'>$1</a>") + "</td>";
html += "<tr>" + tr + "</tr>\n";
if (cmt[2] !== "Anton Kovalyov")
authors[cmt[2]] = true;
});
echo("<!-- auto-generated -->");
echo("<table class='changelog'>\n" + html + "</table>\n");
if (Object.keys(authors).length) {
echo("<p class='thx'><strong>Thanks</strong> to " + Object.keys(authors).join(", ") + " for sending patches!</p>");
}
});

View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require("../src/cli.js").interpret(process.argv);

View File

@ -0,0 +1,36 @@
#!/usr/bin/env node
"use strict";
var url = "https://github.com/jshint/jshint/pull/" + process.argv[2] + ".patch";
var https = require("https");
var shjs = require("shelljs");
var opts = require("url").parse(url);
var msg = process.argv[3];
opts.rejectUnauthorized = false;
opts.agent = new https.Agent(opts);
https.get(opts, succ).on("error", err);
function succ(res) {
if (res.statusCode !== 200)
return void console.log("error:", res.statusCode);
var data = "";
res.on("data", function (chunk) {
data += chunk.toString();
});
res.on("end", function () {
data = data.split("\n");
data = data[1].replace(/^From\:\s/, "");
data = data.replace(/"/g, "");
shjs.exec("git commit -s --author=\"" + data + "\" --message=\"" + msg + "\"");
});
}
function err(res) {
console.log("error:", res.message);
}