spade 0.1.0 → 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.gitignore +0 -11
  2. data/.gitmodules +3 -6
  3. data/Gemfile +10 -0
  4. data/bin/spade +3 -1
  5. data/lib/spade.rb +70 -0
  6. data/lib/spade/bundle.rb +180 -0
  7. data/lib/spade/cli.rb +1 -17
  8. data/lib/spade/cli/base.rb +182 -0
  9. data/lib/spade/console.rb +39 -0
  10. data/lib/spade/context.rb +107 -0
  11. data/lib/spade/evaluator.rb +34 -0
  12. data/lib/spade/exports.rb +70 -0
  13. data/lib/spade/loader.rb +208 -0
  14. data/lib/spade/package/.gitignore +1 -0
  15. data/lib/spade/package/Gemfile +15 -0
  16. data/lib/spade/package/lib/spade.js +1283 -0
  17. data/lib/spade/package/lib/wrapper.js +15 -0
  18. data/lib/spade/package/package.json +17 -0
  19. data/lib/spade/package/spec/javascript/async-test.js +123 -0
  20. data/lib/spade/package/spec/javascript/compiler/javascript.js +13 -0
  21. data/lib/spade/package/spec/javascript/compiler/ruby.js +14 -0
  22. data/lib/spade/package/spec/javascript/loader-test.js +64 -0
  23. data/lib/spade/package/spec/javascript/normalize-test.js +73 -0
  24. data/lib/spade/package/spec/javascript/packages-test.js +50 -0
  25. data/lib/spade/package/spec/javascript/relative-require-test.js +72 -0
  26. data/lib/spade/package/spec/javascript/require-test.js +117 -0
  27. data/lib/spade/package/spec/javascript/sandbox/creation.js +44 -0
  28. data/lib/spade/package/spec/javascript/sandbox/evaluate.js +37 -0
  29. data/lib/spade/package/spec/javascript/sandbox/format.js +79 -0
  30. data/lib/spade/package/spec/javascript/sandbox/misc.js +58 -0
  31. data/lib/spade/package/spec/javascript/sandbox/preprocessor.js +81 -0
  32. data/lib/spade/package/spec/javascript/sandbox/require.js +48 -0
  33. data/lib/spade/package/spec/javascript/sandbox/run-command.js +21 -0
  34. data/lib/spade/package/spec/javascript/spade/externs.js +14 -0
  35. data/lib/spade/package/spec/javascript/spade/load-factory.js +15 -0
  36. data/lib/spade/package/spec/javascript/spade/misc.js +23 -0
  37. data/lib/spade/package/spec/javascript/spade/ready.js +12 -0
  38. data/lib/spade/package/spec/javascript/spade/register.js +13 -0
  39. data/lib/spade/package/spec/javascript_spec.rb +7 -0
  40. data/lib/spade/package/spec/spec_helper.rb +3 -0
  41. data/lib/spade/package/spec/support/core_test.rb +67 -0
  42. data/lib/spade/reactor.rb +159 -0
  43. data/lib/spade/server.rb +66 -0
  44. data/lib/spade/shell.rb +85 -0
  45. data/lib/spade/version.rb +1 -1
  46. data/spade.gemspec +15 -4
  47. data/spec/cli/update_spec.rb +65 -0
  48. data/spec/spec_helper.rb +22 -0
  49. data/spec/support/cli.rb +103 -0
  50. data/spec/support/matchers.rb +12 -0
  51. data/spec/support/path.rb +66 -0
  52. metadata +146 -78
  53. data/.rspec +0 -1
  54. data/Buildfile +0 -18
  55. data/README.md +0 -152
  56. data/Rakefile +0 -9
  57. data/examples/format-app/lib/hello.coffee +0 -1
  58. data/examples/format-app/lib/main.js +0 -6
  59. data/examples/format-app/package.json +0 -10
  60. data/examples/format-app/resources/README.txt +0 -1
  61. data/examples/format-app/resources/config.json +0 -3
  62. data/examples/path-test/lib/hello.js +0 -1
  63. data/examples/path-test/lib/main.js +0 -1
  64. data/examples/path-test/package.json +0 -5
  65. data/examples/sc-app/index.html +0 -13
  66. data/examples/sc-app/lib/main.js +0 -24
  67. data/examples/sc-app/package.json +0 -8
  68. data/examples/single-file.js +0 -22
  69. data/examples/todos/index.html +0 -11
  70. data/examples/todos/lib/main.js +0 -11
  71. data/examples/todos/lib/todos.js +0 -93
  72. data/examples/todos/package.json +0 -10
  73. data/examples/todos/resources/stylesheets/todos.css +0 -162
  74. data/examples/todos/resources/templates/todos.handlebars +0 -31
  75. data/examples/web-app/README.md +0 -83
  76. data/examples/web-app/index.html +0 -12
  77. data/examples/web-app/lib/main.js +0 -3
  78. data/examples/web-app/package.json +0 -6
  79. data/examples/web-app/tests.html +0 -12
  80. data/examples/web-app/tests/ct-example-test.js +0 -39
  81. data/examples/web-app/tests/qunit-test.js +0 -23
