ninjs 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.bundle/config +2 -2
  2. data/.gitmodules +0 -0
  3. data/README.md +5 -7
  4. data/VERSION +1 -1
  5. data/lib/ninjs/dependencies.rb +2 -0
  6. data/lib/ninjs/manifest.rb +1 -1
  7. data/lib/ninjs/project.rb +25 -12
  8. data/ninjs.gemspec +31 -24
  9. data/repository/ninjs/.travis.yml +2 -0
  10. data/repository/ninjs/Gemfile +4 -0
  11. data/repository/ninjs/README.md +4 -0
  12. data/repository/ninjs/Rakefile +18 -0
  13. data/repository/ninjs/spec/index.html +56 -0
  14. data/repository/ninjs/spec/javascripts/application_spec.js +21 -0
  15. data/repository/ninjs/spec/javascripts/array_utility_spec.js +49 -0
  16. data/repository/ninjs/spec/javascripts/existence_spec.js +71 -0
  17. data/repository/ninjs/spec/javascripts/extension_spec.js +22 -0
  18. data/repository/ninjs/spec/javascripts/module_spec.js +30 -0
  19. data/repository/ninjs/spec/javascripts/string_utility_spec.js +85 -0
  20. data/repository/ninjs/spec/javascripts/support/jasmine.yml +75 -0
  21. data/repository/ninjs/spec/javascripts/support/jasmine_config.rb +23 -0
  22. data/repository/ninjs/spec/javascripts/support/jasmine_runner.rb +32 -0
  23. data/spec/cli_spec.rb +24 -24
  24. data/spec/command_spec.rb +13 -13
  25. data/spec/dependencies_spec.rb +4 -0
  26. data/spec/manifest_spec.rb +1 -1
  27. data/spec/project_spec.rb +27 -17
  28. data/templates/jasmine.yml +74 -0
  29. data/templates/test-index.html +51 -0
  30. metadata +21 -14
  31. data/repository/ninjs/tests/application.test.js +0 -24
  32. data/repository/ninjs/tests/array.utilities.test.js +0 -55
  33. data/repository/ninjs/tests/existence.test.js +0 -64
  34. data/repository/ninjs/tests/extension.test.js +0 -28
  35. data/repository/ninjs/tests/index.html +0 -26
  36. data/repository/ninjs/tests/module.test.js +0 -71
  37. data/repository/ninjs/tests/qspec.js +0 -26
  38. data/repository/ninjs/tests/string.utilities.test.js +0 -85
  39. data/spec/testspec_spec.rb +0 -7
