volt-browser_irb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/CODE_OF_CONDUCT.md +13 -0
  5. data/Gemfile +15 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +29 -0
  8. data/Rakefile +1 -0
  9. data/app/browser_irb/assets/css/app.css.scss +18 -0
  10. data/app/browser_irb/assets/js/jqconsole.css +39 -0
  11. data/app/browser_irb/assets/js/jqconsole.js +1 -0
  12. data/app/browser_irb/config/dependencies.rb +1 -0
  13. data/app/browser_irb/config/initializers/boot.rb +10 -0
  14. data/app/browser_irb/config/routes.rb +1 -0
  15. data/app/browser_irb/controllers/main_controller.rb +120 -0
  16. data/app/browser_irb/tasks/command_task.rb +15 -0
  17. data/app/browser_irb/views/main/index.html +1 -0
  18. data/lib/volt/browser_irb.rb +18 -0
  19. data/lib/volt/browser_irb/version.rb +5 -0
  20. data/spec/dummy/.gitignore +9 -0
  21. data/spec/dummy/README.md +4 -0
  22. data/spec/dummy/app/main/assets/css/app.css.scss +1 -0
  23. data/spec/dummy/app/main/config/dependencies.rb +11 -0
  24. data/spec/dummy/app/main/config/initializers/boot.rb +10 -0
  25. data/spec/dummy/app/main/config/routes.rb +14 -0
  26. data/spec/dummy/app/main/controllers/main_controller.rb +27 -0
  27. data/spec/dummy/app/main/models/user.rb +12 -0
  28. data/spec/dummy/app/main/views/main/about.html +7 -0
  29. data/spec/dummy/app/main/views/main/index.html +6 -0
  30. data/spec/dummy/app/main/views/main/main.html +29 -0
  31. data/spec/dummy/config.ru +4 -0
  32. data/spec/dummy/config/app.rb +147 -0
  33. data/spec/dummy/config/base/index.html +15 -0
  34. data/spec/dummy/config/initializers/boot.rb +4 -0
  35. data/spec/integration/sample_integration_spec.rb +11 -0
  36. data/spec/sample_spec.rb +7 -0
  37. data/spec/spec_helper.rb +18 -0
  38. data/volt-browser_irb.gemspec +38 -0
  39. metadata +281 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0afcd5b293f5a17d26c9302c18a0e737deea8f9f