@@ -1,31 +0,0 @@
1
- <h1>Todos</h1>
2
-
3
- {{#view "Todos.CreateTodoView"}}
4
- <input id="new-todo" type="text" placeholder="Wot?" >
5
- {{/view}}
6
-
7
- {{#view "Todos.statsView"}}
8
- <div class="remaining">
9
- {{#view "Todos.clearCompletedView"}}
10
- <button>Clear Completed Todos</button>
11
- {{/view}}
12
- {{bind "displayRemaining"}} remaining.
13
- </div>
14
- {{/view}}
15
-
16
- {{#view "Todos.markAllDoneView"}}
17
- <label class='done-label'>
18
- <input class="mark-all-done" type="checkbox"> Mark All as Done
19
- </label>
20
- {{/view}}
21
-
22
- {{#collection "Todos.todoListView"}}
23
- <label class='done'>
24
- {{#view "Todos.CheckboxView"}}
25
- <input class="check" type="checkbox">
26
- {{/view}}
27
- <div class="todo-content">{{content/title}}</div>
28
- </label>
29
- {{/collection}}
30
-
31
-
@@ -1,83 +0,0 @@
1
- This is a simple demo web app the shows how to use spade in web pages and
2
- unit testing from CLI and web.
3
-
4
- # Quick Start
5
-
6
- _**Note:** these instructions assume you have not added any of the spade or
7
- core-test bins to your path. If you have then you can just use the spade or
8
- cot commands directly._
9
-
10
- To test the web app, first you need to run spade-update to do one-time setup.
11
- This will link up all the necessary packages and create a spade-boot.js which
12
- is needed by the app to load:
13
-
14
- ../../bin/spade update
15
-
16
- Anytime you add a new package dependency to the web app, you will need to run
17
- this command again for it to load in the browser.
18
-
19
- To view the web app, you need to load your files through a server.
20
- This will get around some security restrictions on the file:// protocol in
21
- Chrome and Webkit. You could technically use any web server you like.
22
- However, spade comes with a simple one built in for quick testing. To start
23
- the server:
24
-
25
- ../../bin/spade preview
26
-
27
- Now you can view the web app by visiting [http://localhost:4020/index.html]
28
- in your web browser.
29
-
30
- # Running Unit Tests
31
-
32
- You can run the unit tests from the command line using the core-test cot
33
- command:
34
-
35
- ../../packages/core-test/bin/cot
36
-
37
- If you want to see detailed reports use the --verbose flag:
38
-
39
- ../../packages/core-test/bin/cot --verbose
40
-
41
- You can also run specific unit tests:
42
-
43
- ../../packages/core-test/bin/cot ./tests/qunit-example-test.js
44
-
45
- To run unit tests in the browser, you will need to first run a one-time setup
46
- with core-test:
47
-
48
- ../../packages/core-test/bin/cot update
49
-
50
- This will create a file called tests/ct-runner.js that is used to bootstrap
51
- the tests in the browser. Anytime you add a new unit test file you need to
52
- run this command again.
53
-
54
- To view in the browser, you will need a web server again. spade preview is
55
- the easiest way to do this:
56
-
57
- ../../bin/spade preview
58
-
59
- Now you can load the tests by visiting [http://localhost:4020/tests.html]
60
-
61
- Note that the unit tests included in this demo use different personalities
62
- on CoreTest. This shows how you can use CoreTest to mix and match your
63
- outputs.
64
-
65
- # Additional Notes
66
-
67
- In general, spade leaves it up to you to create your own HTML files for web-
68
- based projects. The only requirement is that you need to load the spade-boot
69
- script at the top of the file. You should also include a data-require
70
- attribute which names the initial module you want to load when the HTML page
71
- is finished loading.
72
-
73
- For regular web apps, this is usually the default index module for the app
74
- itself. For testing, you would instead load the ~tests/ct-runner module. In
75
- both cases your app itself loads which means all the assets you care about are
76
- present.
77
-
78
- For unit testing, note that normally only files ending in '-test' or '-spec'
79
- or '\_test' or '\_spec' are automatically run. To run all files in the tests
80
- directory use the --all option on cot.
81
-
82
- Finally, note that current core-test does not know how to load its own
83
- stylesheets. This means the tests will load unstyled.
@@ -1,12 +0,0 @@
1
- <!DOCYTYPE HTML>
2
- <html>
3
- <head>
4
- <title>Demo App</title>
5
- <script src="spade-boot.js" data-require="web-app"></script>
6
- </head>
7
- <body>
8
- <h1>Loading...</h1>
9
- </body>
10
- </html>
11
-
12
-
@@ -1,3 +0,0 @@
1
- require('jquery');
2
- $('h1').text('Hello Spade!');
3
-
@@ -1,6 +0,0 @@
1
- {
2
- "name": "web-app",
3
- "dependencies": {
4
- "jquery": "1.4.3"
5
- }
6
- }
@@ -1,12 +0,0 @@
1
- <!DOCYTYPE HTML>
2
- <html>
3
- <head>
4
- <title>Demo App</title>
5
- <script src="spade-boot.js" data-require="web-app/~tests/ct-runner"></script>
6
- </head>
7
- <body>
8
- <h1>Test Runner</h1>
9
- </body>
10
- </html>
11
-
12
-
@@ -1,39 +0,0 @@
1
- /*
2
- This is an example of the same unit test written using the native CoreTest
3
- API. The big benefit of the native CoreTest API is that it is fully
4
- async so it is easy to test event driven code with it.
5
-
6
- For a sync version of this same API (does not require invoking a callback
7
- when )
8
- */
9
- /*globals Ct */
10
-
11
- require('core-test');
12
-
13
- Ct.module('Qunit Example');
14
-
15
- // NOTE: T is the test instance. A new one is passed for each test which is
16
- // good since previous tests could impact future ones when running async
17
- Ct.setup(function(T, done) {
18
- T.foo = 'foo';
19
- done();
20
- });
21
-
22
- Ct.teardown(function(T, done) {
23
- T.foo = 'unfoo';
24
- done();
25
- });
26
-
27
- Ct.test('T.foo should be foo', function(T, done) {
28
- T.equal(T.foo, 'foo', 'T.foo should be set');
29
- done();
30
- });
31
-
32
- Ct.test('async example', function(T, done) {
33
- setTimeout(function() {
34
- T.ok(true, 'async test did fire');
35
- done(); // invoke when you are finished running this test
36
- }, 100);
37
- });
38
-
39
- Ct.run();
@@ -1,23 +0,0 @@
1
- /*
2
- This is an example of a unit test using the CoreTest Qunit personality. To
3
- convert an existing Qunit test just add the core-test require to the top of
4
- the file.
5
- */
6
-
7
- require('core-test/qunit');
8
-
9
- var T = {};
10
-
11
- module('Qunit Example', {
12
- setup: function() {
13
- T.foo = 'foo';
14
- },
15
-
16
- teardown: function() {
17
- T.foo = 'unfoo';
18
- }
19
- });
20
-
21
- test('T.foo should be foo', function() {
22
- equals(T.foo, 'foo', 'T.foo should be set');
23
- });