@@ -0,0 +1,74 @@
1
+ # src_files
2
+ #
3
+ # Return an array of filepaths relative to src_dir to include before jasmine specs.
4
+ # Default: []
5
+ #
6
+ # EXAMPLE:
7
+ #
8
+ # src_files:
9
+ # - lib/source1.js
10
+ # - lib/source2.js
11
+ # - dist/**/*.js
12
+ #
13
+ src_files:
14
+ - application/*.js
15
+ - lib/*.js
16
+
17
+ # stylesheets
18
+ #
19
+ # Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
20
+ # Default: []
21
+ #
22
+ # EXAMPLE:
23
+ #
24
+ # stylesheets:
25
+ # - css/style.css
26
+ # - stylesheets/*.css
27
+ #
28
+ stylesheets:
29
+
30
+ # helpers
31
+ #
32
+ # Return an array of filepaths relative to spec_dir to include before jasmine specs.
33
+ # Default: ["helpers/**/*.js"]
34
+ #
35
+ # EXAMPLE:
36
+ #
37
+ # helpers:
38
+ # - helpers/**/*.js
39
+ #
40
+ helpers:
41
+
42
+ # spec_files
43
+ #
44
+ # Return an array of filepaths relative to spec_dir to include.
45
+ # Default: ["**/*[sS]pec.js"]
46
+ #
47
+ # EXAMPLE:
48
+ #
49
+ # spec_files:
50
+ # - **/*[sS]pec.js
51
+ #
52
+ spec_files:
53
+
54
+ # src_dir
55
+ #
56
+ # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
57
+ # Default: project root
58
+ #
59
+ # EXAMPLE:
60
+ #
61
+ # src_dir: public
62
+ #
63
+ src_dir:
64
+
65
+ # spec_dir
66
+ #
67
+ # Spec directory path. Your spec_files must be returned relative to this path.
68
+ # Default: spec/javascripts
69
+ #
70
+ # EXAMPLE:
71
+ #
72
+ # spec_dir: spec/javascripts
73
+ #
74
+ spec_dir:
@@ -0,0 +1,51 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Jasmine Spec Runner: Ninjs</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="https://s3.amazonaws.com/daytonn-js/jamsine-1.1.0/jasmine_favicon.png">
8
+ <link rel="stylesheet" href="https://s3.amazonaws.com/daytonn-js/jamsine-1.1.0/jasmine.css" />
9
+ <script src="https://s3.amazonaws.com/ninjs/jamsine-1.1.0/jasmine.js"></script>
10
+ <script src="https://s3.amazonaws.com/ninjs/jamsine-1.1.0/jasmine-html.js"></script>
11
+
12
+ <!-- NinJs source files -->
13
+ <script src="../lib/nin.js"></script>
14
+ <script src="../lib/utilities.js"></script>
15
+
16
+ <!-- spec files -->
17
+ <script src="javascripts/existence_spec.js"></script>
18
+ <script src="javascripts/extension_spec.js"></script>
19
+ <script src="javascripts/application_spec.js"></script>
20
+ <script src="javascripts/module_spec.js"></script>
21
+ <script src="javascripts/array_utility_spec.js"></script>
22
+ <script src="javascripts/string_utility_spec.js"></script>
23
+
24
+ <script type="text/javascript">
25
+ (function() {
26
+ var jasmineEnv = jasmine.getEnv();
27
+ var trivialReporter = new jasmine.TrivialReporter();
28
+ var currentWindowOnload = window.onload;
29
+
30
+ jasmineEnv.updateInterval = 1000;
31
+ jasmineEnv.addReporter(trivialReporter);
32
+ jasmineEnv.specFilter = function(spec) {
33
+ return trivialReporter.specFilter(spec);
34
+ };
35
+
36
+ window.onload = function() {
37
+ if (currentWindowOnload) {
38
+ currentWindowOnload();
39
+ }
40
+ execJasmine();
41
+ };
42
+
43
+ function execJasmine() {
44
+ jasmineEnv.execute();
45
+ }
46
+
47
+ })();
48
+ </script>
49
+ </head>
50
+ <body></body>
51
+ </html>
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ninjs
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.16.0
5
+ version: 0.16.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dayton Nolan
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-07 00:00:00 Z
13
+ date: 2011-10-21 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fssm
@@ -177,6 +177,7 @@ extra_rdoc_files:
177
177
  - README.md
178
178
  files:
179
179
  - .bundle/config
180
+ - .gitmodules
180
181
  - .travis.yml
181
182
  - CNAME
182
183
  - Gemfile
@@ -272,6 +273,10 @@ files:
272
273
  - repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_888888_256x240.png
273
274
  - repository/jquery/ui/assets/1.8.7/images/jqueryui/ui-icons_cd0a0a_256x240.png
274
275
  - repository/jquery/ui/latest.js
276
+ - repository/ninjs/.travis.yml
277
+ - repository/ninjs/Gemfile
278
+ - repository/ninjs/README.md
279
+ - repository/ninjs/Rakefile
275
280
  - repository/ninjs/core/.core.pdoc.yaml
276
281
  - repository/ninjs/core/.existence.pdoc.yaml
277
282
  - repository/ninjs/core/.extend.pdoc.yaml
