opal-irb 0.7.0

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 (54) hide show
  1. data/.gitignore +3 -0
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +14 -0
  5. data/Gemfile.lock +113 -0
  6. data/Guardfile +5 -0
  7. data/LICENSE +21 -0
  8. data/README.md +175 -0
  9. data/Rakefile +65 -0
  10. data/Roadmap.org +17 -0
  11. data/app/assets/stylesheets/opal-irb/jqconsole.css +263 -0
  12. data/compiled/app-embeddable.js +39765 -0
  13. data/compiled/app-jqconsole.js +39767 -0
  14. data/compiled/application.js +27399 -0
  15. data/css/ansi.css +172 -0
  16. data/css/opal_irb_jqconsole.css +79 -0
  17. data/css/show-hint.css +38 -0
  18. data/doc/presentations/opal_irb_overview.html +678 -0
  19. data/doc/presentations/opal_irb_overview.org +448 -0
  20. data/examples/app-embeddable.rb +8 -0
  21. data/examples/app-jqconsole.rb +10 -0
  22. data/examples/application.rb +8 -0
  23. data/index-embeddable.html +29 -0
  24. data/index-homebrew.html +115 -0
  25. data/index-jq.html +80 -0
  26. data/js/anyword-hint.js +44 -0
  27. data/js/jqconsole.js +1583 -0
  28. data/js/nodeutil.js +546 -0
  29. data/js/ruby.js +285 -0
  30. data/js/show-hint.js +383 -0
  31. data/lib/opal-irb/rails_engine.rb +3 -0
  32. data/lib/opal-irb/version.rb +3 -0
  33. data/lib/opal-irb-rails.rb +2 -0
  34. data/lib/opal-irb.rb +44 -0
  35. data/opal/object_extensions.rb +20 -0
  36. data/opal/opal_irb/completion_engine.rb +202 -0
  37. data/opal/opal_irb/completion_formatter.rb +49 -0
  38. data/opal/opal_irb/completion_results.rb +88 -0
  39. data/opal/opal_irb.rb +88 -0
  40. data/opal/opal_irb_homebrew_console.rb +398 -0
  41. data/opal/opal_irb_jqconsole.rb +517 -0
  42. data/opal/opal_irb_jqconsole_css.rb +259 -0
  43. data/opal/opal_irb_log_redirector.rb +32 -0
  44. data/opal/opal_phantomjs.rb +49 -0
  45. data/opal-irb.gemspec +20 -0
  46. data/spec/code_link_handler_spec.rb +30 -0
  47. data/spec/jquery.js +5 -0
  48. data/spec/object_extensions_spec.rb +32 -0
  49. data/spec/opal_irb/completion_engine_spec.rb +204 -0
  50. data/spec/opal_irb/completion_results_spec.rb +32 -0
  51. data/spec/opal_irb_log_director_spec.rb +19 -0
  52. data/spec/opal_irb_spec.rb +19 -0
  53. data/spec/spec_helper.rb +1 -0
  54. metadata +151 -0
data/index-jq.html ADDED
@@ -0,0 +1,80 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html>
4
+ <head>
5
+ <link rel="stylesheet" href="css/ansi.css" type="text/css" media="all" />
6
+
7
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
8
+ <script src="https://code.jquery.com/jquery-migrate-1.2.1.js"></script>
9
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
10
+ <script src="js/jqconsole.js"></script>
11
+ <style>
12
+ html, body {
13
+ background-color: #333;
14
+ color: white;
15
+ font-family: monospace;
16
+ margin: 0;
17
+ padding: 0;
18
+ }
19
+ #console {
20
+ height: 400px;
21
+ width: 750px;
22
+ position:relative;
23
+ background-color: #9b111e;
24
+ border: 2px solid #CCC;
25
+ margin: 0 auto;
26
+ margin-top: 50px;
27
+ }
28
+ .jqconsole {
29
+ padding: 10px;
30
+ padding-bottom: 10px;
31
+ }
32
+ .jqconsole-cursor {
33
+ background-color: #999;
34
+ }
35
+ .jqconsole-blurred .jqconsole-cursor {
36
+ background-color: #666;
37
+ }
38
+ .jqconsole-prompt {
39
+ color: #0d0;
40
+ }
41
+ .jqconsole-old-prompt {
42
+ color: #0b0;
43
+ font-weight: normal;
44
+ }
45
+ .jqconsole-input {
46
+ color: #dd0;
47
+ }
48
+ .jqconsole-old-input {
49
+ color: #bb0;
50
+ font-weight: normal;
51
+ }
52
+ .brace {
53
+ color: #00FFFF;
54
+ }
55
+ .paran {
56
+ color: #FF00FF;
57
+ }
58
+ .bracket {
59
+ color: #FFFF00;
60
+ }
61
+ .jqconsole-composition {
62
+ background-color: red;
63
+ }
64
+ </style>
65
+ <link rel="stylesheet" href="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
66
+ <link rel="stylesheet" href="https://codemirror.net/lib/codemirror.css"/>
67
+ <link rel="stylesheet" href="css/show-hint.css"/>
68
+ <script src="https://codemirror.net/lib/codemirror.js"></script>
69
+ <script type="text/javascript" src="https://codemirror.net/keymap/emacs.js"></script>
70
+ <script src="https://codemirror.net/mode/ruby/ruby.js"></script>
71
+ <script src="js/show-hint.js"></script>
72
+ <script src="js/anyword-hint.js"></script>
73
+ <script src="compiled/app-jqconsole.js"></script>
74
+ <script src="https://codemirror.net/mode/ruby/ruby.js"></script>
75
+
76
+ </head>
77
+ <body>
78
+ <div id="console"></div>
79
+ </body>
80
+ </html>
@@ -0,0 +1,44 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ var WORD = /[\w$]+/, RANGE = 500;
15
+
16
+ CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
17
+ var word = options && options.word || WORD;
18
+ var range = options && options.range || RANGE;
19
+ var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
20
+ var end = cur.ch, start = end;
21
+ while (start && word.test(curLine.charAt(start - 1))) --start;
22
+ var curWord = start != end && curLine.slice(start, end);
23
+ console.orig_log("word = |" + word + "| range = |" + range + "| cur = |" + cur + "| curLine = |" + curLine + "| end = |" + end + "| start = |" + start + "| curWord = |" + curWord + "|");
24
+
25
+
26
+ var list = [], seen = {};
27
+ var re = new RegExp(word.source, "g");
28
+ for (var dir = -1; dir <= 1; dir += 2) {
29
+ var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
30
+ for (; line != endLine; line += dir) {
31
+ var text = editor.getLine(line), m;
32
+ while (m = re.exec(text)) {
33
+ if (line == cur.line && m[0] === curWord) continue;
34
+ if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
35
+ seen[m[0]] = true;
36
+ list.push(m[0]);
37
+ }
38
+ }
39
+ }
40
+ }
41
+ console.orig_log(list);
42
+ return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
43
+ });
44
+ });