repla 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/lib/applescript/{load_html.scpt → load.scpt} +0 -0
  3. data/lib/applescript/{load_html_with_base_url.scpt → load_with_root_access_directory.scpt} +0 -0
  4. data/lib/repla/dependencies/html/index.html +25 -0
  5. data/lib/repla/dependencies/lib/view.rb +5 -5
  6. data/lib/repla/dependencies.rb +1 -2
  7. data/lib/repla/lib/constants.rb +0 -2
  8. data/lib/repla/lib/module.rb +1 -24
  9. data/lib/repla/lib/view/javascript.rb +7 -1
  10. data/lib/repla/lib/view/resources.rb +0 -38
  11. data/lib/repla/lib/view.rb +0 -1
  12. data/lib/repla/lib/window.rb +10 -15
  13. data/lib/repla/logger/test/Rakefile +7 -9
  14. data/lib/repla/logger/test/lib/test_setup.rb +10 -0
  15. data/lib/repla/logger/test/lib/test_view_helper.rb +1 -1
  16. data/lib/repla/logger/test/run_tests.sh +3 -1
  17. data/lib/repla/logger/test/tc_logger.rb +18 -21
  18. data/lib/repla/logger.rb +1 -2
  19. data/lib/repla/repl/html/index.html +22 -0
  20. data/lib/repla/repl/lib/view.rb +5 -50
  21. data/lib/repla/repl.rb +1 -2
  22. data/lib/repla/resources/css/raster.css +131 -0
  23. data/lib/repla/resources/js/bullets/Gruntfile.js +30 -0
  24. data/lib/repla/resources/js/bullets/README.md +3 -0
  25. data/lib/repla/resources/js/bullets/bullets.js +82 -0
  26. data/lib/repla/resources/js/bullets/example/css/bullets.css +6 -0
  27. data/lib/repla/resources/js/bullets/example/css/raster.css +131 -0
  28. data/lib/repla/resources/js/bullets/example/css/style.css +7 -0
  29. data/lib/repla/resources/js/bullets/example/index.html +137 -0
  30. data/lib/repla/resources/js/bullets/example/jade/content.jade +10 -0
  31. data/lib/repla/resources/js/bullets/example/jade/css.jade +3 -0
  32. data/lib/repla/resources/js/bullets/example/jade/index.jade +10 -0
  33. data/lib/repla/resources/js/bullets/example/jade/javascript.jade +5 -0
  34. data/lib/repla/resources/js/bullets/example/js/handlebars.js +2278 -0
  35. data/lib/repla/resources/js/bullets/example/js/jquery.js +9789 -0
  36. data/lib/repla/resources/js/bullets/example/js/mousetrap.js +910 -0
  37. data/lib/repla/resources/js/bullets/example/js/mousetrap_config.js +14 -0
  38. data/lib/repla/resources/js/bullets/example/js/zepto.js +1565 -0
  39. data/lib/repla/resources/js/bullets/package.json +28 -0
  40. data/lib/repla/resources/js/bullets/test/lib/css/mocha.css +270 -0
  41. data/lib/repla/resources/js/bullets/test/lib/index.html +153 -0
  42. data/lib/repla/resources/js/bullets/test/lib/jade/index.jade +13 -0
  43. data/lib/repla/resources/js/bullets/test/lib/jade/mocha.html +15 -0
  44. data/lib/repla/resources/js/bullets/test/lib/js/chai.js +4613 -0
  45. data/lib/repla/resources/js/bullets/test/lib/js/mocha.js +5726 -0
  46. data/lib/repla/resources/js/bullets/test/lib/js/test_helper.js +26 -0
  47. data/lib/repla/resources/js/bullets/test/run_tests.rb +7 -0
  48. data/lib/repla/resources/js/bullets/test/test.js +131 -0
  49. data/lib/repla/resources/js/handlebars.js +2278 -0
  50. data/lib/repla/resources/js/mousetrap.js +910 -0
  51. data/lib/repla/resources/js/zepto.js +1565 -0
  52. data/lib/repla/test/applescript/cancel_dialog.applescript +2 -0
  53. data/lib/repla/test/applescript/confirm_dialog.applescript +2 -0
  54. data/lib/repla/test/applescript/is_running.applescript +5 -0
  55. data/lib/repla/test/applescript/quit.applescript +3 -0
  56. data/lib/repla/test/applescript/set_window_bounds.applescript +23 -0
  57. data/lib/repla/test/applescript/switch_windows.applescript +2 -0
  58. data/lib/repla/test/applescript/window_bounds.applescript +20 -0
  59. data/lib/repla/test/applescript/window_id.applescript +7 -0
  60. data/lib/repla/test/bundles/Cat.wcplugin/Contents/Info.plist +14 -0
  61. data/lib/repla/test/bundles/Cat.wcplugin/Contents/Resources/cat.sh +3 -0
  62. data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Info.plist +14 -0
  63. data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Resources/hello_world.rb +3 -0
  64. data/lib/repla/test/bundles/Invalid.wcplugin/Contents/Info.plist +16 -0
  65. data/lib/repla/test/bundles/Print.wcplugin/Contents/Info.plist +16 -0
  66. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/css/style.css +7 -0
  67. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/index.html +24 -0
  68. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/js/wcprint.js +8 -0
  69. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb +18 -0
  70. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb +13 -0
  71. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/print.rb +10 -0
  72. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Info.plist +14 -0
  73. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/constants.rb +1 -0
  74. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/test_environment.rb +35 -0
  75. data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Info.plist +16 -0
  76. data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Resources/test_log.rb +13 -0
  77. data/lib/repla/test/html/index.html +36 -0
  78. data/lib/repla/test/html/indexjquery.html +37 -0
  79. data/lib/repla/test/html/js/zepto.js +1565 -0
  80. data/lib/repla/test/js/firstcode.js +3 -0
  81. data/lib/repla/test/js/lastcode.js +3 -0
  82. data/lib/repla/test/js/nodom.js +5 -0
  83. data/lib/repla/test/js/text.js +1 -0
  84. data/lib/repla/test/js/textjquery.js +1 -0
  85. data/lib/repla/test/js/title.js +1 -0
  86. data/lib/repla/test/lib/helper.rb +121 -0
  87. data/lib/repla/test.rb +51 -0
  88. data/lib/repla.rb +6 -6
  89. metadata +78 -14
  90. data/lib/repla/dependencies/views/view.html.erb +0 -25
  91. data/lib/repla/extension_constants.rb +0 -1
  92. data/lib/repla/lib/view/erb.rb +0 -17
  93. data/lib/repla/logger/test/lib/test_constants.rb +0 -8
  94. data/lib/repla/repl/view/view.html.erb +0 -12
  95. /data/lib/repla/dependencies/{css → html/css}/style.css +0 -0
  96. /data/lib/repla/dependencies/{js → html/js}/wcdependencies.js +0 -0
  97. /data/lib/repla/repl/{css → html/css}/style.css +0 -0
  98. /data/lib/repla/repl/{js → html/js}/wcrepl.js +0 -0