@@ -283,14 +288,16 @@ files:
283
288
  - repository/ninjs/core/module.js
284
289
  - repository/ninjs/core/nin.js
285
290
  - repository/ninjs/extensions/jquery.elements.js
286
- - repository/ninjs/tests/application.test.js
287
- - repository/ninjs/tests/array.utilities.test.js
288
- - repository/ninjs/tests/existence.test.js
289
- - repository/ninjs/tests/extension.test.js
290
- - repository/ninjs/tests/index.html
291
- - repository/ninjs/tests/module.test.js
292
- - repository/ninjs/tests/qspec.js
293
- - repository/ninjs/tests/string.utilities.test.js
291
+ - repository/ninjs/spec/index.html
292
+ - repository/ninjs/spec/javascripts/application_spec.js
293
+ - repository/ninjs/spec/javascripts/array_utility_spec.js
294
+ - repository/ninjs/spec/javascripts/existence_spec.js
295
+ - repository/ninjs/spec/javascripts/extension_spec.js
296
+ - repository/ninjs/spec/javascripts/module_spec.js
297
+ - repository/ninjs/spec/javascripts/string_utility_spec.js
298
+ - repository/ninjs/spec/javascripts/support/jasmine.yml
299
+ - repository/ninjs/spec/javascripts/support/jasmine_config.rb
300
+ - repository/ninjs/spec/javascripts/support/jasmine_runner.rb
294
301
  - repository/ninjs/utilities/all.js
295
302
  - repository/ninjs/utilities/array.js
296
303
  - repository/ninjs/utilities/cookie.js
@@ -334,7 +341,8 @@ files:
334
341
  - spec/notification_spec.rb
335
342
  - spec/project_spec.rb
336
343
  - spec/spec_helper.rb
337
- - spec/testspec_spec.rb
344
+ - templates/jasmine.yml
345
+ - templates/test-index.html
338
346
  homepage: http://github.com/textnotspeech/ninjs
339
347
  licenses:
340
348
  - MIT
@@ -348,7 +356,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
356
  requirements:
349
357
  - - ">="
350
358
  - !ruby/object:Gem::Version
351
- hash: -3967882551582680969
359
+ hash: 4531478717148627885
352
360
  segments:
353
361
  - 0
354
362
  version: "0"
@@ -361,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
369
  requirements: []
362
370
 
363
371
  rubyforge_project: nowarning
364
- rubygems_version: 1.8.8
372
+ rubygems_version: 1.8.10
365
373
  signing_key:
366
374
  specification_version: 3
367
375
  summary: ninjs is a command line application to help you write clean, modular javascript applications.
@@ -377,4 +385,3 @@ test_files:
377
385
  - spec/notification_spec.rb
378
386
  - spec/project_spec.rb
379
387
  - spec/spec_helper.rb
