ninjs 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. data/README.textile +86 -25
  2. data/lib/ninjs.rb +35 -0
  3. data/lib/ninjs/command.rb +146 -0
  4. data/lib/ninjs/configuration.rb +84 -0
  5. data/lib/ninjs/dependencies.rb +16 -0
  6. data/lib/ninjs/helpers.rb +16 -0
  7. data/lib/ninjs/manifest.rb +9 -0
  8. data/lib/ninjs/project.rb +253 -0
  9. data/ninjs.gemspec +115 -0
  10. data/repository/jquery/1.1.4.js +2508 -0
  11. data/repository/jquery/1.2.6.js +32 -0
  12. data/repository/jquery/1.3.2.js +19 -0
  13. data/repository/jquery/1.4.2.js +154 -0
  14. data/repository/jquery/1.4.3.js +166 -0
  15. data/repository/jquery/1.4.4.js +167 -0
  16. data/repository/jquery/fancybox/1.3.1.js +1079 -0
  17. data/repository/jquery/fancybox/assets/1.3.1/css/fancybox.css +363 -0
  18. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/blank.gif +0 -0
  19. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_close.png +0 -0
  20. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_loading.png +0 -0
  21. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_left.png +0 -0
  22. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_nav_right.png +0 -0
  23. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_e.png +0 -0
  24. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_n.png +0 -0
  25. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_ne.png +0 -0
  26. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_nw.png +0 -0
  27. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_s.png +0 -0
  28. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_se.png +0 -0
  29. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_sw.png +0 -0
  30. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_shadow_w.png +0 -0
  31. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_left.png +0 -0
  32. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_main.png +0 -0
  33. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_over.png +0 -0
  34. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancy_title_right.png +0 -0
  35. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-x.png +0 -0
  36. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox-y.png +0 -0
  37. data/repository/jquery/fancybox/assets/1.3.1/images/fancybox/fancybox.png +0 -0
  38. data/repository/jquery/fancybox/latest.js +1 -0
  39. data/repository/jquery/latest.js +1 -0
  40. data/repository/jquery/mousewheel/3.0.2.js +11 -0
  41. data/repository/jquery/mousewheel/latest.js +1 -0
  42. data/repository/json2.js +482 -0
  43. data/repository/modernizr/1.5.js +28 -0
  44. data/repository/modernizr/latest.js +1 -0
  45. data/repository/ninjs/core/existence.js +41 -0
  46. data/repository/ninjs/core/extend.js +22 -0
  47. data/repository/ninjs/core/nin.js +138 -0
  48. data/repository/ninjs/tests/index.html +21 -0
  49. data/repository/ninjs/tests/ninjs.test.js +109 -0
  50. data/repository/ninjs/tests/ninjs.utilities.test.js +149 -0
  51. data/repository/ninjs/utilities/all.js +4 -0
  52. data/repository/ninjs/utilities/array.js +34 -0
  53. data/repository/ninjs/utilities/css.js +51 -0
  54. data/repository/ninjs/utilities/number.js +11 -0
  55. data/repository/ninjs/utilities/string.js +66 -0
  56. data/repository/nullconsole.js +7 -0
  57. data/repository/qunit/assets/css/qunit.css +196 -0
  58. data/repository/qunit/qunit.js +1374 -0
  59. data/repository/selectivizr/1.0.js +5 -0
  60. data/repository/selectivizr/latest.js +1 -0
  61. data/repository/syntaxhighlighter/default.js +10 -0
  62. data/repository/syntaxhighlighter/shAutoloader.js +17 -0
  63. data/repository/syntaxhighlighter/shBrushAS3.js +59 -0
  64. data/repository/syntaxhighlighter/shBrushAppleScript.js +75 -0
  65. data/repository/syntaxhighlighter/shBrushBash.js +59 -0
  66. data/repository/syntaxhighlighter/shBrushCSharp.js +65 -0
  67. data/repository/syntaxhighlighter/shBrushColdFusion.js +100 -0
  68. data/repository/syntaxhighlighter/shBrushCpp.js +97 -0
  69. data/repository/syntaxhighlighter/shBrushCss.js +91 -0
  70. data/repository/syntaxhighlighter/shBrushDelphi.js +55 -0
  71. data/repository/syntaxhighlighter/shBrushDiff.js +41 -0
  72. data/repository/syntaxhighlighter/shBrushErlang.js +52 -0
  73. data/repository/syntaxhighlighter/shBrushGroovy.js +67 -0
  74. data/repository/syntaxhighlighter/shBrushJScript.js +52 -0
  75. data/repository/syntaxhighlighter/shBrushJava.js +57 -0
  76. data/repository/syntaxhighlighter/shBrushJavaFX.js +58 -0
  77. data/repository/syntaxhighlighter/shBrushPerl.js +72 -0
  78. data/repository/syntaxhighlighter/shBrushPhp.js +88 -0
  79. data/repository/syntaxhighlighter/shBrushPlain.js +33 -0
  80. data/repository/syntaxhighlighter/shBrushPowerShell.js +74 -0
  81. data/repository/syntaxhighlighter/shBrushPython.js +64 -0
  82. data/repository/syntaxhighlighter/shBrushRuby.js +55 -0
  83. data/repository/syntaxhighlighter/shBrushSass.js +94 -0
  84. data/repository/syntaxhighlighter/shBrushScala.js +51 -0
  85. data/repository/syntaxhighlighter/shBrushSql.js +66 -0
  86. data/repository/syntaxhighlighter/shBrushVb.js +56 -0
  87. data/repository/syntaxhighlighter/shBrushXml.js +69 -0
  88. data/repository/syntaxhighlighter/shCore.js +17 -0
  89. data/repository/syntaxhighlighter/shLegacy.js +17 -0
  90. data/spec/spec_helper.rb +3 -0
  91. data/spec/test_spec.rb +5 -0
  92. metadata +100 -3
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Modernizr JavaScript library 1.5
3
+ * http://www.modernizr.com/
4
+ *
5
+ * Copyright (c) 2009-2010 Faruk Ates - http://farukat.es/
6
+ * Dual-licensed under the BSD and MIT licenses.
7
+ * http://www.modernizr.com/license/
8
+ *
9
+ * Featuring major contributions by
10
+ * Paul Irish - http://paulirish.com
11
+ */
12
+ window.Modernizr=function(i,e,I){function C(a,b){for(var c in a)if(m[a[c]]!==I&&(!b||b(a[c],D)))return true}function r(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);return!!C([a,"Webkit"+c,"Moz"+c,"O"+c,"ms"+c,"Khtml"+c],b)}function P(){j[E]=function(a){for(var b=0,c=a.length;b<c;b++)J[a[b]]=!!(a[b]in n);return J}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" "));j[Q]=function(a){for(var b=0,c,h=a.length;b<h;b++){n.setAttribute("type",a[b]);if(c=n.type!==
13
+ "text"){n.value=K;/tel|search/.test(n.type)||(c=/url|email/.test(n.type)?n.checkValidity&&n.checkValidity()===false:n.value!=K)}L[a[b]]=!!c}return L}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var j={},s=e.documentElement,D=e.createElement("modernizr"),m=D.style,n=e.createElement("input"),E="input",Q=E+"types",K=":)",M=Object.prototype.toString,y=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),d={},L={},J={},N=[],u=function(){var a={select:"input",
14
+ change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"},b={};return function(c,h){var t=arguments.length==1;if(t&&b[c])return b[c];h=h||document.createElement(a[c]||"div");c="on"+c;var g=c in h;if(!g&&h.setAttribute){h.setAttribute(c,"return;");g=typeof h[c]=="function"}h=null;return t?(b[c]=g):g}}(),F={}.hasOwnProperty,O;O=typeof F!=="undefined"&&typeof F.call!=="undefined"?function(a,b){return F.call(a,b)}:function(a,b){return b in a&&typeof a.constructor.prototype[b]==="undefined"};
15
+ d.canvas=function(){return!!e.createElement("canvas").getContext};d.canvastext=function(){return!!(d.canvas()&&typeof e.createElement("canvas").getContext("2d").fillText=="function")};d.geolocation=function(){return!!navigator.geolocation};d.crosswindowmessaging=function(){return!!i.postMessage};d.websqldatabase=function(){var a=!!i.openDatabase;if(a)try{a=!!openDatabase("testdb","1.0","html5 test db",2E5)}catch(b){a=false}return a};d.indexedDB=function(){return!!i.indexedDB};d.hashchange=function(){return u("hashchange",
16
+ i)&&(document.documentMode===I||document.documentMode>7)};d.historymanagement=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return u("drag")&&u("dragstart")&&u("dragenter")&&u("dragover")&&u("dragleave")&&u("dragend")&&u("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){m.cssText="background-color:rgba(150,255,150,.5)";return(""+m.backgroundColor).indexOf("rgba")!==-1};d.hsla=function(){m.cssText="background-color:hsla(120,40%,100%,.5)";return(""+
17
+ m.backgroundColor).indexOf("rgba")!==-1};d.multiplebgs=function(){m.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(m.background)};d.backgroundsize=function(){return r("backgroundSize")};d.borderimage=function(){return r("borderImage")};d.borderradius=function(){return r("borderRadius","",function(a){return(""+a).indexOf("orderRadius")!==-1})};d.boxshadow=function(){return r("boxShadow")};d.opacity=function(){var a=y.join("opacity:.5;")+"";m.cssText=a;return(""+m.opacity).indexOf("0.5")!==
18
+ -1};d.cssanimations=function(){return r("animationName")};d.csscolumns=function(){return r("columnCount")};d.cssgradients=function(){var a=("background-image:"+y.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+y.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);m.cssText=a;return(""+m.backgroundImage).indexOf("gradient")!==-1};d.cssreflections=function(){return r("boxReflect")};d.csstransforms=function(){return!!C(["transformProperty",
19
+ "WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!C(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);if(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent="@media ("+y.join("transform-3d),(")+"modernizr){#modernizr{height:3px}}";e.getElementsByTagName("head")[0].appendChild(b);c.id="modernizr";s.appendChild(c);a=c.offsetHeight===3;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}return a};
20
+ d.csstransitions=function(){return r("transitionProperty")};d.fontface=function(){var a;if(/*@cc_on@if(@_jscript_version>=5)!@end@*/0)a=true;else{var b=e.createElement("style"),c=e.createElement("span"),h,t=false,g=e.body,o,w;b.textContent="@font-face{font-family:testfont;src:url('data:font/ttf;base64,AAEAAAAMAIAAAwBAT1MvMliohmwAAADMAAAAVmNtYXCp5qrBAAABJAAAANhjdnQgACICiAAAAfwAAAAEZ2FzcP//AAMAAAIAAAAACGdseWYv5OZoAAACCAAAANxoZWFk69bnvwAAAuQAAAA2aGhlYQUJAt8AAAMcAAAAJGhtdHgGDgC4AAADQAAAABRsb2NhAIQAwgAAA1QAAAAMbWF4cABVANgAAANgAAAAIG5hbWUgXduAAAADgAAABPVwb3N03NkzmgAACHgAAAA4AAECBAEsAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAACAAMDAAAAAAAAgAACbwAAAAoAAAAAAAAAAFBmRWQAAAAgqS8DM/8zAFwDMwDNAAAABQAAAAAAAAAAAAMAAAADAAAAHAABAAAAAABGAAMAAQAAAK4ABAAqAAAABgAEAAEAAgAuqQD//wAAAC6pAP///9ZXAwAAAAAAAAACAAAABgBoAAAAAAAvAAEAAAAAAAAAAAAAAAAAAAABAAIAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEACoAAAAGAAQAAQACAC6pAP//AAAALqkA////1lcDAAAAAAAAAAIAAAAiAogAAAAB//8AAgACACIAAAEyAqoAAwAHAC6xAQAvPLIHBADtMrEGBdw8sgMCAO0yALEDAC88sgUEAO0ysgcGAfw8sgEC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AAQACAQIAEQt6ZXJva2F5YWhsaQ==')}";
21
+ e.getElementsByTagName("head")[0].appendChild(b);c.setAttribute("style","font:99px _,arial,helvetica;position:absolute;visibility:hidden");if(!g){g=s.appendChild(e.createElement("fontface"));t=true}c.innerHTML="........";c.id="fonttest";g.appendChild(c);h=c.offsetWidth*c.offsetHeight;c.style.font="99px testfont,_,arial,helvetica";a=h!==c.offsetWidth*c.offsetHeight;var v=function(){if(g.parentNode){a=j.fontface=h!==c.offsetWidth*c.offsetHeight;s.className=s.className.replace(/(no-)?fontface\b/,"")+
22
+ (a?" ":" no-")+"fontface"}};setTimeout(v,75);setTimeout(v,150);addEventListener("load",function(){v();(w=true)&&o&&o(a);setTimeout(function(){t||(g=c);g.parentNode.removeChild(g);b.parentNode.removeChild(b)},50)},false)}j._fontfaceready=function(p){w||a?p(a):(o=p)};return a||h!==c.offsetWidth};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b};
23
+ d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localStorage=function(){return"localStorage"in i&&i.localStorage!==null};d.sessionStorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webworkers=function(){return!!i.Worker};
24
+ d.applicationCache=function(){var a=i.applicationCache;return!!(a&&typeof a.status!="undefined"&&typeof a.update=="function"&&typeof a.swapCache=="function")};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect};d.smil=function(){return!!e.createElementNS&&/SVG/.test(M.call(e.createElementNS("http://www.w3.org/2000/svg","animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(M.call(e.createElementNS("http://www.w3.org/2000/svg",
25
+ "clipPath")))};for(var z in d)if(O(d,z))N.push(((j[z.toLowerCase()]=d[z]())?"":"no-")+z.toLowerCase());j[E]||P();j.addTest=function(a,b){a=a.toLowerCase();if(!j[a]){b=!!b();s.className+=" "+(b?"":"no-")+a;j[a]=b;return j}};m.cssText="";D=n=null;(function(){var a=e.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1})()&&function(a,b){function c(f,k){if(o[f])o[f].styleSheet.cssText+=k;else{var l=t[G],q=b[A]("style");q.media=f;l.insertBefore(q,l[G]);o[f]=q;c(f,k)}}function h(f,
26
+ k){for(var l=new RegExp("\\b("+w+")\\b(?!.*[;}])","gi"),q=function(B){return".iepp_"+B},x=-1;++x<f.length;){k=f[x].media||k;h(f[x].imports,k);c(k,f[x].cssText.replace(l,q))}}for(var t=b.documentElement,g=b.createDocumentFragment(),o={},w="abbr|article|aside|audio|canvas|command|datalist|details|figure|figcaption|footer|header|hgroup|keygen|mark|meter|nav|output|progress|section|source|summary|time|video",v=w.split("|"),p=[],H=-1,G="firstChild",A="createElement";++H<v.length;){b[A](v[H]);g[A](v[H])}g=
27
+ g.appendChild(b[A]("div"));a.attachEvent("onbeforeprint",function(){for(var f,k=b.getElementsByTagName("*"),l,q,x=new RegExp("^"+w+"$","i"),B=-1;++B<k.length;)if((f=k[B])&&(q=f.nodeName.match(x))){l=new RegExp("^\\s*<"+q+"(.*)\\/"+q+">\\s*$","i");g.innerHTML=f.outerHTML.replace(/\r|\n/g," ").replace(l,f.currentStyle.display=="block"?"<div$1/div>":"<span$1/span>");l=g.childNodes[0];l.className+=" iepp_"+q;l=p[p.length]=[f,l];f.parentNode.replaceChild(l[1],l[0])}h(b.styleSheets,"all")});a.attachEvent("onafterprint",
28
+ function(){for(var f=-1,k;++f<p.length;)p[f][1].parentNode.replaceChild(p[f][0],p[f][1]);for(k in o)t[G].removeChild(o[k]);o={};p=[]})}(this,e);j._enableHTML5=true;j._version="1.5";s.className=s.className.replace(/\bno-js\b/,"")+" js";s.className+=" "+N.join(" ");return j}(this,this.document);
@@ -0,0 +1 @@
1
+ //= require "1.5"
@@ -0,0 +1,41 @@
1
+ if (is_defined === undefined) {
2
+ var is_defined = function(variable) {
3
+ return (variable === undefined) ? false : true;
4
+ };
5
+ }
6
+
7
+ if (!is_defined(is_undefined)) {
8
+ var is_undefined = function(variable) {
9
+ return (variable === undefined) ? true : false;
10
+ };
11
+ }
12
+
13
+ if (is_undefined(is_typeof)) {
14
+ var is_typeof = function(type, variable) {
15
+ try {
16
+ if (is_undefined(type)) {
17
+ throw new SyntaxError("is_typeof(Type, variable): type is undefined");
18
+ }
19
+ if (is_undefined(variable)) {
20
+ throw new SyntaxError("is_typeof(Type, variable): variable is undefined");
21
+ }
22
+
23
+ return (variable.constructor == type) ? true : false;
24
+ }
25
+ catch(error) {
26
+ alert(error.message);
27
+ }
28
+ };
29
+ }
30
+
31
+ if (is_undefined(is_mumeric)) {
32
+ var is_mumeric = function(suspect) {
33
+ if(is_typeof(Number, suspect)) {
34
+ return true;
35
+ }
36
+ else {
37
+ var pattern = /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i;
38
+ return pattern.test(suspect);
39
+ }
40
+ };
41
+ }
@@ -0,0 +1,22 @@
1
+ //= require "existence"
2
+
3
+ if (is_undefined(Function.prototype['method'])) {
4
+ Function.prototype.method = function(name, func) {
5
+ try {
6
+ if (is_undefined(name)) {
7
+ throw new SyntaxError("Object.method(name, func): name is undefined");
8
+ }
9
+ if (is_undefined(func)) {
10
+ throw new SyntaxError("Object.method(name, func): func is undefined");
11
+ }
12
+
13
+ if (is_undefined(this.prototype[name])) {
14
+ this.prototype[name] = func;
15
+ return this;
16
+ }
17
+ }
18
+ catch(error) {
19
+ alert(error.message);
20
+ }
21
+ };
22
+ }
@@ -0,0 +1,138 @@
1
+ //= require "extend"
2
+
3
+ var NinjsModule = function(name) {
4
+ this.data = {};
5
+ this.run_tests = false;
6
+ this.tests = [];
7
+ this.name = name;
8
+ };
9
+
10
+ NinjsModule.method('actions', function() {});
11
+
12
+ NinjsModule.method('add_test', function(test_file) {
13
+ this.tests.push(test_file);
14
+ });
15
+
16
+ NinjsModule.method('_run_tests', function() {
17
+ var test_template = [];
18
+ test_template.push('<div class="test-results" title="Test Results">');
19
+ test_template.push('<h1 id="qunit-header">' + this.name + ' module tests</h1>');
20
+ test_template.push('<h2 id="qunit-banner"></h2>');
21
+ test_template.push('<h2 id="qunit-userAgent"></h2>');
22
+ test_template.push('<ol id="qunit-tests"></ol>');
23
+ test_template.push('</div>');
24
+
25
+ $('body').append(test_template.join("\n"));
26
+
27
+ this.tests.each(function(test) {
28
+ $.getScript('tests/' + some + '.test.js', function() {
29
+ var test_results_dialog = $('.test-results');
30
+ var height = test_results_dialog.height() + 130;
31
+ var width = $(window).width() - 300;
32
+ var maxHeight = $(window).height() - 200;
33
+ try {
34
+ test_results_dialog.dialog({
35
+ width: width,
36
+ height: height,
37
+ maxHeight: maxHeight,
38
+ buttons: {
39
+ "Thanks buddy": function() {
40
+ test_results_dialog.dialog('close');
41
+ }
42
+ }
43
+ });
44
+ }
45
+ catch(error) {
46
+ alert("Test harness requires jQueryUI");
47
+ }
48
+ });
49
+ });
50
+ });
51
+
52
+ NinjsModule.method('execute', function() {
53
+ this.__ = is_defined(window.__) ? window.__ : undefined;
54
+ window.__ = this;
55
+ if (this.run_tests) {
56
+ this._run_tests();
57
+ }
58
+ this.actions();
59
+ window.__ = is_defined(this.__) ? this.__ : undefined;
60
+ });
61
+
62
+ NinjsModule.method('call_on_ready', function(callback) {
63
+ var timer;
64
+ var module = this;
65
+
66
+ function check_ready() {
67
+ timer = setInterval(is_ready, 13);
68
+ }
69
+
70
+ function is_ready() {
71
+ if (document && document.getElementsByTagName && document.getElementById && document.body) {
72
+ clearInterval(timer);
73
+ timer = null;
74
+ callback.call(module);
75
+ }
76
+ }
77
+
78
+ check_ready();
79
+ });
80
+
81
+ NinjsModule.method('run', function() {
82
+ this.call_on_ready(this.execute);
83
+ });
84
+
85
+ NinjsModule.method('elements', function(callback) {
86
+ this.call_on_ready(callback);
87
+ });
88
+
89
+ NinjsModule.method('set_data', function(key, value) {
90
+ try {
91
+ if (is_undefined(key)) {
92
+ throw new SyntaxError('NinjsModule.set_data(key, value): key is undefined');
93
+ }
94
+ if (is_typeof(String, key) && is_undefined(value)) {
95
+ throw new SyntaxError('NinjsModule.set_data(key, value): value is undefined');
96
+ }
97
+
98
+ if (is_typeof(String, key)) {
99
+ this.data[key] = value;
100
+ }
101
+ else if (is_typeof(Object, key)) {
102
+ var data = key;
103
+ this.data = data;
104
+ }
105
+
106
+ return this;
107
+ }
108
+ catch(error) {
109
+ alert(error.message);
110
+ return false;
111
+ }
112
+ });
113
+
114
+ var NinjsApplication = function() {
115
+ if (is_undefined(window._)) {
116
+ window._ = this;
117
+ }
118
+
119
+ if (is_undefined(window.app)) {
120
+ window.app = this;
121
+ }
122
+ };
123
+
124
+ NinjsApplication.method('add_module', function(name) {
125
+ try {
126
+ if (is_undefined(name)) {
127
+ throw new SyntaxError("NinjsApplication.add_module(name): name is undefined");
128
+ }
129
+
130
+ if (is_defined(this[name])) {
131
+ throw new SyntaxError("NinjsApplication.add_module(name): '" + name + "' already declared");
132
+ }
133
+ this[name] = new NinjsModule();
134
+ }
135
+ catch(error) {
136
+ alert(error.message);
137
+ }
138
+ });
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <title>All Ninjs tests</title>
4
+
5
+ <link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen"/>
6
+
7
+ <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
8
+ <script src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
9
+
10
+ <script src="../lib/judo.js"></script>
11
+ <script src="../lib/utilities.js"></script>
12
+
13
+ <script src="judo.test.js"></script>
14
+ <script src="judo.utilities.test.js"></script>
15
+ </head>
16
+ <body>
17
+ <h1 id="qunit-header">Ninjs tests</h1>
18
+ <h2 id="qunit-banner"></h2>
19
+ <h2 id="qunit-userAgent"></h2>
20
+ <ol id="qunit-tests"></ol>
21
+ </body>
@@ -0,0 +1,109 @@
1
+ module("existence tests");
2
+
3
+ test("existence sanity check", function() {
4
+ ok(is_defined !== undefined, 'is_defined is defined');
5
+ ok(is_undefined !== undefined, 'is_undefined is defined');
6
+ ok(is_typeof !== undefined, 'is_typeof is defined');
7
+ });
8
+
9
+ test("can test for existence", function() {
10
+ var nonexistent;
11
+ var existent = 'I think';
12
+ equals(is_defined(existent), true, 'existent variable is_defined');
13
+ equals(is_defined(nonexistent), false, 'non-existent variable does not exist');
14
+ });
15
+
16
+ test("can test for non-existence", function() {
17
+ var existent = 'I think';
18
+ var nonexistent;
19
+ equals(is_undefined(nonexistent), true, 'non-existent variable does not exist');
20
+ equals(is_undefined(existent), false, 'existent variable does exist');
21
+ });
22
+
23
+ test("can check the type strictly with is_typeof", function() {
24
+ var foo = function(){};
25
+ var bar = {
26
+ name: 'SomeObject',
27
+ method: function() {}
28
+ };
29
+ var FauxClass = function(){};
30
+ var fauxinstance = new FauxClass();
31
+ equals(is_typeof(Number, 4), true, 'can check against Number');
32
+ equals(is_typeof(String, 'Hello World'), true, 'can check against String');
33
+ equals(is_typeof(Array, ['one', 'two', 'three']), true, 'can check against Array');
34
+ equals(is_typeof(Function, foo), true, 'can check against Function');
35
+ equals(is_typeof(Object, bar), true, 'can check against Object');
36
+ equals(is_typeof(RegExp, /^_*/), true, 'can check against Regexp');
37
+ equals(is_typeof(FauxClass, fauxinstance), true, 'can check against custom object');
38
+ });
39
+
40
+ test("can determine a number", function() {
41
+ ok(is_numeric(2), '2 is a number');
42
+ ok(is_numeric(-2), '-2 is a number');
43
+ ok(is_numeric(45.6), '45.6 is a number');
44
+ ok(is_numeric(-45.6), '-45.6 is a number');
45
+ equals(is_numeric('45.6'), true, "'45.6 is a number'");
46
+ equals(is_numeric('Hello'), false, 'Hello is not a number');
47
+ });
48
+
49
+ module("extend tests");
50
+
51
+ test("can add a method to the prototype", function() {
52
+ ok(is_defined(Object.prototype.method), "Object.prototype.method is defined");
53
+
54
+ String.method('test_method', function() {
55
+ return 'This is a test';
56
+ });
57
+
58
+ equals('Hello'.test_method(), 'This is a test', 'can create a prototype method with method');
59
+ });
60
+
61
+ test("can clone something", function() {
62
+ var object = {
63
+ hello: 'world',
64
+ simple: 'object'
65
+ };
66
+
67
+ var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, object, 'one', 'two', 'three', 'four', 'five'];
68
+
69
+ var clone_object = object.clone();
70
+ var clone_array = array.clone();
71
+
72
+ ok(object !== clone_object, 'cloned object is not a reference');
73
+ ok(array !== clone_array, 'cloned array is not a reference');
74
+
75
+ same(object, clone_object, "object successfully cloned");
76
+ same(array, clone_array, "array successfully cloned");
77
+ });
78
+
79
+ module("Ninjs application tests");
80
+
81
+ test("can create a judo application object", function() {
82
+ var MyApp = new JudoApplication();
83
+ ok(is_defined(MyApp), 'MyApp is defined');
84
+ ok(is_typeof(JudoApplication, MyApp), 'MyApp is a valid JudoApplication');
85
+ });
86
+
87
+ test("can create a NinjsModule", function() {
88
+ var MyApp = new JudoApplication();
89
+ MyApp.add_module('Test');
90
+ ok(is_defined(MyApp.Test), 'MyApp.Test is defined');
91
+ ok(is_typeof(NinjsModule, MyApp.Test), 'MyApp.Test is a valid Judo Module');
92
+ });
93
+
94
+ module('Judo Module tests');
95
+
96
+ test("can add actions to module", function() {
97
+ var MyApp = new JudoApplication();
98
+ MyApp.add_module('Test');
99
+ ok(is_defined(MyApp.Test.actions), 'MyApp.Test.actions is defined');
100
+ ok(is_typeof(Function, MyApp.Test.actions), "MyApp.Test.actions is a valid Function");
101
+ ok(is_defined(MyApp.Test.run), 'MyApp.Test.run is defined');
102
+ ok(is_typeof(Function, MyApp.Test.run), "MyApp.Test.run is a valid Function");
103
+
104
+ MyApp.Test.actions = function() {
105
+ ok(true, 'MyApp.Test.actions ran');
106
+ };
107
+
108
+ MyApp.Test.run();
109
+ });
@@ -0,0 +1,149 @@
1
+ module("array utility tests");
2
+
3
+ test("can test for emptiness", function() {
4
+ expect(4);
5
+
6
+ ok([].is_empty(), "[].is_empty() is true");
7
+ equals(['one', 'two', 'three'].is_empty(), false, "['one', 'two', 'three'].is_empty()");
8
+ ok(['one', 'two', 'three'].not_empty(), "['one', 'two', 'three'].not_empty() is false");
9
+ equals([].not_empty(), false, "[].not_empty() is false");
10
+ });
11
+
12
+ test("can iterate over each element", function() {
13
+ expect(7);
14
+
15
+ var iteration_count = 0;
16
+ var test_array_values = [];
17
+ var test_array_indices = [];
18
+
19
+ ['one', 'two', 'three'].each(function(value, index) {
20
+ iteration_count++;
21
+ test_array_values.push(value);
22
+ test_array_indices.push(index);
23
+ });
24
+
25
+ equals(test_array_values[0], 'one', 'value at index 0 is correct');
26
+ equals(test_array_values[1], 'two', 'value at index 1 is correct');
27
+ equals(test_array_values[2], 'three', 'value at index 2 is correct');
28
+
29
+ equals(test_array_indices[0], 0, 'first index is correct');
30
+ equals(test_array_indices[1], 1, 'second index is correct');
31
+ equals(test_array_indices[2], 2, 'third index is correct');
32
+
33
+ equals(iteration_count, 3, 'made only three iterations');
34
+ });
35
+
36
+ test("can test if an array contains an element", function() {
37
+ var array = ['one', 'two', 'three'];
38
+ var string = 'hello';
39
+ var object = {
40
+ name: 'some object'
41
+ };
42
+ var number = 45;
43
+ var date = new Date();
44
+
45
+ var test_array = [array, string, object, number, date];
46
+
47
+ ok(test_array.contains(array), 'array.contains(array)');
48
+ ok(test_array.contains(string), 'array.contains(string)');
49
+ ok(test_array.contains(object), 'array.contains(object)');
50
+ ok(test_array.contains(number), 'array.contains(number)');
51
+ ok(test_array.contains(date), 'array.contains(date)');
52
+ equals(test_array.contains('not in there'), false, 'non-existent value is false');
53
+ });
54
+
55
+ test("can shuffle an array", function() {
56
+ var array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
57
+ ok(array != [1, 2, 3, 4, 5, 6, 7, 8, 9], "array is shuffled");
58
+ same(array, [1, 2, 3, 4, 5, 6, 7, 8, 9], 'array is not altered');
59
+ });
60
+
61
+ module("string utility tests");
62
+
63
+ test("can test for emptiness", function() {
64
+ ok(''.is_empty(), "''.is_empty() is true");
65
+ equals('hey there'.is_empty(), false, "'hey there'.is_empty() is false");
66
+ ok('hey there'.not_empty(), "'hey there'.not_empty() is false");
67
+ equals(''.not_empty(), false, "''.not_empty() is false");
68
+ });
69
+
70
+ test('can test for number', function() {
71
+ equals('34'.is_number(), true, "34 is a number");
72
+ equals('0.5'.is_number(), true, ".5 is a number");
73
+ equals('-34'.is_number(), true, '-34 is a number');
74
+ equals('-0.5'.is_number(), true, '-.05 is a number');
75
+ equals('hello'.is_number(), false, 'hello is not a number');
76
+ });
77
+
78
+ test('can trim a string', function() {
79
+ equals(' hello '.trim(), 'hello', "' hello '.trim()");
80
+ equals(' hello '.ltrim(), 'hello ', "' hello '.ltrim()");
81
+ equals(' hello '.rtrim(), ' hello', "' hello '.rtrim()");
82
+ });
83
+
84
+ test("can iterate over each character", function() {
85
+ var iteration_count = 0;
86
+ var test_chars = [];
87
+ var test_indices = [];
88
+ '123'.each(function(character, index) {
89
+ test_chars.push(character);
90
+ test_indices.push(index);
91
+ iteration_count++;
92
+ });
93
+
94
+ equals(test_chars[0], '1', 'first character of 123 is 1');
95
+ equals(test_chars[1], '2', 'second character of 123 is 2');
96
+ equals(test_chars[2], '3', 'second character of 123 is 3');
97
+
98
+ equals(test_indices[0], 0, 'first index is correct');
99
+ equals(test_indices[1], 1, 'second index is correct');
100
+ equals(test_indices[2], 2, 'third index is correct');
101
+
102
+ equals(iteration_count, 3, 'made only three iterations');
103
+ });
104
+
105
+ test('can capitalize a string', function() {
106
+ equals('hello world'.capitalize(), 'Hello world', 'capitalized string correctly');
107
+ });
108
+
109
+ test('can reverse a string', function() {
110
+ equals('hello world'.reverse(), 'dlrow olleh', 'reversed string correctly');
111
+ equals('satan oscillate my metallic sonatas'.reverse(), 'satanos cillatem ym etallicso natas', 'fucking palindromes, how do they work?');
112
+ });
113
+
114
+ test("can convert to number", function() {
115
+ var whole_number = '32';
116
+ var decimal = '0.08';
117
+ var negative_number = '-32';
118
+ var negative_float = '-0.08';
119
+
120
+ same(whole_number.to_n(), 32, "whole_number.to_n() is 32");
121
+ same(decimal.to_n(), 0.08, "decimal.to_n() is 0.08");
122
+ same(negative_number.to_n(), -32, "negative_number.to_n() is -32");
123
+ same(negative_float.to_n(), -0.08, "negative_float.to_n() -0.08");
124
+ });
125
+
126
+ test("can pluck a string", function() {
127
+ equals('one, two, three'.pluck(','), 'one two three', "'one, two, three'.pluck(',')");
128
+ });
129
+
130
+ test("can single space a string", function() {
131
+ var hard_space = 'one&nbsp;two&nbsp;&nbsp;three&nbsp;&nbsp;&nbsp;four&nbsp;&nbsp;&nbsp;&nbsp;five&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;six';
132
+ var soft_space = 'one two three four five six';
133
+ var mixed_space = 'one two &nbsp; three &nbsp;&nbsp;four &nbsp;&nbsp;&nbsp;five &nbsp;&nbsp;&nbsp;&nbsp;six';
134
+
135
+ equals(hard_space.single_space(), 'one two three four five six', 'correctly spaced &nbsp;');
136
+ equals(soft_space.single_space(), 'one two three four five six', "correctly spaced soft spaces");
137
+ equals(mixed_space.single_space(), 'one two three four five six', "correctly spaced mixed spaces");
138
+ });
139
+
140
+ test("can compress a string", function() {
141
+ var string = "satan\n\t oscillate\n\t my\n\t metallic\n sonatas";
142
+ same(string.compress(), 'satanoscillatemymetallicsonatas', "string is compressed correctly");
143
+ });
144
+
145
+ test("can shuffle a string", function() {
146
+ var string = 'Hello World';
147
+ ok('Hello World' != string.shuffle(), "string is shuffled");
148
+ same(string, 'Hello World', 'array is not altered');
149
+ });