@@ -0,0 +1,30 @@
1
+ module.exports = function(grunt) {
2
+ grunt.initConfig({
3
+ pkg: grunt.file.readJSON('package.json'),
4
+ jade: {
5
+ options: {
6
+ pretty: true
7
+ },
8
+ no_options: {
9
+ files: {
10
+ 'example/index.html': ['example/jade/index.jade'],
11
+ 'test/lib/index.html': ['test/lib/jade/index.jade']
12
+ }
13
+ }
14
+ },
15
+ watch: {
16
+ scripts: {
17
+ files: ['**/*.jade'],
18
+ tasks: ['jade'],
19
+ options: {
20
+ spawn: false,
21
+ },
22
+ },
23
+ },
24
+ });
25
+
26
+ grunt.loadNpmTasks('grunt-contrib-jade');
27
+ grunt.loadNpmTasks('grunt-contrib-watch');
28
+
29
+ grunt.registerTask('default', ['jade']);
30
+ };
@@ -0,0 +1,3 @@
1
+ # Bullets.js
2
+
3
+ A simple library to give outliner functionality to an HTML document.
@@ -0,0 +1,82 @@
1
+ var Bullets = {
2
+
3
+ // Public
4
+ tags: 'a',
5
+ selected: 'selected',
6
+ get selection () {
7
+ if (document.body != document.activeElement) {
8
+ return $(document.activeElement);
9
+ }
10
+ return $(Bullets.selectedID);
11
+ },
12
+
13
+ // Private
14
+ nextOffset: 1,
15
+ previousOffset: -1,
16
+ get selectedID () {
17
+ return '#' + Bullets.selected;
18
+ },
19
+
20
+ // Public
21
+ selectNext: function() {
22
+ this.selectOffset(this.nextOffset);
23
+ },
24
+ selectPrevious: function() {
25
+ this.selectOffset(this.previousOffset);
26
+ },
27
+
28
+ // Private
29
+ selectOffset: function(offset) {
30
+ var tags = $(this.tags);
31
+ if (!tags.length > 0) {
32
+ this.nothingToSelect();
33
+ return;
34
+ }
35
+
36
+ var selection = this.selection;
37
+ if (!selection.length > 0) {
38
+ // Nothing selection, select first or last element
39
+ var select;
40
+ if (offset > 0) {
41
+ select = tags.first();
42
+ } else {
43
+ select = tags.last();
44
+ }
45
+ this.select(select);
46
+ return;
47
+ }
48
+ var indexToSelect = tags.index(selection) + offset;
49
+ var tag = tags.eq(indexToSelect);
50
+ if (!tag.length > 0 || indexToSelect < 0) {
51
+ // No next tag was found.
52
+ // Ignore indexes less than zero to prevent wrapping.
53
+ this.nothingToSelect();
54
+ return;
55
+ }
56
+ this.select(tag);
57
+ },
58
+
59
+ followSelection: function() {
60
+ var selection = this.selection;
61
+ var address = selection.attr('href');
62
+ window.location = address;
63
+ },
64
+ select: function(object) {
65
+ this.deselect();
66
+ object.focus();
67
+ object.attr('id', Bullets.selected);
68
+ },
69
+
70
+ deselect: function(object) {
71
+ object = object || this.selection;
72
+ if (object.length > 0) {
73
+ object.blur();
74
+ object.removeAttr('id');
75
+ }
76
+ },
77
+
78
+ nothingToSelect: function() {
79
+ // TODO Beep or visual bell here?
80
+ console.log("Nothing to select");
81
+ }
82
+ }
@@ -0,0 +1,6 @@
1
+ #selected {
2
+ background-color: #BCD7D5;
3
+ }
4
+ #selected:focus {
5
+ background-color: #A7C1D7;
6
+ }
@@ -0,0 +1,131 @@
1
+ /* Settings */
2
+ /* Eric Meyer's Reset
3
+ ============================================================================*/
4
+ /* Details here:
5
+ http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
6
+
7
+ Some of the rules have been broken up for cleaner display in firebug. */
8
+ /* First the resets ... */
9
+ /* Structural Tags
10
+ ----------------------------------------------------------------------------*/
11
+ html, body, div, span {
12
+ margin: 0;
13
+ padding: 0;
14
+ border: 0;
15
+ outline: 0;
16
+ font-size: 100%;
17
+ vertical-align: baseline;
18
+ background: transparent; }
19
+
20
+ /* Text Tags
21
+ ----------------------------------------------------------------------------*/
22
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, ol, ul, li, strong, em {
23
+ margin: 0;
24
+ padding: 0;
25
+ border: 0;
26
+ outline: 0;
27
+ font-size: 100%;
28
+ vertical-align: baseline;
29
+ background: transparent; }
30
+
31
+ /* Less Used Tags
32
+ ----------------------------------------------------------------------------*/
33
+ applet, object, iframe, abbr, acronym, address, big, cite, code, del, dfn,
34
+ font, img, ins, kbd, q, s, samp, small, strike, sub, sup, tt, var, b, u, i,
35
+ center, dl, dt, dd, fieldset, form, label, legend, table, caption, tbody,
36
+ tfoot, thead, tr, th, td {
37
+ margin: 0;
38
+ padding: 0;
39
+ border: 0;
40
+ outline: 0;
41
+ font-size: 100%;
42
+ vertical-align: baseline;
43
+ background: transparent; }
44
+
45
+ /* ... and now everything else */
46
+ /* remember to define focus styles! */
47
+ :focus {
48
+ outline: 0; }
49
+
50
+ body {
51
+ line-height: 1;
52
+ color: black;
53
+ background: white; }
54
+
55
+ ol, ul {
56
+ list-style: none; }
57
+
58
+ /* tables still need 'cellspacing="0"' in the markup */
59
+ table {
60
+ border-collapse: separate;
61
+ border-spacing: 0; }
62
+
63
+ caption, th, td {
64
+ text-align: left;
65
+ font-weight: normal; }
66
+
67
+ blockquote:before, blockquote:after, q:before, q:after {
68
+ content: ""; }
69
+
70
+ blockquote, q {
71
+ quotes: "" ""; }
72
+
73
+ body {
74
+ font-size: 0.75em;
75
+ line-height: 1.41667em; }
76
+
77
+ h1 {
78
+ font-size: 3em;
79
+ line-height: 1.41667em;
80
+ margin-bottom: 0.47222em;
81
+ line-height: 1.41667em;
82
+ margin-bottom: 0.47222em; }
83
+
84
+ h2 {
85
+ font-size: 2em;
86
+ line-height: 1.41667em;
87
+ margin-bottom: 0.70833em;
88
+ line-height: 1.41667em;
89
+ margin-bottom: 0.70833em; }
90
+
91
+ h3 {
92
+ font-size: 1.75em;
93
+ line-height: 1.41667em;
94
+ margin-bottom: 0.20238em;
95
+ line-height: 1.42857em;
96
+ margin-bottom: 0.19048em; }
97
+
98
+ h4 {
99
+ font-size: 1.5em;
100
+ line-height: 1.41667em;
101
+ margin-bottom: 0.47222em;
102
+ line-height: 1.44444em;
103
+ margin-bottom: 0.44444em; }
104
+
105
+ h5 {
106
+ font-size: 1.16667em;
107
+ line-height: 1.41667em;
108
+ margin-bottom: 1.0119em;
109
+ line-height: 1.42857em;
110
+ margin-bottom: 1em; }
111
+
112
+ h6 {
113
+ font-size: 1em;
114
+ line-height: 1.41667em;
115
+ margin-bottom: 1.41667em;
116
+ line-height: 1.41667em;
117
+ margin-bottom: 1.41667em; }
118
+
119
+ p, ul, ol {
120
+ margin-bottom: 1.41667em; }
121
+
122
+ ul {
123
+ list-style-type: disc;
124
+ margin-left: 2em; }
125
+
126
+ ol {
127
+ list-style-type: decimal;
128
+ margin-left: 2em; }
129
+
130
+ body {
131
+ padding: 1.41667em; }
@@ -0,0 +1,7 @@
1
+ body {
2
+ font-family: "Menlo", monospace;
3
+ }
4
+ li {
5
+ list-style: none;
6
+ white-space: pre-wrap;
7
+ }
@@ -0,0 +1,137 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Bullets Demo</title>
6
+ <link rel="stylesheet" href="./css/bullets.css">
7
+ <link rel="stylesheet" href="./css/raster.css">
8
+ <link rel="stylesheet" href="./css/style.css">
9
+ <script src="./js/handlebars.js"></script>
10
+ <script src="./js/jquery.js"></script>
11
+ <script src="./js/mousetrap.js"></script>
12
+ <script src="./js/mousetrap_config.js"></script>
13
+ <script src="./../bullets.js"></script>
14
+ </head>
15
+ <body>
16
+ <section>
17
+ <header>
18
+ <h5><a href="google.com">Anchor 0</a></h5>
19
+ <ul>
20
+ <li>List Item 0</li>
21
+ <li>List Item 1</li>
22
+ <li>List Item 2</li>
23
+ <li>List Item 3</li>
24
+ <li>List Item 4</li>
25
+ </ul>
26
+ </header>
27
+ </section>
28
+ <section>
29
+ <header>
30
+ <h5><a href="google.com">Anchor 1</a></h5>
31
+ <ul>
32
+ <li>List Item 0</li>
33
+ <li>List Item 1</li>
34
+ <li>List Item 2</li>
35
+ <li>List Item 3</li>
36
+ <li>List Item 4</li>
37
+ </ul>
38
+ </header>
39
+ </section>
40
+ <section>
41
+ <header>
42
+ <h5><a href="google.com">Anchor 2</a></h5>
43
+ <ul>
44
+ <li>List Item 0</li>
45
+ <li>List Item 1</li>
46
+ <li>List Item 2</li>
47
+ <li>List Item 3</li>
48
+ <li>List Item 4</li>
49
+ </ul>
50
+ </header>
51
+ </section>
52
+ <section>
53
+ <header>
54
+ <h5><a href="google.com">Anchor 3</a></h5>
55
+ <ul>
56
+ <li>List Item 0</li>
57
+ <li>List Item 1</li>
58
+ <li>List Item 2</li>
59
+ <li>List Item 3</li>
60
+ <li>List Item 4</li>
61
+ </ul>
62
+ </header>
63
+ </section>
64
+ <section>
65
+ <header>
66
+ <h5><a href="google.com">Anchor 4</a></h5>
67
+ <ul>
68
+ <li>List Item 0</li>
69
+ <li>List Item 1</li>
70
+ <li>List Item 2</li>
71
+ <li>List Item 3</li>
72
+ <li>List Item 4</li>
73
+ </ul>
74
+ </header>
75
+ </section>
76
+ <section>
77
+ <header>
78
+ <h5><a href="google.com">Anchor 5</a></h5>
79
+ <ul>
80
+ <li>List Item 0</li>
81
+ <li>List Item 1</li>
82
+ <li>List Item 2</li>
83
+ <li>List Item 3</li>
84
+ <li>List Item 4</li>
85
+ </ul>
86
+ </header>
87
+ </section>
88
+ <section>
89
+ <header>
90
+ <h5><a href="google.com">Anchor 6</a></h5>
91
+ <ul>
92
+ <li>List Item 0</li>
93
+ <li>List Item 1</li>
94
+ <li>List Item 2</li>
95
+ <li>List Item 3</li>
96
+ <li>List Item 4</li>
97
+ </ul>
98
+ </header>
99
+ </section>
100
+ <section>
101
+ <header>
102
+ <h5><a href="google.com">Anchor 7</a></h5>
103
+ <ul>
104
+ <li>List Item 0</li>
105
+ <li>List Item 1</li>
106
+ <li>List Item 2</li>
107
+ <li>List Item 3</li>
108
+ <li>List Item 4</li>
109
+ </ul>
110
+ </header>
111
+ </section>
112
+ <section>
113
+ <header>
114
+ <h5><a href="google.com">Anchor 8</a></h5>
115
+ <ul>
116
+ <li>List Item 0</li>
117
+ <li>List Item 1</li>
118
+ <li>List Item 2</li>
119
+ <li>List Item 3</li>
120
+ <li>List Item 4</li>
121
+ </ul>
122
+ </header>
123
+ </section>
124
+ <section>
125
+ <header>
126
+ <h5><a href="google.com">Anchor 9</a></h5>
127
+ <ul>
128
+ <li>List Item 0</li>
129
+ <li>List Item 1</li>
130
+ <li>List Item 2</li>
131
+ <li>List Item 3</li>
132
+ <li>List Item 4</li>
133
+ </ul>
134
+ </header>
135
+ </section>
136
+ </body>
137
+ </html>
@@ -0,0 +1,10 @@
1
+ - var sections = 10
2
+ - var sectionSize = 5
3
+ - for (var section = 0; section < sections; section++)
4
+ section
5
+ header
6
+ h5
7
+ a(href='google.com') Anchor #{section}
8
+ ul
9
+ - for (var listItem = 0; listItem < sectionSize; listItem++)
10
+ li List Item #{listItem}
@@ -0,0 +1,3 @@
1
+ link(rel='stylesheet', href=resourceBasePath + 'css/bullets.css')
2
+ link(rel='stylesheet', href=resourceBasePath + 'css/raster.css')
3
+ link(rel='stylesheet', href=resourceBasePath + 'css/style.css')
@@ -0,0 +1,10 @@
1
+ doctype 5
2
+ html(lang="en")
3
+ head
4
+ meta(charset="utf-8")
5
+ title= "Bullets Demo"
6
+ - var resourceBasePath = './'
7
+ include css.jade
8
+ include javascript.jade
9
+ body
10
+ include content.jade
@@ -0,0 +1,5 @@
1
+ script(src=resourceBasePath + 'js/handlebars.js')
2
+ script(src=resourceBasePath + 'js/jquery.js')
3
+ script(src=resourceBasePath + 'js/mousetrap.js')
4
+ script(src=resourceBasePath + 'js/mousetrap_config.js')
5
+ script(src=resourceBasePath + '../bullets.js')