380
- - spec/testspec_spec.rb
@@ -1,24 +0,0 @@
1
- var spec = new QSpec("NinjsApplication");
2
-
3
- spec.before = function() {
4
- this.app = new NinjsApplication('myapp');
5
- };
6
-
7
- spec.after = function() {
8
- delete this.app;
9
- };
10
-
11
- spec.should("create a ninjs application object", function() {
12
- this.app = new NinjsApplication('myapp');
13
- ok(is_defined(this.app), 'app is defined');
14
- ok(is_typeof(NinjsApplication, this.app), 'app is a valid NinjsApplication');
15
- });
16
-
17
- spec.should("create a NinjsModule", function() {
18
- this.app = new NinjsApplication('myapp');
19
- this.app.add_module('mymod');
20
-
21
- ok(is_typeof(NinjsModule, this.app.mymod), 'app.mymod is a valid NinjsModule');
22
- });
23
-
24
- spec.run_all();
@@ -1,55 +0,0 @@
1
- var spec = new QSpec("Array Extensions");
2
-
3
- spec.should("test for emptiness with is_empty and not_empty", 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
- spec.should("iterate over each element with each", 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
- spec.should("test if 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
- spec.run_all();
@@ -1,64 +0,0 @@
1
- var spec = new QSpec("Existence");
2
-
3
- spec.should("test for existence with is_defined", function() {
4
- var nonexistent;
5
- var existent = 'I think';
6
- equals(is_defined(existent), true, 'existent variable is_defined');
7
- equals(is_defined(nonexistent), false, 'non-existent variable does not exist');
8
- });
9
-
10
- spec.should("test for non-existence with is_undefined", function() {
11
- var existent = 'I think';
12
- var nonexistent;
13
- equals(is_undefined(nonexistent), true, 'non-existent variable does not exist');
14
- equals(is_undefined(existent), false, 'existent variable does exist');
15
- });
16
-
17
- spec.should("check the type strictly with is_typeof", function() {
18
- var foo = function(){};
19
- var bar = {
20
- name: 'SomeObject',
21
- method: function() {}
22
- };
23
- var SomeClass = function(){};
24
- var some_instance = new SomeClass();
25
-
26
- equals(is_typeof(Number, 4), true, 'can check against Number');
27
- equals(is_typeof(String, 'Hello World'), true, 'can check against String');
28
- equals(is_typeof(Array, ['one', 'two', 'three']), true, 'can check against Array');
29
- equals(is_typeof(Function, foo), true, 'can check against Function');
30
- equals(is_typeof(Object, bar), true, 'can check against Object');
31
- equals(is_typeof(RegExp, /pattern/), true, 'can check against Regexp');
32
- equals(is_typeof(SomeClass, some_instance), true, 'can check against custom object');
33
- });
34
-
35
- spec.should("check for default types", function() {
36
- var today = new Date();
37
- var easy_as = [1,2,3];
38
- var pattern = new RegExp(/pattern/);
39
-
40
- ok(is_string('hello'), 'hello is_string');
41
- ok(is_number(42), '42 is_number');
42
- ok(is_array(easy_as), 'easy_as is_array');
43
- ok(is_bool(false), 'false is_bool');
44
- ok(is_date(today), 'today is_date');
45
- ok(is_regex(pattern), 'pattern is_regex');
46
-
47
- equals(is_regex('hello'), false, 'hello fails is_regex');
48
- equals(is_date(42), false, '42 fails is_date');
49
- equals(is_bool(easy_as), false, 'easy_as fails is_bool');
50
- equals(is_array(today), false, 'today fails is_array');
51
- equals(is_number(true), false, 'true fails is_number');
52
- equals(is_string(pattern), false, 'pattern fails is_string');
53
- });
54
-
55
- spec.should("determine if a string is a number", function() {
56
- ok(is_numeric(2), '2 is a number');
57
- ok(is_numeric(-2), '-2 is a number');
58
- ok(is_numeric(45.6), '45.6 is a number');
59
- ok(is_numeric(-45.6), '-45.6 is a number');
60
- equals(is_numeric('45.6'), true, "'45.6 is a number'");
61
- equals(is_numeric('Hello'), false, 'Hello is not a number');
62
- });
63
-
64
- spec.run_all();
@@ -1,28 +0,0 @@
1
- var spec = new QSpec("Extensions");
2
-
3
- spec.should("test a condition with unless", function() {
4
- var is_true = false;
5
-
6
- unless (false,
7
- function() {
8
- is_true = true;
9
- }
10
- );
11
-
12
- ok(is_true, "unless works");
13
-
14
- var does_fallback_work = false;
15
-
16
- unless (true,
17
- function() {
18
-
19
- },
20
- function() {
21
- does_fallback_work = true;
22
- }
23
- );
24
-
25
- ok(does_fallback_work, 'fallback works');
26
- });
27
-
28
- spec.run_all();
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <head>
3
- <title>All Ninjs tests</title>
4
-
5
- <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen"/>
6
-
7
- <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
8
- <script src="http://code.jquery.com/qunit/qunit-git.js"></script>
9
- <script src="qspec.js"></script>
10
-
11
- <script src="../lib/nin.js"></script>
12
- <script src="../lib/utilities.js"></script>
13
-
14
- <script src="existence.test.js"></script>
15
- <script src="extension.test.js"></script>
16
- <script src="application.test.js"></script>
17
- <script src="module.test.js"></script>
18
- <script src="string.utilities.test.js"></script>
19
- <script src="array.utilities.test.js"></script>
20
- </head>
21
- <body>
22
- <h1 id="qunit-header">Ninjs tests</h1>
23
- <h2 id="qunit-banner"></h2>
24
- <h2 id="qunit-userAgent"></h2>
25
- <ol id="qunit-tests"></ol>
26
- </body>
@@ -1,71 +0,0 @@
1
- var spec = new QSpec('NinjsModule');
2
-
3
- spec.should('return the module when adding a module', function() {
4
- var test_app = new NinjsApplication('myapp');
5
- var module = test_app.add_module('mymod');
6
- console.log(module);
7
- equals(module, test_app.mymod, 'returns the module when adding a module');
8
- });
9
-
10
- spec.should("have the correct defaults", function() {
11
- var testapp = new NinjsApplication();
12
- testapp.add_module('testmodule');
13
-
14
- // properties
15
- ok(is_defined(testapp.testmodule.data), "testapp.testmodule.data is defined");
16
- ok(is_defined(testapp.testmodule.name), 'testapp.testmodule.name is defined');
17
- equals(testapp.testmodule.name, 'testmodule', 'testapp.testmodule.name is correct');
18
-
19
- // methods
20
- ok(is_defined(testapp.testmodule.actions), 'testapp.testmodule.actions is defined');
21
- ok(is_typeof(Function, testapp.testmodule.actions), "testapp.testmodule.actions is a valid Function");
22
- ok(is_defined(testapp.testmodule.run), 'testapp.testmodule.run is defined');
23
- ok(is_typeof(Function, testapp.testmodule.run), "testapp.testmodule.run is a valid Function");
24
- ok(is_defined(testapp.testmodule.execute), 'testmodule.testapp.execute is defined');
25
- ok(is_defined(testapp.testmodule.elements), 'testapp.testmodule.elements is defined');
26
- ok(is_defined(testapp.testmodule.set_data), 'testapp.testmodule.set_data is defined');
27
- });
28
-
29
- spec.run_all();
30
-
31
- // Qunit waits for DOM to load before running tests
32
- // to test DOM wait feature, we need to run some code outside the tests
33
- (function() {
34
- var spec = new QSpec('NinjsModule');
35
-
36
- var testapp = new NinjsApplication();
37
- testapp.add_module('testmodule');
38
- testapp.testmodule.actions = function() {
39
- // append an element to be sure the DOM is ready for manipulation and test for the element's existence
40
- $('body').append('<div id="made-by-actions"/>');
41
-
42
- spec.should("run the module actions", function() {
43
- equals($('#made-by-actions').length, 1,'testapp.test.actions ran after DOM was ready');
44
- });
45
-
46
- spec.run_all();
47
- };
48
-
49
- testapp.testmodule.run();
50
- }());
51
-
52
- // Qunit waits for DOM to load before running tests
53
- // to test DOM wait feature, we need to run some code outside the tests
54
- (function() {
55
- spec.should('set elements', function() {
56
- this.app = new NinjsApplication('myapp');
57
- var mod = this.app.add_module('mymod');
58
-
59
-
60
- mod.dom.ready(function() {
61
- mod.elements({
62
- body: $('body')
63
- });
64
-
65
- equals(mod.elements('body').length, 1, 'mod.elements("body") has length of 1');
66
- equals(mod.elements('body').text(), $('body').text(), 'mod.elements("body").text() = $("body").text()');
67
- });
68
- });
69
-
70
- spec.run_all();
71
- }());