4
+ data.tar.gz: 6c59429d1e1debfa098d009de0cfe3b682baa9c0
5
+ SHA512:
6
+ metadata.gz: d640c004f32103d8328bd6a89ccdb3ff1f019cbf1f37705cd9d711a5b3ecd64d9f2800289267ce69742b5e4bb942ce56ecbe9e2ab2d667784bf0a60c6248cf9a
7
+ data.tar.gz: 4e637f2de98cfe3a79a37f81fec1b0a1fc5a3a4e68cda715fbc08cbb338ac9045c2097561a7a02e3ebdeff183580088c15e1866246f9050d525b9418c982ef7b
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in volt-browser_irb.gemspec
4
+ gemspec
5
+
6
+ # Optional Gems for testing/dev
7
+
8
+ # The implementation of ReadWriteLock in Volt uses concurrent ruby and ext helps performance.
9
+ gem 'concurrent-ruby-ext', '~> 0.8.0'
10
+
11
+ # For mongo (optional)
12
+ gem 'bson_ext', '~> 1.9.0'
13
+
14
+ # Gems you use for development should be added to the gemspec file as
15
+ # development dependencies.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Ryan Stout
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Volt::BrowserIrb
2
+
3
+ This gem provides a simple IRB that can run in the browser. Unlike [opal-irb](https://github.com/fkchang/opal-irb), volt-browser_irb does not load up the opal compiler on the client. Since volt already has a compiler loaded on the server, all compilation is done on the server and sent back to the client. This avoids the load time associated with loading the opal compiler.
4
+
5
+ ## Usage
6
+
7
+ Include the gem in development mode only in the Gemfile:
8
+
9
+ ```ruby
10
+ group :development do
11
+ gem 'volt-browser_irb'
12
+ end
13
+ ```
14
+
15
+ Then in ```app/main/config/dependencies.rb``` you can require it as a dependency (for dev mode only)
16
+
17
+ ```ruby
18
+ if Volt.env.development?
19
+ dependency 'browser_irb'
20
+ end
21
+ ```
22
+
23
+ Restart the server, and press ESCAPE to toggle the irb on the page.
24
+
25
+ ## TODO
26
+
27
+ Currently browser-irb is pretty simple, here's some things I want to add:
28
+
29
+ - tab completion
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ .terminal-area {
2
+ position: fixed;
3
+ z-index: 100;
4
+ bottom: 0;
5
+ left: 0;
6
+ width: 100%;
7
+ height: 200px;
8
+ border-top: 1px solid #000;
9
+ display: none;
10
+ }
11
+
12
+ body.terminal-open {
13
+ margin-bottom: 200px;
14
+ }
15
+
16
+ .terminal-area .error {
17
+ color: #FF0000;
18
+ }
@@ -0,0 +1,39 @@
1
+ /* The inner console element. */
2
+ .jqconsole {
3
+ padding: 10px;
4
+ background-color: #002831;
5
+ }
6
+
7
+ .jqconsole .line {
8
+ color: #EAE3CB;
9
+ }
10
+ /* The cursor. */
11
+ .jqconsole-cursor {
12
+ background-color: gray;
13
+ }
14
+ /* The cursor color when the console looses focus. */
15
+ .jqconsole-blurred .jqconsole-cursor {
16
+ background-color: #666;
17
+ }
18
+ /* The current prompt text color */
19
+ .jqconsole .jqconsole-prompt {
20
+ color: #0d0;
21
+ }
22
+ /* The command history */
23
+ .jqconsole .jqconsole-old-prompt {
24
+ color: #0b0;
25
+ font-weight: normal;
26
+ }
27
+ /* The text color when in input mode. */
28
+ .jqconsole-input {
29
+ color: #dd0;
30
+ }
31
+ /* Previously entered input. */
32
+ .jqconsole-old-input {
33
+ color: #bb0;
34
+ font-weight: normal;
35
+ }
36
+ /* The text color of the output. */
37
+ .jqconsole-output {
38
+ color: white;
39
+ }
@@ -0,0 +1 @@
1
+ (function(){var t,e,i,s,r,o,n,h,p,c,a,u,l,_,f,m,d,$,y,v,g,x,b,k,w,C,T,S,M,P,H,E,L,I,W,D,A,U=function(t,e){return function(){return t.apply(e,arguments)}},R=[].slice;t=jQuery;I=0;W=1;D=2;w=13;H=9;x=46;g=8;T=37;P=39;E=38;b=40;C=36;k=35;M=33;S=34;p="jqconsole-";r=""+p+"cursor";o=""+p+"header";c=""+p+"prompt";h=""+p+"old-prompt";n=""+p+"input";s=""+p+"blurred";y="keypress";m="<span/>";_="<div/>";f=":empty";L="\n";l=">>> ";u="... ";a=2;i=""+p+"ansi-";d="";$=/\[(\d*)(?:;(\d*))*m/;e=function(){t.prototype.COLORS=["black","red","green","yellow","blue","magenta","cyan","white"];function t(){this.stylize=U(this.stylize,this);this._closeSpan=U(this._closeSpan,this);this._openSpan=U(this._openSpan,this);this.getClasses=U(this.getClasses,this);this._style=U(this._style,this);this._color=U(this._color,this);this._remove=U(this._remove,this);this._append=U(this._append,this);this.klasses=[]}t.prototype._append=function(t){t=""+i+t;if(this.klasses.indexOf(t)===-1){return this.klasses.push(t)}};t.prototype._remove=function(){var t,e,s,r,o,n;s=1<=arguments.length?R.call(arguments,0):[];n=[];for(r=0,o=s.length;r<o;r++){e=s[r];if(e==="fonts"||e==="color"||e==="background-color"){n.push(this.klasses=function(){var s,r,o,n;o=this.klasses;n=[];for(s=0,r=o.length;s<r;s++){t=o[s];if(t.indexOf(e)!==i.length){n.push(t)}}return n}.call(this))}else{e=""+i+e;n.push(this.klasses=function(){var i,s,r,o;r=this.klasses;o=[];for(i=0,s=r.length;i<s;i++){t=r[i];if(t!==e){o.push(t)}}return o}.call(this))}}return n};t.prototype._color=function(t){return this.COLORS[t]};t.prototype._style=function(t){if(t===""){t=0}t=parseInt(t);if(isNaN(t)){return}switch(t){case 0:return this.klasses=[];case 1:return this._append("bold");case 2:return this._append("lighter");case 3:return this._append("italic");case 4:return this._append("underline");case 5:return this._append("blink");case 6:return this._append("blink-rapid");case 8:return this._append("hidden");case 9:return this._append("line-through");case 10:return this._remove("fonts");case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:this._remove("fonts");return this._append("fonts-"+(t-10));case 20:return this._append("fraktur");case 21:return this._remove("bold","lighter");case 22:return this._remove("bold","lighter");case 23:return this._remove("italic","fraktur");case 24:return this._remove("underline");case 25:return this._remove("blink","blink-rapid");case 28:return this._remove("hidden");case 29:return this._remove("line-through");case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:this._remove("color");return this._append("color-"+this._color(t-30));case 39:return this._remove("color");case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:this._remove("background-color");return this._append("background-color-"+this._color(t-40));case 49:return this._remove("background-color");case 51:return this._append("framed");case 53:return this._append("overline");case 54:return this._remove("framed");case 55:return this._remove("overline")}};t.prototype.getClasses=function(){return this.klasses.join(" ")};t.prototype._openSpan=function(t){return'<span class="'+this.getClasses()+'">'+t};t.prototype._closeSpan=function(t){return""+t+"</span>"};t.prototype.stylize=function(t){var e,i,s,r,o,n;t=this._openSpan(t);s=0;while((s=t.indexOf(d,s))&&s!==-1){if(i=t.slice(s).match($)){n=i.slice(1);for(r=0,o=n.length;r<o;r++){e=n[r];this._style(e)}t=this._closeSpan(t.slice(0,s))+this._openSpan(t.slice(s+1+i[0].length))}else{s++}}return this._closeSpan(t)};return t}();A=function(t,e){return'<span class="'+t+'">'+(e||"")+"</span>"};v=function(){function i(i,s,r,n){this._HideComposition=U(this._HideComposition,this);this._ShowComposition=U(this._ShowComposition,this);this._UpdateComposition=U(this._UpdateComposition,this);this._EndComposition=U(this._EndComposition,this);this._StartComposition=U(this._StartComposition,this);this._CheckComposition=U(this._CheckComposition,this);this._ProcessMatch=U(this._ProcessMatch,this);this._HandleKey=U(this._HandleKey,this);this._HandleChar=U(this._HandleChar,this);this.isMobile=!!navigator.userAgent.match(/iPhone|iPad|iPod|Android/i);this.isIos=!!navigator.userAgent.match(/iPhone|iPad|iPod/i);this.isAndroid=!!navigator.userAgent.match(/Android/i);this.$window=t(window);this.header=s||"";this.prompt_label_main=typeof r==="string"?r:l;this.prompt_label_continue=n||u;this.indent_width=a;this.state=W;this.input_queue=[];this.input_callback=null;this.multiline_callback=null;this.history=[];this.history_index=0;this.history_new="";this.history_active=false;this.shortcuts={};this.$container=t("<div/>").appendTo(i);this.$container.css({top:0,left:0,right:0,bottom:0,position:"absolute",overflow:"auto"});this.$console=t('<pre class="jqconsole"/>').appendTo(this.$container);this.$console.css({margin:0,position:"relative","min-height":"100%","box-sizing":"border-box","-moz-box-sizing":"border-box","-webkit-box-sizing":"border-box"});this.$console_focused=true;this.$input_container=t(_).appendTo(this.$container);this.$input_container.css({position:"absolute",width:1,height:0,overflow:"hidden"});this.$input_source=this.isAndroid?t("<input/>"):t("<textarea/>");this.$input_source.attr({wrap:"off",autocapitalize:"off",autocorrect:"off",spellcheck:"false",autocomplete:"off"});this.$input_source.css({position:"absolute",width:2});this.$input_source.appendTo(this.$input_container);this.$composition=t(_);this.$composition.addClass(""+p+"composition");this.$composition.css({display:"inline",position:"relative"});this.matchings={openings:{},closings:{},clss:[]};this.ansi=new e;this._InitPrompt();this._SetupEvents();this.Write(this.header,o);t(i).data("jqconsole",this)}i.prototype.ResetHistory=function(){return this.SetHistory([])};i.prototype.ResetShortcuts=function(){return this.shortcuts={}};i.prototype.ResetMatchings=function(){return this.matchings={openings:{},closings:{},clss:[]}};i.prototype.Reset=function(){if(this.state!==W){this.ClearPromptText(true)}this.state=W;this.input_queue=[];this.input_callback=null;this.multiline_callback=null;this.ResetHistory();this.ResetShortcuts();this.ResetMatchings();this.$prompt.detach();this.$input_container.detach();this.$console.html("");this.$prompt.appendTo(this.$console);this.$input_container.appendTo(this.$container);this.Write(this.header,o);return void 0};i.prototype.GetHistory=function(){return this.history};i.prototype.SetHistory=function(t){this.history=t.slice();return this.history_index=this.history.length};i.prototype._CheckKeyCode=function(t){if(isNaN(t)){t=t.charCodeAt(0)}else{t=parseInt(t,10)}if(!(0<t&&t<256)||isNaN(t)){throw new Error("Key code must be a number between 0 and 256 exclusive.")}return t};i.prototype._LetterCaseHelper=function(t,e){e(t);if(65<=t&&t<=90){e(t+32)}if(97<=t&&t<=122){return e(t-32)}};i.prototype.RegisterShortcut=function(t,e){var i;t=this._CheckKeyCode(t);if(typeof e!=="function"){throw new Error("Callback must be a function, not "+e+".")}i=function(t){return function(i){if(!(i in t.shortcuts)){t.shortcuts[i]=[]}return t.shortcuts[i].push(e)}}(this);this._LetterCaseHelper(t,i);return void 0};i.prototype.UnRegisterShortcut=function(t,e){var i;t=this._CheckKeyCode(t);i=function(t){return function(i){if(i in t.shortcuts){if(e){return t.shortcuts[i].splice(t.shortcuts[i].indexOf(e),1)}else{return delete t.shortcuts[i]}}}}(this);this._LetterCaseHelper(t,i);return void 0};i.prototype.GetColumn=function(){var t;this.$prompt_right.detach();this.$prompt_cursor.text("");t=this.$console.text().split(L);this.$prompt_cursor.html("&nbsp;");this.$prompt_cursor.after(this.$prompt_right);return t[t.length-1].length};i.prototype.GetLine=function(){return this.$console.text().split(L).length-1};i.prototype.ClearPromptText=function(t){if(this.state===W){throw new Error("ClearPromptText() is not allowed in output state.")}this.$prompt_before.html("");this.$prompt_after.html("");this.$prompt_label.text(t?"":this._SelectPromptLabel(false));this.$prompt_left.text("");this.$prompt_right.text("");return void 0};i.prototype.GetPromptText=function(e){var i,s,r,o,n;if(this.state===W){throw new Error("GetPromptText() is not allowed in output state.")}if(e){this.$prompt_cursor.text("");n=this.$prompt.text();this.$prompt_cursor.html("&nbsp;");return n}else{o=function(e){var i;i=[];e.children().each(function(){return i.push(t(this).children().last().text())});return i.join(L)};s=o(this.$prompt_before);if(s){s+=L}r=this.$prompt_left.text()+this.$prompt_right.text();i=o(this.$prompt_after);if(i){i=L+i}return s+r+i}};i.prototype.SetPromptText=function(t){if(this.state===W){throw new Error("SetPromptText() is not allowed in output state.")}this.ClearPromptText(false);this._AppendPromptText(t);this._ScrollToEnd();return void 0};i.prototype.SetPromptLabel=function(e,i){var s;this.prompt_label_main=e;s=">span+span>span:first-child";t("."+c+s).text(e);if(i!=null){this.prompt_label_continue=i}return void 0};i.prototype.UpdatePromptLabel=function(){var e,i;i=">span+span>span:first-child";e="."+c+i;return t(e).text(this.prompt_label_main)};i.prototype.Write=function(e,i,s){var r;if(s==null){s=true}if(s){e=this.ansi.stylize(t(m).text(e).html())}r=t(m).html(e);if(i!=null){r.addClass(i)}return this.Append(r)};i.prototype.Append=function(e){var i;i=t(e).insertBefore(this.$prompt);this._ScrollToEnd();this.$prompt_cursor.detach().insertAfter(this.$prompt_left);return i};i.prototype.Input=function(t){var e,i,s,r;if(this.state===D){s=this.input_callback;r=this.multiline_callback;i=this.history_active;e=this.async_multiline;this.AbortPrompt();this.input_queue.unshift(function(t){return function(){return t.Prompt(i,s,r,e)}}(this))}else if(this.state!==W){this.input_queue.push(function(e){return function(){return e.Input(t)}}(this));return}this.history_active=false;this.input_callback=t;this.multiline_callback=null;this.state=I;this.$prompt.attr("class",n);this.$prompt_label.text(this._SelectPromptLabel(false));this.Focus();this._ScrollToEnd();return void 0};i.prototype.Prompt=function(t,e,i,s){if(this.state!==W){this.input_queue.push(function(r){return function(){return r.Prompt(t,e,i,s)}}(this));return}this.history_active=t;this.input_callback=e;this.multiline_callback=i;this.async_multiline=s;this.state=D;this.$prompt.attr("class",c+" "+this.ansi.getClasses());this.$prompt_label.text(this._SelectPromptLabel(false));this.Focus();this._ScrollToEnd();return void 0};i.prototype.AbortPrompt=function(){if(this.state!==D){throw new Error("Cannot abort prompt when not in prompt state.")}this.Write(this.GetPromptText(true)+L,h);this.ClearPromptText(true);this.state=W;this.input_callback=this.multiline_callback=null;this._CheckInputQueue();return void 0};i.prototype.Focus=function(){if(!this.IsDisabled()){this.$input_source.focus()}return void 0};i.prototype.SetIndentWidth=function(t){return this.indent_width=t};i.prototype.GetIndentWidth=function(){return this.indent_width};i.prototype.RegisterMatching=function(t,e,i){var s;s={opening_char:t,closing_char:e,cls:i};this.matchings.clss.push(i);this.matchings.openings[t]=s;return this.matchings.closings[e]=s};i.prototype.UnRegisterMatching=function(t,e){var i;i=this.matchings.openings[t].cls;delete this.matchings.openings[t];delete this.matchings.closings[e];return this.matchings.clss.splice(this.matchings.clss.indexOf(i),1)};i.prototype.Dump=function(){var e,i;e=this.$console.find("."+o).nextUntil("."+c).addBack();return function(){var s,r,o;o=[];for(s=0,r=e.length;s<r;s++){i=e[s];if(t(i).is("."+h)){o.push(t(i).text().replace(/^\s+/,">>> "))}else{o.push(t(i).text())}}return o}().join("")};i.prototype.GetState=function(){if(this.state===I){return"input"}else if(this.state===W){return"output"}else{return"prompt"}};i.prototype.Disable=function(){this.$input_source.attr("disabled",true);return this.$input_source.blur()};i.prototype.Enable=function(){return this.$input_source.attr("disabled",false)};i.prototype.IsDisabled=function(){return Boolean(this.$input_source.attr("disabled"))};i.prototype.MoveToStart=function(t){this._MoveTo(t,true);return void 0};i.prototype.MoveToEnd=function(t){this._MoveTo(t,false);return void 0};i.prototype.Clear=function(){this.$console.find("."+o).nextUntil("."+c).addBack().text("");this.$prompt_cursor.detach();return this.$prompt_right.before(this.$prompt_cursor)};i.prototype._CheckInputQueue=function(){if(this.input_queue.length){return this.input_queue.shift()()}};i.prototype._InitPrompt=function(){this.$prompt=t(A(n)).appendTo(this.$console);this.$prompt_before=t(m).appendTo(this.$prompt);this.$prompt_current=t(m).appendTo(this.$prompt);this.$prompt_after=t(m).appendTo(this.$prompt);this.$prompt_label=t(m).appendTo(this.$prompt_current);this.$prompt_left=t(m).appendTo(this.$prompt_current);this.$prompt_right=t(m).appendTo(this.$prompt_current);this.$prompt_right.css({position:"relative"});this.$prompt_cursor=t(A(r,"&nbsp;"));this.$prompt_cursor.insertBefore(this.$prompt_right);this.$prompt_cursor.css({color:"transparent",display:"inline",zIndex:0});if(!this.isMobile){return this.$prompt_cursor.css("position","absolute")}};i.prototype._SetupEvents=function(){if(this.isMobile){this.$console.click(function(t){return function(e){e.preventDefault();return t.Focus()}}(this))}else{this.$console.mouseup(function(t){return function(e){var i;if(e.which===2){return t.Focus()}else{i=function(){if(!window.getSelection().toString()){e.preventDefault();return t.Focus()}};return setTimeout(i,0)}}}(this))}this.$input_source.focus(function(t){return function(){var e,i;t._ScrollToEnd();t.$console_focused=true;t.$console.removeClass(s);i=function(){if(t.$console_focused){return t.$console.removeClass(s)}};setTimeout(i,100);e=function(){if(t.isIos&&t.$console_focused){return t.$input_source.hide()}};return setTimeout(e,500)}}(this));this.$input_source.blur(function(t){return function(){var e;t.$console_focused=false;if(t.isIos){t.$input_source.show()}e=function(){if(!t.$console_focused){return t.$console.addClass(s)}};return setTimeout(e,100)}}(this));this.$input_source.bind("paste",function(t){return function(){var e;e=function(){if(t.in_composition){return}t._AppendPromptText(t.$input_source.val());t.$input_source.val("");return t.Focus()};return setTimeout(e,0)}}(this));this.$input_source.keypress(this._HandleChar);this.$input_source.keydown(this._HandleKey);this.$input_source.keydown(this._CheckComposition);this.$input_source.bind("compositionstart",this._StartComposition);this.$input_source.bind("compositionend",function(t){return function(e){return setTimeout(function(){return t._EndComposition(e)},0)}}(this));if(this.isAndroid){this.$input_source.bind("input",this._StartComposition);return this.$input_source.bind("input",this._UpdateComposition)}else{return this.$input_source.bind("text",this._UpdateComposition)}};i.prototype._HandleChar=function(t){var e;if(this.state===W||t.metaKey||t.ctrlKey){return true}e=t.which;if(e===8||e===9||e===13){return false}this.$prompt_left.text(this.$prompt_left.text()+String.fromCharCode(e));this._ScrollToEnd();return false};i.prototype._HandleKey=function(e){var i;if(this.state===W){return true}i=e.keyCode||e.which;setTimeout(t.proxy(this._CheckMatchings,this),0);if(e.altKey){return true}else if(e.ctrlKey||e.metaKey){return this._HandleCtrlShortcut(i)}else if(e.shiftKey){switch(i){case w:this._HandleEnter(true);break;case H:this._Unindent();break;case E:this._MoveUp();break;case b:this._MoveDown();break;case M:this._ScrollPage("up");break;case S:this._ScrollPage("down");break;default:return true}return false}else{switch(i){case w:this._HandleEnter(false);break;case H:this._Indent();break;case x:this._Delete(false);break;case g:this._Backspace(false);break;case T:this._MoveLeft(false);break;case P:this._MoveRight(false);break;case E:this._HistoryPrevious();break;case b:this._HistoryNext();break;case C:this.MoveToStart(false);break;case k:this.MoveToEnd(false);break;case M:this._ScrollPage("up");break;case S:this._ScrollPage("down");break;default:return true}return false}};i.prototype._HandleCtrlShortcut=function(t){var e,i,s,r;switch(t){case x:this._Delete(true);break;case g:this._Backspace(true);break;case T:this._MoveLeft(true);break;case P:this._MoveRight(true);break;case E:this._MoveUp();break;case b:this._MoveDown();break;case k:this.MoveToEnd(true);break;case C:this.MoveToStart(true);break;default:if(t in this.shortcuts){r=this.shortcuts[t];for(i=0,s=r.length;i<s;i++){e=r[i];e.call(this)}return false}else{return true}}return false};i.prototype._HandleEnter=function(t){var e,i;this._EndComposition();if(t){return this._InsertNewLine(true)}else{i=this.GetPromptText();e=function(t){return function(e){var s,r,o,n,h,c;if(e!==false){t.MoveToEnd(true);t._InsertNewLine(true);c=[];for(o=n=0,h=Math.abs(e);0<=h?n<h:n>h;o=0<=h?++n:--n){if(e>0){c.push(t._Indent())}else{c.push(t._Unindent())}}return c}else{r=t.state===I?"input":"prompt";t.Write(t.GetPromptText(true)+L,""+p+"old-"+r);t.ClearPromptText(true);if(t.history_active){if(!t.history.length||t.history[t.history.length-1]!==i){t.history.push(i)}t.history_index=t.history.length}t.state=W;s=t.input_callback;t.input_callback=null;if(s){s(i)}return t._CheckInputQueue()}}}(this);if(this.multiline_callback){if(this.async_multiline){return this.multiline_callback(i,e)}else{return e(this.multiline_callback(i))}}else{return e(false)}}};i.prototype._GetDirectionals=function(e){var i,s,r,o,n,h,p,c;o=e?this.$prompt_left:this.$prompt_right;i=e?this.$prompt_right:this.$prompt_left;r=e?this.$prompt_before:this.$prompt_after;s=e?this.$prompt_after:this.$prompt_before;h=e?t.proxy(this.MoveToStart,this):t.proxy(this.MoveToEnd,this);n=e?t.proxy(this._MoveLeft,this):t.proxy(this._MoveRight,this);c=e?"last":"first";p=e?"prependTo":"appendTo";return{$prompt_which:o,$prompt_opposite:i,$prompt_relative:r,$prompt_rel_opposite:s,MoveToLimit:h,MoveDirection:n,which_end:c,where_append:p}};i.prototype._VerticalMove=function(t){var e,i,s,r,o,n,h,p;p=this._GetDirectionals(t),s=p.$prompt_which,e=p.$prompt_opposite,i=p.$prompt_relative,o=p.MoveToLimit,r=p.MoveDirection;if(i.is(f)){return}n=this.$prompt_left.text().length;o();r();h=s.text();e.text(t?h.slice(n):h.slice(0,n));return s.text(t?h.slice(0,n):h.slice(n))};i.prototype._MoveUp=function(){return this._VerticalMove(true)};i.prototype._MoveDown=function(){return this._VerticalMove()};i.prototype._HorizontalMove=function(e,i){var s,r,o,n,h,p,c,a,u,l,_,d,$,y;y=this._GetDirectionals(i),h=y.$prompt_which,r=y.$prompt_opposite,n=y.$prompt_relative,o=y.$prompt_rel_opposite,d=y.which_end,_=y.where_append;a=i?/\w*\W*$/:/^\w*\W*/;u=h.text();if(u){if(e){$=u.match(a);if(!$){return}$=$[0];l=r.text();r.text(i?$+l:l+$);c=$.length;return h.text(i?u.slice(0,-c):u.slice(c))}else{l=r.text();r.text(i?u.slice(-1)+l:l+u[0]);return h.text(i?u.slice(0,-1):u.slice(1))}}else if(!n.is(f)){p=t(m)[_](o);p.append(t(m).text(this.$prompt_label.text()));p.append(t(m).text(r.text()));s=n.children()[d]().detach();this.$prompt_label.text(s.children().first().text());h.text(s.children().last().text());return r.text("")}};i.prototype._MoveLeft=function(t){return this._HorizontalMove(t,true)};i.prototype._MoveRight=function(t){return this._HorizontalMove(t)};i.prototype._MoveTo=function(t,e){var i,s,r,o,n,h,p;h=this._GetDirectionals(e),r=h.$prompt_which,i=h.$prompt_opposite,s=h.$prompt_relative,n=h.MoveToLimit,o=h.MoveDirection;if(t){p=[];while(!(s.is(f)&&r.text()==="")){n(false);p.push(o(false))}return p}else{i.text(this.$prompt_left.text()+this.$prompt_right.text());return r.text("")}};i.prototype._Delete=function(t){var e,i,s;i=this.$prompt_right.text();if(i){if(t){s=i.match(/^\w*\W*/);if(!s){return}s=s[0];return this.$prompt_right.text(i.slice(s.length))}else{return this.$prompt_right.text(i.slice(1))}}else if(!this.$prompt_after.is(f)){e=this.$prompt_after.children().first().detach();return this.$prompt_right.text(e.children().last().text())}};i.prototype._Backspace=function(e){var i,s,r;setTimeout(t.proxy(this._ScrollToEnd,this),0);s=this.$prompt_left.text();if(s){if(e){r=s.match(/\w*\W*$/);if(!r){return}r=r[0];return this.$prompt_left.text(s.slice(0,-r.length))}else{return this.$prompt_left.text(s.slice(0,-1))}}else if(!this.$prompt_before.is(f)){i=this.$prompt_before.children().last().detach();this.$prompt_label.text(i.children().first().text());return this.$prompt_left.text(i.children().last().text())}};i.prototype._Indent=function(){var t;return this.$prompt_left.prepend(function(){var e,i,s;s=[];for(t=e=1,i=this.indent_width;1<=i?e<=i:e>=i;t=1<=i?++e:--e){s.push(" ")}return s}.call(this).join(""))};i.prototype._Unindent=function(){var t,e,i,s,r;t=this.$prompt_left.text()+this.$prompt_right.text();r=[];for(e=i=1,s=this.indent_width;1<=s?i<=s:i>=s;e=1<=s?++i:--i){if(!/^ /.test(t)){break}if(this.$prompt_left.text()){this.$prompt_left.text(this.$prompt_left.text().slice(1))}else{this.$prompt_right.text(this.$prompt_right.text().slice(1))}r.push(t=t.slice(1))}return r};i.prototype._InsertNewLine=function(e){var i,s,r;if(e==null){e=false}r=this._SelectPromptLabel(!this.$prompt_before.is(f));i=t(m).appendTo(this.$prompt_before);i.append(t(m).text(r));i.append(t(m).text(this.$prompt_left.text()));this.$prompt_label.text(this._SelectPromptLabel(true));if(e&&(s=this.$prompt_left.text().match(/^\s+/))){this.$prompt_left.text(s[0])}else{this.$prompt_left.text("")}return this._ScrollToEnd()};i.prototype._AppendPromptText=function(t){var e,i,s,r,o,n;i=t.split(L);this.$prompt_left.text(this.$prompt_left.text()+i[0]);o=i.slice(1);n=[];for(s=0,r=o.length;s<r;s++){e=o[s];this._InsertNewLine();n.push(this.$prompt_left.text(e))}return n};i.prototype._ScrollPage=function(t){var e;e=this.$container[0].scrollTop;if(t==="up"){e-=this.$container.height()}else{e+=this.$container.height()}return this.$container.stop().animate({scrollTop:e},"fast")};i.prototype._ScrollToEnd=function(){var t;this.$container.scrollTop(this.$container[0].scrollHeight);t=this.$prompt_cursor.position();this.$input_container.css({left:t.left,top:t.top});return setTimeout(this.ScrollWindowToPrompt.bind(this),50)};i.prototype.ScrollWindowToPrompt=function(){var t,e,i,s,r,o;e=this.$prompt_cursor.height();o=this.$window.scrollTop();r=this.$window.scrollLeft();t=document.documentElement.clientHeight;s=this.$prompt_cursor.offset();i=s.top-2*e;if(this.isMobile&&(typeof orientation!=="undefined"&&orientation!==null)){if(o<s.top||o>s.top){return this.$window.scrollTop(i)}}else{if(o+t<s.top){return this.$window.scrollTop(s.top-t+e)}else if(o>i){return this.$window.scrollTop(s.top)}}};i.prototype._SelectPromptLabel=function(t){if(this.state===D){if(t){return" \n"+this.prompt_label_continue}else{return this.prompt_label_main}}else{if(t){return"\n "}else{return" "}}};i.prototype._Wrap=function(t,e,i){var s,r;r=t.html();s=r.slice(0,e)+A(i,r[e])+r.slice(e+1);return t.html(s)};i.prototype._WalkCharacters=function(t,e,i,s,r){var o,n,h;n=r?t.length:0;t=t.split("");h=function(){var e,i,s,o;if(r){s=t,t=2<=s.length?R.call(s,0,i=s.length-1):(i=0,[]),e=s[i++]}else{o=t,e=o[0],t=2<=o.length?R.call(o,1):[]}if(e){n=n+(r?-1:+1)}return e};while(o=h()){if(o===e){s++}else if(o===i){s--}if(s===0){return{index:n,current_count:s}}}return{index:-1,current_count:s}};i.prototype._ProcessMatch=function(e,i,s){var r,o,n,h,p,c,a,u,l,_,f,m;_=i?[e["closing_char"],e["opening_char"]]:[e["opening_char"],e["closing_char"]],h=_[0],u=_[1];f=this._GetDirectionals(i),n=f.$prompt_which,o=f.$prompt_relative;p=1;c=false;l=n.html();if(!i){l=l.slice(1)}if(s&&i){l=l.slice(0,-1)}m=this._WalkCharacters(l,h,u,p,i),a=m.index,p=m.current_count;if(a>-1){this._Wrap(n,a,e.cls);c=true}else{r=o.children();r=i?Array.prototype.reverse.call(r):r;r.each(function(s){return function(r,o){var n,_;n=t(o).children().last();l=n.html();_=s._WalkCharacters(l,h,u,p,i),a=_.index,p=_.current_count;if(a>-1){if(!i){a--}s._Wrap(n,a,e.cls);c=true;return false}}}(this))}return c};i.prototype._CheckMatchings=function(e){var i,s,r,o,n,h,p;r=e?this.$prompt_left.text().slice(this.$prompt_left.text().length-1):this.$prompt_right.text()[0];p=this.matchings.clss;for(n=0,h=p.length;n<h;n++){i=p[n];t("."+i,this.$console).contents().unwrap()}if(s=this.matchings.closings[r]){o=this._ProcessMatch(s,true,e)}else if(s=this.matchings.openings[r]){o=this._ProcessMatch(s,false,e)}else if(!e){this._CheckMatchings(true)}if(e){if(o){return this._Wrap(this.$prompt_left,this.$prompt_left.html().length-1,s.cls)}}else{if(o){return this._Wrap(this.$prompt_right,0,s.cls)}}};i.prototype._HistoryPrevious=function(){if(!this.history_active){return}if(this.history_index<=0){return}if(this.history_index===this.history.length){this.history_new=this.GetPromptText()}return this.SetPromptText(this.history[--this.history_index])};i.prototype._HistoryNext=function(){if(!this.history_active){return}if(this.history_index>=this.history.length){return}if(this.history_index===this.history.length-1){this.history_index++;return this.SetPromptText(this.history_new)}else{return this.SetPromptText(this.history[++this.history_index])}};i.prototype._CheckComposition=function(t){var e;e=t.keyCode||t.which;if(e===229){if(this.in_composition){return this._UpdateComposition()}else{return this._StartComposition()}}};i.prototype._StartComposition=function(){if(this.in_composition){return}this.in_composition=true;this._ShowComposition();return setTimeout(this._UpdateComposition,0)};i.prototype._EndComposition=function(){if(!this.in_composition){return}this._HideComposition();this.$prompt_left.text(this.$prompt_left.text()+this.$composition.text());this.$composition.text("");this.$input_source.val("");return this.in_composition=false};i.prototype._UpdateComposition=function(t){var e;e=function(t){return function(){if(!t.in_composition){return}return t.$composition.text(t.$input_source.val())}}(this);return setTimeout(e,0)};i.prototype._ShowComposition=function(){this.$composition.css("height",this.$prompt_cursor.height());this.$composition.empty();return this.$composition.appendTo(this.$prompt_left)};i.prototype._HideComposition=function(){return this.$composition.detach()};return i}();t.fn.jqconsole=function(t,e,i){return new v(this,t,e,i)};t.fn.jqconsole.JQConsole=v;t.fn.jqconsole.Ansi=e}).call(this);
@@ -0,0 +1 @@
1
+ # Component dependencies
@@ -0,0 +1,10 @@
1
+ # Place any code you want to run when the component is included on the client
2
+ # or server.
3
+
4
+ # To include code only on the client use:
5
+ # if RUBY_PLATFORM == 'opal'
6
+ #
7
+ # To include code only on the server, use:
8
+ # unless RUBY_PLATFORM == 'opal'
9
+ # ^^ this will not send compile in code in the conditional to the client.
10
+ # ^^ this include code required in the conditional.
@@ -0,0 +1 @@
1
+ # Component routes
@@ -0,0 +1,120 @@
1
+ module BrowserIrb
2
+ class MainController < Volt::ModelController
3
+
4
+ # Include the collection helpers for irb
5
+ if RUBY_PLATFORM == 'opa'
6
+ `
7
+ Opal.Object.$include((($scope.get('Volt')).$$scope.get('CollectionHelpers')))
8
+ `
9
+ end
10
+
11
+ def initialize(*args)
12
+ super
13
+
14
+ @indented = false
15
+ # Setup ESC keybinding
16
+ `
17
+ $(document).keyup(function(e) {
18
+ if (e.keyCode == 27) {
19
+ #{toggle_console}
20
+ }
21
+ });
22
+
23
+ self.main_node = $('<div class="terminal-area">').appendTo('body');
24
+ #{@term} = self.main_node.jqconsole(false, 'volt> ', '...');
25
+ `
26
+
27
+ restore_history
28
+
29
+ prompt
30
+
31
+ $stdout.write_proc = proc {|str| `#{@term}.Write(str, 'line')` }
32
+ $stderr.write_proc = proc {|str| `#{@term}.Write(str, 'error')` }
33
+ end
34
+
35
+ def toggle_console
36
+ `
37
+ if ($('body').is('.terminal-open')) {
38
+ $('body').removeClass('terminal-open');
39
+ $('.terminal-area').hide();
40
+ } else {
41
+ $('body').addClass('terminal-open');
42
+ $('.terminal-area').show();
43
+ #{@term}.Focus();
44
+ }
45
+ `
46
+ end
47
+
48
+ def prompt
49
+ `
50
+ self.term.Prompt(true, function(input) {
51
+ //self.$command(input);
52
+ }, function (input, cb) {
53
+ self.$command(input, cb);
54
+ return false;
55
+ }, true);
56
+ `
57
+ end
58
+
59
+ def command(command, callback)
60
+ if command.present?
61
+ CommandTask.run(command).then do |code|
62
+ if code == '...continue...'
63
+ indent = @indented ? 0 : 2
64
+ @indented = true
65
+ `callback(indent);`
66
+ else
67
+ @indent = false
68
+ `callback(false);`
69
+ begin
70
+ # Run the code returned from the server
71
+ result = `eval(code)`
72
+ `self.term.Write('=> ' + #{result.inspect} + "\n", 'line');`
73
+ rescue => e
74
+ `self.term.Write(#{e.inspect} + "\n", 'error');`
75
+ end
76
+ end
77
+
78
+ stash_history
79
+ prompt
80
+ end.fail do |err|
81
+ @indent = false
82
+ `self.term.Write(err, 'error')`
83
+
84
+ `callback(false);`
85
+ stash_history
86
+ prompt
87
+ end
88
+ else
89
+ prompt
90
+ end
91
+ end
92
+
93
+ def stash_history
94
+ `
95
+ var history = self.term.GetHistory();
96
+
97
+ history = history.slice(0, 50);
98
+ sessionStorage.setItem('irbhistory', JSON.stringify(history));
99
+ `
100
+ end
101
+
102
+ def restore_history
103
+ `
104
+ var data = sessionStorage.getItem('irbhistory');
105
+
106
+ if (data) {
107
+ data = JSON.parse(data);
108
+
109
+ self.term.SetHistory(data);
110
+ }
111
+ `
112
+ end
113
+ end
114
+ end
115
+
116
+ if Volt.client?
117
+ `$(document).ready(function() {`
118
+ BrowserIrb::MainController.new
119
+ `});`
120
+ end
@@ -0,0 +1,15 @@
1
+ class CommandTask < Volt::Task
2
+ def run(command)
3
+ begin
4
+ Opal.compile(command, irb: true)
5
+ rescue RuntimeError => e
6
+ # Check to see if we have a parse error
7
+ if e.message =~ /An error occurred while compiling/
8
+ # Pass that we are continuing
9
+ '...continue...'
10
+ else
11
+ raise
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ <div></div>
@@ -0,0 +1,18 @@
1
+ # If you need to require in code in the gem's app folder, keep in mind that
2
+ # the app is not on the load path when the gem is required. Use
3
+ # app/{gemname}/config/initializers/boot.rb to require in client or server
4
+ # code.
5
+ #
6
+ # Also, in volt apps, you typically use the lib folder in the
7
+ # app/{componentname} folder instead of this lib folder. This lib folder is
8
+ # for setting up gem code when Bundler.require is called. (or the gem is
9
+ # required.)
10
+ #
11
+ # If you need to configure volt in some way, you can add a Volt.configure block
12
+ # in this file.
13
+
14
+ module Volt
15
+ module BrowserIrb
16
+ # Your code goes here...
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Volt
2
+ module BrowserIrb
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ .bundle
2
+ .config
3
+ .yardoc
4
+ tmp
5
+ .idea
6
+ .yardoc
7
+ .sass-cache
8
+ .DS_Store
9
+ compiled
@@ -0,0 +1,4 @@
1
+ # Place your app's docs here.
2
+
3
+ ## New to Volt?
4
+ Be sure to read the volt docs at http://voltframework.com/docs
@@ -0,0 +1 @@
1
+ // Place your apps css here
@@ -0,0 +1,11 @@
1
+ # Specify which components you wish to include when
2
+ # the "home" component loads.
3
+
4
+ # bootstrap css framework
5
+ component 'bootstrap'
6
+
7
+ # a default theme for the bootstrap framework
8
+ component 'bootstrap_jumbotron_theme'
9
+
10
+ # provides templates for login, signup, and logout
11
+ component 'user_templates'
@@ -0,0 +1,10 @@
1
+ # Place any code you want to run when the component is included on the client
2
+ # or server.
3
+
4
+ # To include code only on the client use:
5
+ # if RUBY_PLATFORM == 'opal'
6
+ #
7
+ # To include code only on the server, use:
8
+ # unless RUBY_PLATFORM == 'opal'
9
+ # ^^ this will not send compile in code in the conditional to the client.
10
+ # ^^ this include code required in the conditional.
@@ -0,0 +1,14 @@
1
+ # See https://github.com/voltrb/volt#routes for more info on routes
2
+
3
+ client '/about', action: 'about'
4
+
5
+ # Routes for login and signup, provided by user_templates component gem
6
+ client '/signup', component: 'user_templates', controller: 'signup'
7
+ client '/login', component: 'user_templates', controller: 'login', action: 'index'
8
+ client '/password_reset', component: 'user_templates', controller: 'password_reset', action: 'index'
9
+ client '/forgot', component: 'user_templates', controller: 'login', action: 'forgot'
10
+ client '/account', component: 'user_templates', controller: 'account', action: 'index'
11
+
12
+ # The main route, this should be last. It will match any params not
13
+ # previously matched.
14
+ client '/', {}
@@ -0,0 +1,27 @@
1
+ # By default Volt generates this controller for your Main component
2
+ module Main
3
+ class MainController < Volt::ModelController
4
+ def index
5
+ # Add code for when the index view is loaded
6
+ end
7
+
8
+ def about
9
+ # Add code for when the about view is loaded
10
+ end
11
+
12
+ private
13
+
14
+ # The main template contains a #template binding that shows another
15
+ # template. This is the path to that template. It may change based
16
+ # on the params._component, params._controller, and params._action values.
17
+ def main_path
18
+ "#{params._component || 'main'}/#{params._controller || 'main'}/#{params._action || 'index'}"
19
+ end
20
+
21
+ # Determine if the current nav component is the active one by looking
22
+ # at the first part of the url against the href attribute.
23
+ def active_tab?
24
+ url.path.split('/')[1] == attrs.href.split('/')[1]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # By default Volt generates this User model which inherits from Volt::User,
2
+ # you can rename this if you want.
3
+ class User < Volt::User
4
+ # login_field is set to :email by default and can be changed to :username
5
+ # in config/app.rb
6
+ field login_field
7
+ field :name
8
+
9
+ validate login_field, unique: true, length: 8
10
+ validate :email, email: true
11
+
12
+ end
@@ -0,0 +1,7 @@
1
+ <:Title>
2
+ About
3
+
4
+ <:Body>
5
+ <h1>About</h1>
6
+
7
+ <p>About page...</p>
@@ -0,0 +1,6 @@
1
+ <:Title>
2
+ Home
3
+
4
+ <:Body>
5
+ <h1>Home</h1>
6
+
@@ -0,0 +1,29 @@
1
+ <:Title>
2
+ {{ view main_path, "title", {controller_group: 'main'} }}
3
+
4
+ <:Body>
5
+ <div class="container">
6
+ <div class="header">
7
+ <ul class="nav nav-pills pull-right">
8
+ <:nav href="/">Home</:nav>
9
+ <:nav href="/about">About</:nav>
10
+ <:user_templates:menu />
11
+ </ul>
12
+ <h3 class="text-muted">dummy</h3>
13
+ </div>
14
+
15
+ <:volt:notices />
16
+
17
+ {{ view main_path, 'body', {controller_group: 'main'} }}
18
+
19
+ <div class="footer">
20
+ <p>&copy; Company {{ Time.now.year }}</p>
21
+ </div>
22
+
23
+ </div>
24
+
25
+ <:Nav>
26
+ <li class="{{ if active_tab? }}active{{ end }}">
27
+ <a href="{{ attrs.href }}">{{ yield }}</a>
28
+ </li>
29
+
@@ -0,0 +1,4 @@
1
+ # Run via rack server
2
+ require 'bundler/setup'
3
+ require 'volt/server'
4
+ run Volt::Server.new.app
@@ -0,0 +1,147 @@
1
+ # app.rb is used to configure your app. This code is only run on the server,
2
+ # then any config options in config.public are passed to the client as well.
3
+
4
+ Volt.configure do |config|
5
+ # Setup your global app config here.
6
+
7
+ #######################################
8
+ # Basic App Info (stuff you should set)
9
+ #######################################
10
+ config.domain = 'dummy.com'
11
+ config.app_name = 'Dummy'
12
+ config.mailer.from = 'Dummy <no-reply@dummy.com>'
13
+
14
+ ############
15
+ # App Secret
16
+ ############
17
+ # Your app secret is used for signing things like the user cookie so it can't
18
+ # be tampered with. A random value is generated on new projects that will work
19
+ # without the need to customize. Make sure this value doesn't leave your server.
20
+ #
21
+ # For added security we recommend moving the app secret into an environment. You can
22
+ # setup that like so:
23
+ #
24
+ # config.app_secret = ENV['APP_SECRET']
25
+ #
26
+ config.app_secret = 'JVNHRBTarPNv4Tv7OFPOMYslFABRQrrvXmSerjrmJRaTpuoFuJcDR0BGByCOLQg2af4'
27
+
28
+ ###############
29
+ # Log Filtering
30
+ ###############
31
+ # Data updates from the client come in via Tasks. The task dispatcher logs all calls to tasks.
32
+ # By default hashes in the arguments can be filtered based on keys. So any hash with a key of
33
+ # password will be filtered. You can add more fields to filter below:
34
+ config.filter_keys = [:password]
35
+
36
+ ##########
37
+ # Database
38
+ ##########
39
+ # Database config all start with db_ and can be set either in the config
40
+ # file or with an environment variable (DB_NAME for example).
41
+
42
+ # config.db_driver = 'mongo'
43
+ # config.db_name = (config.app_name + '_' + Volt.env.to_s)
44
+ # config.db_host = 'localhost'
45
+ # config.db_port = 27017
46
+
47
+ #####################
48
+ # Compression options
49
+ #####################
50
+ # If you are not running behind something like nginx in production, you can
51
+ # have rack deflate all files.
52
+ # config.deflate = true
53
+
54
+ #########################
55
+ # Websocket configuration
56
+ #########################
57
+ # If you need to use a different domain or path for the websocket connection,
58
+ # you can set it here. Volt provides the socket connection url at /socket,
59
+ # but if for example you are using a proxy server that doesn't support
60
+ # websockets, you can point the websocket connection at the app server
61
+ # directly.
62
+ # config.public.websocket_url = '/socket'
63
+
64
+ #######################
65
+ # Public configurations
66
+ #######################
67
+ # Anything under config.public will be sent to the client as well as the server,
68
+ # so be sure no private data ends up under public
69
+
70
+ # Use username instead of email as the login
71
+ # config.public.auth.use_username = true
72
+
73
+ #####################
74
+ # Compression Options
75
+ #####################
76
+ # Disable or enable css/js/image compression. Default is to only run in production.
77
+ # if Volt.env.production?
78
+ # config.compress_javascript = true
79
+ # config.compress_css = true
80
+ # config.compress_images = true
81
+ # end
82
+
83
+ ################
84
+ # Mailer options
85
+ ################
86
+ # The volt-mailer gem uses pony (https://github.com/benprew/pony) to deliver e-mail. Any
87
+ # options you would pass to pony can be setup below.
88
+ # NOTE: The from address is setup at the top
89
+
90
+ # Normally pony uses /usr/sbin/sendmail if one is installed. You can specify smtp below:
91
+ # config.mailer.via = :smtp
92
+ # config.mailer.via_options = {
93
+ # :address => 'smtp.yourserver.com',
94
+ # :port => '25',
95
+ # :user_name => 'user',
96
+ # :password => 'password',
97
+ # :authentication => :plain, # :plain, :login, :cram_md5, no auth by default
98
+ # :domain => "localhost.localdomain" # the HELO domain provided by the client to the server
99
+ # }
100
+
101
+ #############
102
+ # Message Bus
103
+ #############
104
+ # Volt provides a "Message Bus" out of the box. The message bus provides
105
+ # a pub/sub service between any volt instance (server, client, runner, etc..)
106
+ # that share the same database. The message bus can be used by app code. It
107
+ # is also used internally to push data to any listening clients.
108
+ #
109
+ # The default message bus (called "peer_to_peer") uses the database to sync
110
+ # socket ip's/ports.
111
+ # config.message_bus.bus_name = 'peer_to_peer'
112
+ #
113
+ # Encrypt message bus - messages on the message bus are encrypted by default
114
+ # using rbnacl.
115
+
116
+ #
117
+ # For dummy apps, we disable_encryption, to simplify the gem requirements.
118
+ config.message_bus.disable_encryption = true
119
+
120
+ #
121
+ # ## MessageBus Server -- the message bus binds to a port and ip which the
122
+ # other volt instances need to be able to connect to. You can customize
123
+ # the server below:
124
+ #
125
+ # Port range - you can specify a range of ports that an instance can bind the
126
+ # message bus on. You can specify a range, an array of Integers, or an array
127
+ # of ranges.
128
+ # config.message_bus.bind_port_ranges = (58000..61000)
129
+ #
130
+ # Bind Ip - specifies the ip address the message bus server should bind on.
131
+ # config.message_bus.bind_ip = '127.0.0.1'
132
+
133
+ #############
134
+ # Concurrency
135
+ #############
136
+ # Volt provides a thread worker pool for incoming task requests (and all
137
+ # database requests, since those use tasks to do their work.) The following
138
+ # lets you control the size of the worker pool. Threads are only created as
139
+ # needed, and are removed after a certain amount of inactivity.
140
+ # config.min_worker_threads = 1
141
+ # config.max_worker_threads = 10
142
+ #
143
+ # You can also specify the amount of time a Task should run for before it
144
+ # timeout's. Setting this to short can cause unexpected results, currently
145
+ # we recomend it be at least 10 seconds.
146
+ # config.worker_timeout = 60
147
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <%# IMPORTANT: Please read before changing! %>
4
+ <%# This file is rendered on the server using ERB, so it does NOT use Volt's %>
5
+ <%# normal template system. You can add to it, but keep in mind the template %>
6
+ <%# language difference. This file handles auto-loading all JS/Opal and CSS. %>
7
+ <head>
8
+ <meta charset="UTF-8" />
9
+ <%= javascript_tags %>
10
+ <%= css_tags %>
11
+ </head>
12
+ <body>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,4 @@
1
+ # Any ./config/initializers/*.rb files will when the app starts up on the server.
2
+ # To load code on the client (or client and server), you can use the
3
+ # config/initializers folder in a component in the app directory. This folder
4
+ # is only for things that are server only. (Usually for things like config)
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'sample integration test', type: :feature do
4
+ # An example integration spec, this will only be run if ENV['BROWSER'] is
5
+ # specified. Current values for ENV['BROWSER'] are 'firefox' and 'phantom'
6
+ it 'should load the page' do
7
+ visit '/'
8
+
9
+ expect(page).to have_content('Home')
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Volt::BrowserIrb do
4
+ it 'should do something useful' do
5
+ expect(false).to be true
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ # Volt sets up rspec and capybara for testing.
2
+ require 'volt/spec/setup'
3
+
4
+ # When testing Volt component gems, we boot up a dummy app first to run the
5
+ # test in, so we have access to Volt itself.
6
+ dummy_app_path = File.join(File.dirname(__FILE__), 'dummy')
7
+ Volt.spec_setup(dummy_app_path)
8
+
9
+ RSpec.configure do |config|
10
+ config.run_all_when_everything_filtered = true
11
+ config.filter_run :focus
12
+
13
+ # Run specs in random order to surface order dependencies. If you find an
14
+ # order dependency and want to debug it, you can fix the order by providing
15
+ # the seed, which is printed after each run.
16
+ # --seed 1234
17
+ config.order = 'random'
18
+ end
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'volt/browser_irb/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "volt-browser_irb"
8
+ spec.version = Volt::BrowserIrb::VERSION
9
+ spec.authors = ["Ryan Stout"]
10
+ spec.email = ["ryanstout@gmail.com"]
11
+ spec.summary = %q{A simple console that runs opal in the browser}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "volt", "~> 0.9.6.pre2"
21
+ spec.add_development_dependency "rake"
22
+
23
+ # Testing gems
24
+ spec.add_development_dependency 'rspec', '~> 3.2.0'
25
+ spec.add_development_dependency 'opal-rspec', '~> 0.4.2'
26
+ spec.add_development_dependency 'capybara', '~> 2.4.4'
27
+ spec.add_development_dependency 'selenium-webdriver', '~> 2.47.0'
28
+ spec.add_development_dependency 'chromedriver-helper', '~> 1.0.0'
29
+ spec.add_development_dependency 'poltergeist', '~> 1.6.0'
30
+
31
+ # Gems to run the dummy app
32
+ spec.add_development_dependency 'volt-mongo', '0.1.1'
33
+ spec.add_development_dependency 'volt-bootstrap', '~> 0.1.0'
34
+ spec.add_development_dependency 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
35
+ spec.add_development_dependency 'volt-user_templates', '~> 0.4.0'
36
+ spec.add_development_dependency 'thin', '~> 1.6.0'
37
+
38
+ end
metadata ADDED
@@ -0,0 +1,281 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: volt-browser_irb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Stout
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: volt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.6.pre2
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.6.pre2
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: opal-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.4.4
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.4.4
83
+ - !ruby/object:Gem::Dependency
84
+ name: selenium-webdriver
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.47.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.47.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: chromedriver-helper
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: poltergeist
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.6.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: volt-mongo
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.1.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.1.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: volt-bootstrap
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.1.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.1.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: volt-bootstrap_jumbotron_theme
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.1.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.1.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: volt-user_templates
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.4.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.4.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: thin
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.6.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 1.6.0
195
+ description:
196
+ email:
197
+ - ryanstout@gmail.com
198
+ executables: []
199
+ extensions: []
200
+ extra_rdoc_files: []
201
+ files:
202
+ - ".gitignore"
203
+ - ".rspec"
204
+ - CODE_OF_CONDUCT.md
205
+ - Gemfile
206
+ - LICENSE.txt
207
+ - README.md
208
+ - Rakefile
209
+ - app/browser_irb/assets/css/app.css.scss
210
+ - app/browser_irb/assets/js/jqconsole.css
211
+ - app/browser_irb/assets/js/jqconsole.js
212
+ - app/browser_irb/config/dependencies.rb
213
+ - app/browser_irb/config/initializers/boot.rb
214
+ - app/browser_irb/config/routes.rb
215
+ - app/browser_irb/controllers/main_controller.rb
216
+ - app/browser_irb/tasks/command_task.rb
217
+ - app/browser_irb/views/main/index.html
218
+ - lib/volt/browser_irb.rb
219
+ - lib/volt/browser_irb/version.rb
220
+ - spec/dummy/.gitignore
221
+ - spec/dummy/README.md
222
+ - spec/dummy/app/main/assets/css/app.css.scss
223
+ - spec/dummy/app/main/config/dependencies.rb
224
+ - spec/dummy/app/main/config/initializers/boot.rb
225
+ - spec/dummy/app/main/config/routes.rb
226
+ - spec/dummy/app/main/controllers/main_controller.rb
227
+ - spec/dummy/app/main/models/user.rb
228
+ - spec/dummy/app/main/views/main/about.html
229
+ - spec/dummy/app/main/views/main/index.html
230
+ - spec/dummy/app/main/views/main/main.html
231
+ - spec/dummy/config.ru
232
+ - spec/dummy/config/app.rb
233
+ - spec/dummy/config/base/index.html
234
+ - spec/dummy/config/initializers/boot.rb
235
+ - spec/integration/sample_integration_spec.rb
236
+ - spec/sample_spec.rb
237
+ - spec/spec_helper.rb
238
+ - volt-browser_irb.gemspec
239
+ homepage: ''
240
+ licenses:
241
+ - MIT
242
+ metadata: {}
243
+ post_install_message:
244
+ rdoc_options: []
245
+ require_paths:
246
+ - lib
247
+ required_ruby_version: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ">="
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ required_rubygems_version: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: '0'
257
+ requirements: []
258
+ rubyforge_project:
259
+ rubygems_version: 2.4.5
260
+ signing_key:
261
+ specification_version: 4
262
+ summary: A simple console that runs opal in the browser
263
+ test_files:
264
+ - spec/dummy/.gitignore
265
+ - spec/dummy/README.md
266
+ - spec/dummy/app/main/assets/css/app.css.scss
267
+ - spec/dummy/app/main/config/dependencies.rb
268
+ - spec/dummy/app/main/config/initializers/boot.rb
269
+ - spec/dummy/app/main/config/routes.rb
270
+ - spec/dummy/app/main/controllers/main_controller.rb
271
+ - spec/dummy/app/main/models/user.rb
272
+ - spec/dummy/app/main/views/main/about.html
273
+ - spec/dummy/app/main/views/main/index.html
274
+ - spec/dummy/app/main/views/main/main.html
275
+ - spec/dummy/config.ru
276
+ - spec/dummy/config/app.rb
277
+ - spec/dummy/config/base/index.html
278
+ - spec/dummy/config/initializers/boot.rb
279
+ - spec/integration/sample_integration_spec.rb
280
+ - spec/sample_spec.rb
281
+ - spec/spec_helper.rb