MCPcopy
hub / github.com/ajaxorg/ace / demo

Function demo

Makefile.dryice.js:254–325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

252}
253
254function demo() {
255 console.log('# kitchen sink ---------');
256
257 var version = "", ref = "";
258 try {
259 version = JSON.parse(fs.readFileSync(ACE_HOME + "/package.json")).version;
260 ref = fs.readFileSync(ACE_HOME + "/.git-ref").toString();
261 } catch(e) {}
262
263 function changeComments(data) {
264 return (data
265 .replace("doc/site/images/ace-logo.png", "demo/kitchen-sink/ace-logo.png")
266 .replace(/<!\-\-DEVEL[\d\D]*?DEVEL\-\->/g, "")
267 .replace(/PACKAGE\-\->|<!\-\-PACKAGE/g, "")
268 .replace(/\/\*DEVEL[\d\D]*?DEVEL\*\//g, "")
269 .replace(/PACKAGE\*\/|\/\*PACKAGE/g, "")
270 .replace("%version%", version)
271 .replace("%commit%", ref)
272 );
273 }
274
275 require("rimraf").sync(BUILD_DIR + "/demo/kitchen-sink/docs/");
276 copy(ACE_HOME +"/demo/kitchen-sink/docs/", BUILD_DIR + "/demo/kitchen-sink/docs/");
277
278 copy.file(ACE_HOME + "/demo/kitchen-sink/logo.png", BUILD_DIR + "/demo/kitchen-sink/logo.png");
279 copy.file(ACE_HOME + "/demo/kitchen-sink/styles.css", BUILD_DIR + "/demo/kitchen-sink/styles.css");
280 copy.file(ACE_HOME + "/kitchen-sink.html", BUILD_DIR + "/kitchen-sink.html", changeComments);
281
282 buildSubmodule({}, {
283 require: ["kitchen-sink/demo"],
284 projectType: "demo"
285 }, BUILD_DIR + "/demo/kitchen-sink/demo");
286
287 copy(ACE_HOME + "/demo/", BUILD_DIR + "/demo/", {
288 shallow: true,
289 exclude: /\s|requirejs/,
290 include: /\.(js|html)$/,
291 replace: function(source) {
292 if (!/^\s*</.test(source))
293 return source;
294 var removeRequireJS;
295 source = source.replace(/<script src="kitchen-sink\/require.js"[\s\S]+?require\(\[([^\]]+).*/, function(e, m) {
296 removeRequireJS = true;
297 var scripts = m.split(/,\s*/);
298 var result = [];
299 function comment(str) {result.push("<!-- " + str + " -->");}
300 function script(str) {result.push('<script src="../src/' + str + '.js"></script>');}
301 scripts.forEach(function(s) {
302 s = s.replace(/"/g, "");
303 if (s == "ace/ace") {
304 comment("load ace");
305 script("ace");
306 } else {
307 var extName = s.match(/[^/]*$/)[0];
308 comment("load ace " + extName + " extension");
309 script("ext-" + extName);
310 }
311 });

Callers 1

mainFunction · 0.85

Calls 11

buildSubmoduleFunction · 0.85
scriptFunction · 0.85
splitMethod · 0.80
pushMethod · 0.80
commentFunction · 0.70
requireFunction · 0.50
copyFunction · 0.50
toStringMethod · 0.45
replaceMethod · 0.45
forEachMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…