cartilage 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.markdown +57 -0
  3. data/Rakefile +84 -0
  4. data/app/assets/images/cartilage/patterns/background.dark.png +0 -0
  5. data/app/assets/images/cartilage/patterns/background.dark.psd +0 -0
  6. data/app/assets/images/cartilage/patterns/background.light.png +0 -0
  7. data/app/assets/images/cartilage/patterns/background.light.psd +0 -0
  8. data/app/assets/images/cartilage/patterns/background.medium.png +0 -0
  9. data/app/assets/images/cartilage/patterns/background.medium.psd +0 -0
  10. data/app/assets/images/cartilage/patterns/background.png +0 -0
  11. data/app/assets/images/cartilage/patterns/background.psd +0 -0
  12. data/app/assets/javascripts/cartilage/application.js.coffee +45 -0
  13. data/app/assets/javascripts/cartilage/collections/segments.js.coffee +4 -0
  14. data/app/assets/javascripts/cartilage/core.js.coffee +8 -0
  15. data/app/assets/javascripts/cartilage/models/model.js.coffee +2 -0
  16. data/app/assets/javascripts/cartilage/models/segment.js.coffee +2 -0
  17. data/app/assets/javascripts/cartilage/views/bar_segment_view.js.coffee +58 -0
  18. data/app/assets/javascripts/cartilage/views/bar_view.js.coffee +85 -0
  19. data/app/assets/javascripts/cartilage/views/content_view.js.coffee +16 -0
  20. data/app/assets/javascripts/cartilage/views/image_view.js.coffee +76 -0
  21. data/app/assets/javascripts/cartilage/views/list_view.js.coffee +515 -0
  22. data/app/assets/javascripts/cartilage/views/list_view_item.js.coffee +85 -0
  23. data/app/assets/javascripts/cartilage/views/loading_indicator_view.js.coffee +147 -0
  24. data/app/assets/javascripts/cartilage/views/matrix_view.js.coffee +253 -0
  25. data/app/assets/javascripts/cartilage/views/matrix_view_item.js.coffee +5 -0
  26. data/app/assets/javascripts/cartilage/views/modal_view.js.coffee +26 -0
  27. data/app/assets/javascripts/cartilage/views/popover_view.js.coffee +212 -0
  28. data/app/assets/javascripts/cartilage/views/source_list_view.js.coffee +69 -0
  29. data/app/assets/javascripts/cartilage/views/source_list_view_item.js.coffee +5 -0
  30. data/app/assets/javascripts/cartilage/views/split_view.js.coffee +175 -0
  31. data/app/assets/javascripts/cartilage/views/usage_bar_view.js.coffee +5 -0
  32. data/app/assets/javascripts/cartilage/views/view.js.coffee +232 -0
  33. data/app/assets/javascripts/cartilage.js.coffee +18 -0
  34. data/app/assets/javascripts/extensions/console.js.coffee +9 -0
  35. data/app/assets/javascripts/extensions/constructor_name.js.coffee +10 -0
  36. data/app/assets/javascripts/extensions/properties.js.coffee +45 -0
  37. data/app/assets/javascripts/extensions/underscore.js.coffee +71 -0
  38. data/app/assets/stylesheets/cartilage/core.css.scss +432 -0
  39. data/app/assets/stylesheets/cartilage/mixins.css.scss +19 -0
  40. data/app/assets/stylesheets/cartilage/responsive.css.scss +192 -0
  41. data/app/assets/stylesheets/cartilage/variables.css.scss +113 -0
  42. data/app/assets/stylesheets/cartilage/views/list_view.css.scss +41 -0
  43. data/app/assets/stylesheets/cartilage/views/list_view_item.css.scss +47 -0
  44. data/app/assets/stylesheets/cartilage/views/loading_indicator_view.css.scss +50 -0
  45. data/app/assets/stylesheets/cartilage/views/matrix_view.css.scss +87 -0
  46. data/app/assets/stylesheets/cartilage/views/popover_view.css.scss +124 -0
  47. data/app/assets/stylesheets/cartilage/views/segmented_view.css.scss +98 -0
  48. data/app/assets/stylesheets/cartilage/views/source_list_view.css.scss +65 -0
  49. data/app/assets/stylesheets/cartilage/views/split_view.css.scss +80 -0
  50. data/app/assets/stylesheets/cartilage/views/usage_bar_view.css.scss +101 -0
  51. data/app/assets/stylesheets/cartilage/views/view.css.scss +13 -0
  52. data/app/assets/stylesheets/cartilage.css.scss +5 -0
  53. data/lib/cartilage/engine.rb +14 -0
  54. data/lib/cartilage/version.rb +3 -0
  55. data/lib/cartilage.rb +5 -0
  56. data/lib/tasks/cartilage_tasks.rake +4 -0
  57. data/test/cartilage_test.rb +7 -0
  58. data/test/dummy/Rakefile +7 -0
  59. data/test/dummy/app/assets/javascripts/application.js +9 -0
  60. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  61. data/test/dummy/app/controllers/application_controller.rb +3 -0
  62. data/test/dummy/app/helpers/application_helper.rb +2 -0
  63. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  64. data/test/dummy/config/application.rb +45 -0
  65. data/test/dummy/config/boot.rb +10 -0
  66. data/test/dummy/config/database.yml +25 -0
  67. data/test/dummy/config/environment.rb +5 -0
  68. data/test/dummy/config/environments/development.rb +30 -0
  69. data/test/dummy/config/environments/production.rb +60 -0
  70. data/test/dummy/config/environments/test.rb +42 -0
  71. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  72. data/test/dummy/config/initializers/inflections.rb +10 -0
  73. data/test/dummy/config/initializers/mime_types.rb +5 -0
  74. data/test/dummy/config/initializers/secret_token.rb +7 -0
  75. data/test/dummy/config/initializers/session_store.rb +8 -0
  76. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  77. data/test/dummy/config/locales/en.yml +5 -0
  78. data/test/dummy/config/routes.rb +58 -0
  79. data/test/dummy/config.ru +4 -0
  80. data/test/dummy/db/readme +6 -0
  81. data/test/dummy/public/404.html +26 -0
  82. data/test/dummy/public/422.html +26 -0
  83. data/test/dummy/public/500.html +26 -0
  84. data/test/dummy/public/favicon.ico +0 -0
  85. data/test/dummy/script/rails +6 -0
  86. data/test/framework/cartilage/application_test.js.coffee +14 -0
  87. data/test/framework/cartilage/views/bar_segment_view_test.js.coffee +5 -0
  88. data/test/framework/cartilage/views/bar_view_test.js.coffee +30 -0
  89. data/test/framework/cartilage/views/image_view_test.js.coffee +27 -0
  90. data/test/framework/cartilage/views/list_view_item_test.js.coffee +17 -0
  91. data/test/framework/cartilage/views/list_view_test.js.coffee +190 -0
  92. data/test/framework/cartilage/views/loading_indicator_view_test.js.coffee +5 -0
  93. data/test/framework/cartilage/views/matrix_view_item_test.js.coffee +5 -0
  94. data/test/framework/cartilage/views/matrix_view_test.js.coffee +5 -0
  95. data/test/framework/cartilage/views/popover_view_test.js.coffee +5 -0
  96. data/test/framework/cartilage/views/source_list_view_item_test.js.coffee +5 -0
  97. data/test/framework/cartilage/views/source_list_view_test.js.coffee +5 -0
  98. data/test/framework/cartilage/views/split_view_test.js.coffee +5 -0
  99. data/test/framework/cartilage/views/usage_bar_view_test.js.coffee +5 -0
  100. data/test/framework/cartilage/views/view_test.js.coffee +85 -0
  101. data/test/framework/extensions/properties_test.js.coffee +82 -0
  102. data/test/framework/extensions/underscore_test.js.coffee +73 -0
  103. data/test/framework/index.html +72 -0
  104. data/test/framework/vendor/backbone.js +1431 -0
  105. data/test/framework/vendor/coffee-script.js +8 -0
  106. data/test/framework/vendor/jquery.js +9440 -0
  107. data/test/framework/vendor/phantomjs-runner.js +196 -0
  108. data/test/framework/vendor/qunit.css +235 -0
  109. data/test/framework/vendor/qunit.js +1977 -0
  110. data/test/framework/vendor/run-qunit.js +81 -0
  111. data/test/framework/vendor/sinon-1.5.0.js +4142 -0
  112. data/test/framework/vendor/sinon-qunit-1.0.0.js +62 -0
  113. data/test/framework/vendor/underscore.js +1059 -0
  114. data/test/test_helper.rb +10 -0
  115. metadata +373 -0
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Qt+WebKit powered (mostly) headless test runner using Phantomjs
3
+ *
4
+ * Run with:
5
+ * phantomjs qunit-runner.js [url-of-testsuite] [classname] [logfile]
6
+ *
7
+ * E.g.
8
+ * phantomjs qunit-runner.js http://localhost/test myclass log.xml
9
+ *
10
+ * @author Rob Gietema
11
+ * @licstart The following is the entire license notice for the JavaScript
12
+ * code in this page.
13
+ *
14
+ * Copyright (C) 2011-2012 Four Digits
15
+ *
16
+ * @licend The above is the entire license notice for the JavaScript code in
17
+ * this page.
18
+ * @version 0.1
19
+ */
20
+
21
+ /*global require: false, phantom: false, console: false */
22
+ /*jshint white: true, browser: true, onevar: true, undef: true,
23
+ eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true,
24
+ immed: true, strict: false, maxlen: 80, maxerr: 9999 */
25
+
26
+ var fs = require('fs');
27
+ var url = phantom.args[0];
28
+ var classname = phantom.args[1];
29
+ var logfile = phantom.args[2];
30
+ var page = require('webpage').create();
31
+
32
+ var startTime = new Date();
33
+
34
+ function printTime(msg) {
35
+ console.log(msg + " on " + (new Date().getTime() - startTime) / 1000);
36
+ }
37
+
38
+ function finished() {
39
+ return page.evaluate(function () {
40
+ return !!window.jshint_result;
41
+ });
42
+ }
43
+
44
+ function onfinishedTests() {
45
+ printTime('onfinishedtests');
46
+ var result = page.evaluate(function () {
47
+ return window.qunitDone;
48
+ }),
49
+ output = page.evaluate(function () {
50
+ return JSON.stringify(window.qunitDone);
51
+ }),
52
+ jscoverage = page.evaluate(function () {
53
+ return window.jscoverage;
54
+ }),
55
+ jshint = page.evaluate(function () {
56
+ return window.jshint_result;
57
+ }),
58
+ f = fs.open(logfile, "w"),
59
+ string = '<?xml version="1.0" encoding="UTF-8"?>',
60
+ file,
61
+ total_lines,
62
+ touched_lines,
63
+ global_total_lines,
64
+ global_touched_lines,
65
+ data,
66
+ source,
67
+ i,
68
+ j,
69
+ testcase,
70
+ testcasetime;
71
+
72
+ string += '<testsuites>';
73
+
74
+ // Output unittests
75
+ string += '<testsuite name="OE" tests="' + result.total +
76
+ '" errors="0" failures="' + result.failed + '" skip="0">';
77
+ testcasetime = (result.runtime / 1000) / result.total;
78
+
79
+ for (i = 0; i < result.testcases.length; i += 1) {
80
+ testcase = result.testcases[i];
81
+ if (testcase.result) {
82
+ string += '<testcase classname="' + classname +
83
+ '" name="unittest: ' + testcase.message +
84
+ '" time="' + testcasetime + '" />';
85
+ } else {
86
+ string += '<testcase classname="' + classname +
87
+ '" name="unittest: ' + testcase.message +
88
+ '" time="' + testcasetime + '">';
89
+ string += '<failure message="Expected: ' +
90
+ testcase.expected + ', got: ' + testcase.actual + '"/>';
91
+ string += '</testcase>';
92
+ }
93
+ }
94
+
95
+ string += '</testsuite>';
96
+
97
+ // Output jshint tests
98
+ for (file = 0; file < jshint.length; file += 1) {
99
+ if (jshint[file].pass) {
100
+ string += '<testsuite name="OE" tests="1" errors="0" ' +
101
+ 'failures="0" skip="0">';
102
+ string += '<testcase classname="' + classname +
103
+ '" name="jshint: ' + jshint[file].file +
104
+ '" time="" />';
105
+ } else {
106
+ string += '<testsuite name="OE" tests="1" errors="0" ' +
107
+ 'failures="1" skip="0">';
108
+ string += '<testcase classname="' + classname +
109
+ '" name="jshint: ' + jshint[file].file +
110
+ '" time=""><failure message=""/></testcase><system-out>';
111
+
112
+ for (j = 0; j < jshint[file].errors.length; j += 1) {
113
+ string += jshint[file].errors[j] + '\n';
114
+ }
115
+ string += '</system-out>';
116
+ }
117
+ string += '</testsuite>';
118
+ }
119
+
120
+ string += '</testsuites>';
121
+
122
+ f.write(string);
123
+ f.close();
124
+
125
+ f = fs.open(logfile.replace('.xml', 'coverage.xml'), "w"),
126
+
127
+ global_total_lines = 0;
128
+ global_touched_lines = 0;
129
+ for (i = 0; i < jscoverage.length; i += 1) {
130
+ file = jscoverage[i];
131
+ global_total_lines += file.lines;
132
+ global_touched_lines += file.touched;
133
+ }
134
+
135
+ string = '<?xml version="1.0" ?>';
136
+ string += '<!DOCTYPE coverage SYSTEM ';
137
+ string += '\'http://cobertura.sourceforge.net/xml/coverage-03.dtd\'>';
138
+ string += '<coverage branch-rate="0" line-rate="';
139
+ string += (global_touched_lines / global_total_lines);
140
+ string += '" timestamp="' + 1339598625471 + '" version="3.5.2">';
141
+ string += '<packages>';
142
+ string += '<package branch-rate="0" complexity="0" line-rate="';
143
+ string += (global_touched_lines / global_total_lines);
144
+ string += '" name="' + classname + '">';
145
+ string += '<classes>';
146
+
147
+ for (i = 0; i < jscoverage.length; i += 1) {
148
+ file = jscoverage[i];
149
+ string += '<class branch-rate="0" complexity="0" filename="';
150
+ string += file.name;
151
+ string += '" line-rate="' + (file.touched / file.lines);
152
+ string += '" name="' + classname + '">';
153
+ string += '<methods/>';
154
+ string += '<lines>';
155
+
156
+ for (j = 0; j < file.linescount.length; j += 1) {
157
+ string += '<line hits="';
158
+ string += file.linescount[j].count;
159
+ string += '" number="';
160
+ string += file.linescount[j].line;
161
+ string += '"/>';
162
+ }
163
+
164
+ string += '</lines>';
165
+ string += '</class>';
166
+ }
167
+
168
+ string += '</classes>';
169
+ string += '</package>';
170
+ string += '</packages>';
171
+ string += '</coverage>';
172
+
173
+ f.write(string);
174
+ f.close();
175
+
176
+ phantom.exit(JSON.parse(output).failed > 0 ? 1 : 0);
177
+ }
178
+
179
+ page.onConsoleMessage = function (msg) {
180
+ console.log(msg);
181
+ };
182
+
183
+ printTime('opening page');
184
+ page.open(url, function (status) {
185
+ if (status !== "success") {
186
+ console.log("Unable to access network: " + status);
187
+ phantom.exit(1);
188
+ } else {
189
+ var interval = setInterval(function () {
190
+ if (finished()) {
191
+ clearInterval(interval);
192
+ onfinishedTests();
193
+ }
194
+ }, 500);
195
+ }
196
+ });
@@ -0,0 +1,235 @@
1
+ /**
2
+ * QUnit v1.10.0 - A JavaScript Unit Testing Framework
3
+ *
4
+ * http://qunitjs.com
5
+ *
6
+ * Copyright 2012 jQuery Foundation and other contributors
7
+ * Released under the MIT license.
8
+ * http://jquery.org/license
9
+ */
10
+
11
+ /** Font Family and Sizes */
12
+
13
+ #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
14
+ font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
15
+ }
16
+
17
+ #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
18
+ #qunit-tests { font-size: smaller; }
19
+
20
+
21
+ /** Resets */
22
+
23
+ #qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
24
+ margin: 0;
25
+ padding: 0;
26
+ }
27
+
28
+
29
+ /** Header */
30
+
31
+ #qunit-header {
32
+ padding: 0.5em 0 0.5em 1em;
33
+
34
+ color: #8699a4;
35
+ background-color: #0d3349;
36
+
37
+ font-size: 1.5em;
38
+ line-height: 1em;
39
+ font-weight: normal;
40
+
41
+ border-radius: 5px 5px 0 0;
42
+ -moz-border-radius: 5px 5px 0 0;
43
+ -webkit-border-top-right-radius: 5px;
44
+ -webkit-border-top-left-radius: 5px;
45
+ }
46
+
47
+ #qunit-header a {
48
+ text-decoration: none;
49
+ color: #c2ccd1;
50
+ }
51
+
52
+ #qunit-header a:hover,
53
+ #qunit-header a:focus {
54
+ color: #fff;
55
+ }
56
+
57
+ #qunit-testrunner-toolbar label {
58
+ display: inline-block;
59
+ padding: 0 .5em 0 .1em;
60
+ }
61
+
62
+ #qunit-banner {
63
+ height: 5px;
64
+ }
65
+
66
+ #qunit-testrunner-toolbar {
67
+ padding: 0.5em 0 0.5em 2em;
68
+ color: #5E740B;
69
+ background-color: #eee;
70
+ overflow: hidden;
71
+ }
72
+
73
+ #qunit-userAgent {
74
+ padding: 0.5em 0 0.5em 2.5em;
75
+ background-color: #2b81af;
76
+ color: #fff;
77
+ text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
78
+ }
79
+
80
+ #qunit-modulefilter-container {
81
+ float: right;
82
+ }
83
+
84
+ /** Tests: Pass/Fail */
85
+
86
+ #qunit-tests {
87
+ list-style-position: inside;
88
+ }
89
+
90
+ #qunit-tests li {
91
+ padding: 0.4em 0.5em 0.4em 2.5em;
92
+ border-bottom: 1px solid #fff;
93
+ list-style-position: inside;
94
+ }
95
+
96
+ #qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
97
+ display: none;
98
+ }
99
+
100
+ #qunit-tests li strong {
101
+ cursor: pointer;
102
+ }
103
+
104
+ #qunit-tests li a {
105
+ padding: 0.5em;
106
+ color: #c2ccd1;
107
+ text-decoration: none;
108
+ }
109
+ #qunit-tests li a:hover,
110
+ #qunit-tests li a:focus {
111
+ color: #000;
112
+ }
113
+
114
+ #qunit-tests ol {
115
+ margin-top: 0.5em;
116
+ padding: 0.5em;
117
+
118
+ background-color: #fff;
119
+
120
+ border-radius: 5px;
121
+ -moz-border-radius: 5px;
122
+ -webkit-border-radius: 5px;
123
+ }
124
+
125
+ #qunit-tests table {
126
+ border-collapse: collapse;
127
+ margin-top: .2em;
128
+ }
129
+
130
+ #qunit-tests th {
131
+ text-align: right;
132
+ vertical-align: top;
133
+ padding: 0 .5em 0 0;
134
+ }
135
+
136
+ #qunit-tests td {
137
+ vertical-align: top;
138
+ }
139
+
140
+ #qunit-tests pre {
141
+ margin: 0;
142
+ white-space: pre-wrap;
143
+ word-wrap: break-word;
144
+ }
145
+
146
+ #qunit-tests del {
147
+ background-color: #e0f2be;
148
+ color: #374e0c;
149
+ text-decoration: none;
150
+ }
151
+
152
+ #qunit-tests ins {
153
+ background-color: #ffcaca;
154
+ color: #500;
155
+ text-decoration: none;
156
+ }
157
+
158
+ /*** Test Counts */
159
+
160
+ #qunit-tests b.counts { color: black; }
161
+ #qunit-tests b.passed { color: #5E740B; }
162
+ #qunit-tests b.failed { color: #710909; }
163
+
164
+ #qunit-tests li li {
165
+ padding: 5px;
166
+ background-color: #fff;
167
+ border-bottom: none;
168
+ list-style-position: inside;
169
+ }
170
+
171
+ /*** Passing Styles */
172
+
173
+ #qunit-tests li li.pass {
174
+ color: #3c510c;
175
+ background-color: #fff;
176
+ border-left: 10px solid #C6E746;
177
+ }
178
+
179
+ #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
180
+ #qunit-tests .pass .test-name { color: #366097; }
181
+
182
+ #qunit-tests .pass .test-actual,
183
+ #qunit-tests .pass .test-expected { color: #999999; }
184
+
185
+ #qunit-banner.qunit-pass { background-color: #C6E746; }
186
+
187
+ /*** Failing Styles */
188
+
189
+ #qunit-tests li li.fail {
190
+ color: #710909;
191
+ background-color: #fff;
192
+ border-left: 10px solid #EE5757;
193
+ white-space: pre;
194
+ }
195
+
196
+ #qunit-tests > li:last-child {
197
+ border-radius: 0 0 5px 5px;
198
+ -moz-border-radius: 0 0 5px 5px;
199
+ -webkit-border-bottom-right-radius: 5px;
200
+ -webkit-border-bottom-left-radius: 5px;
201
+ }
202
+
203
+ #qunit-tests .fail { color: #000000; background-color: #EE5757; }
204
+ #qunit-tests .fail .test-name,
205
+ #qunit-tests .fail .module-name { color: #000000; }
206
+
207
+ #qunit-tests .fail .test-actual { color: #EE5757; }
208
+ #qunit-tests .fail .test-expected { color: green; }
209
+
210
+ #qunit-banner.qunit-fail { background-color: #EE5757; }
211
+
212
+
213
+ /** Result */
214
+
215
+ #qunit-testresult {
216
+ padding: 0.5em 0.5em 0.5em 2.5em;
217
+
218
+ color: #2b81af;
219
+ background-color: #D2E0E6;
220
+
221
+ border-bottom: 1px solid white;
222
+ }
223
+ #qunit-testresult .module-name {
224
+ font-weight: bold;
225
+ }
226
+
227
+ /** Fixture */
228
+
229
+ #qunit-fixture {
230
+ position: absolute;
231
+ top: -10000px;
232
+ left: -10000px;
233
+ width: 1000px;
234
+ height: 1000px;
235
+ }