Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename to nirvana

commit 9a460c40c9f749befa3311134962d904c05b078a 1 parent 6329157
@cldwalker authored
View
4 bin/bs
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'bs'
-Bs.start
View
4 bin/bs-websocket
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'bs/websocket'
-Bs::Websocket.run
View
4 bin/nirvana
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require 'nirvana'
+Nirvana.start
View
4 bin/nirvana-websocket
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require 'nirvana/websocket'
+Nirvana::Websocket.run
View
6 lib/bs/public/css/bs.css
@@ -1,6 +0,0 @@
-body .bs_exception {
- color: red;
-}
-body .bs_warning {
- color: #ffcc00;
-}
View
12 lib/bs.rb → lib/nirvana.rb
@@ -1,20 +1,20 @@
require 'ripl'
require 'ripl/web'
-require 'bs/shell'
-require 'bs/util'
+require 'nirvana/shell'
+require 'nirvana/util'
-module Bs
+module Nirvana
def self.start_shell
stdout, stderr = Util.capture_all {
Ripl::Runner.load_rc(Ripl.config[:riplrc])
- Ripl.shell(:name=>'bs', :readline=>false).before_loop
+ Ripl.shell(:name=>'nirvana', :readline=>false).before_loop
}
(result = stdout.to_s + stderr.to_s) ? Util.format_output(result) : result
end
def self.start
- system "bs-websocket &"
- html_file = File.expand_path(File.dirname(__FILE__) + '/bs/public/index.html')
+ system "nirvana-websocket &"
+ html_file = File.expand_path(File.dirname(__FILE__) + '/nirvana/public/index.html')
RUBY_PLATFORM[/darwin/i] ? system('open', html_file) : puts(html_file)
end
end
View
0  lib/bs/public/css/jquery.readline.css → lib/nirvana/public/css/jquery.readline.css
File renamed without changes
View
0  lib/bs/public/css/jquery.repl.css → lib/nirvana/public/css/jquery.repl.css
File renamed without changes
View
0  lib/bs/public/css/jquery.ui.autocomplete.css → lib/nirvana/public/css/jquery.ui.autocomplete.css
File renamed without changes
View
6 lib/nirvana/public/css/nirvana.css
@@ -0,0 +1,6 @@
+body .nirvana_exception {
+ color: red;
+}
+body .nirvana_warning {
+ color: #ffcc00;
+}
View
0  lib/bs/public/images/spinner.gif → lib/nirvana/public/images/spinner.gif
File renamed without changes
View
10 lib/bs/public/index.html → lib/nirvana/public/index.html
@@ -1,10 +1,10 @@
<html>
<head>
- <title>bs</title>
+ <title>nirvana</title>
<link href='css/jquery.repl.css' rel='stylesheet' type='text/css'>
- <link href='css/bs.css' rel='stylesheet' type='text/css'>
+ <link href='css/nirvana.css' rel='stylesheet' type='text/css'>
<script src='js/jquery.min.js' type='text/javascript'></script>
- <script src='js/bs.js' type='text/javascript'></script>
+ <script src='js/nirvana.js' type='text/javascript'></script>
<script src='js/jquery.hotkeys.js' type='text/javascript'></script>
<script src="js/jquery.ui.autocomplete.min.js"></script>
<script src='js/jquery.readline.js' type='text/javascript'></script>
@@ -14,10 +14,10 @@
$('#input').readline({
autocompleteCss: 'css/jquery.ui.autocomplete.css',
readlineCss: 'css/jquery.readline.css',
- startCompletion: $.ws.bsComplete
+ startCompletion: $.ws.nirvanaComplete
}).repl({
resultPrompt: '',
- startMessage: function() { return '$ bs' },
+ startMessage: function() { return '$ nirvana' },
spinner: 'images/spinner.gif',
loop: function(val) {
$.readline.addHistory(val);
View
0  lib/bs/public/js/jquery.hotkeys.js → lib/nirvana/public/js/jquery.hotkeys.js
File renamed without changes
View
0  lib/bs/public/js/jquery.min.js → lib/nirvana/public/js/jquery.min.js
File renamed without changes
View
0  lib/bs/public/js/jquery.readline.js → lib/nirvana/public/js/jquery.readline.js
File renamed without changes
View
0  lib/bs/public/js/jquery.repl.js → lib/nirvana/public/js/jquery.repl.js
File renamed without changes
View
0  lib/bs/public/js/jquery.ui.autocomplete.min.js → lib/nirvana/public/js/jquery.ui.autocomplete.min.js
File renamed without changes
View
8 lib/bs/public/js/bs.js → lib/nirvana/public/js/nirvana.js
@@ -1,5 +1,5 @@
(function($) {
- if (!('WebSocket' in window)) { alert("This browser does NOT support websockets and thus no bs for you :("); }
+ if (!('WebSocket' in window)) { alert("This browser does NOT support websockets and thus nirvana fail :("); }
var ws = new WebSocket("ws://127.0.0.1:8080");
ws.onmessage = function(e) {
@@ -13,12 +13,12 @@
};
ws.onclose = function() {
$.repl.disable();
- return $.repl.log("<div class='bs_exception'>bs: websocket closed</div>");
+ return $.repl.log("<div class='nirvana_exception'>nirvana: websocket closed</div>");
};
ws.onerror = function() {
- return $.repl.log("<div class='bs_exception'>bs: websocket error</div>");
+ return $.repl.log("<div class='nirvana_exception'>nirvana: websocket error</div>");
};
$.ws = function() { return ws };
- $.ws.bsComplete = function(val) { ws.send(':AUTOCOMPLETE: '+val); };
+ $.ws.nirvanaComplete = function(val) { ws.send(':AUTOCOMPLETE: '+val); };
})(jQuery);
View
8 lib/bs/shell.rb → lib/nirvana/shell.rb
@@ -1,7 +1,7 @@
require 'yajl'
require 'ripl/completion'
-module Bs
+module Nirvana
module Shell
def web_loop_once(input)
super
@@ -27,13 +27,13 @@ def print_eval_error(error)
def format_result(result)
output = Util.format_output @stdout + super
- output = "<div class='bs_warning'>#{@stderr}</div>" + output unless @stderr.to_s.empty?
+ output = "<div class='nirvana_warning'>#{@stderr}</div>" + output unless @stderr.to_s.empty?
output
end
protected
def html_error(error, message)
- "<span class='bs_exception'>#{Util.format_output(message + format_error(error))}</span>"
+ "<span class='nirvana_exception'>#{Util.format_output(message + format_error(error))}</span>"
end
def get_completions(input)
@@ -52,4 +52,4 @@ def completions(line_buffer)
end
end
-Ripl::Shell.send :include, Bs::Shell
+Ripl::Shell.send :include, Nirvana::Shell
View
2  lib/bs/util.rb → lib/nirvana/util.rb
@@ -1,7 +1,7 @@
require 'stringio'
require 'escape_utils'
-module Bs
+module Nirvana
module Util
extend self
View
8 lib/bs/websocket.rb → lib/nirvana/websocket.rb
@@ -1,13 +1,13 @@
require 'em-websocket'
-require 'bs'
+require 'nirvana'
-module Bs
+module Nirvana
module Websocket
def self.run
EventMachine.run do
EventMachine::WebSocket.start(:host => '127.0.0.1', :port => 8080) do |ws|
ws.onopen {
- result = Bs.start_shell
+ result = Nirvana.start_shell
ws.send(result) unless result.to_s.empty?
}
ws.onmessage {|msg| ws.send Ripl.shell.web_loop_once(msg) }
@@ -17,7 +17,7 @@ def self.run
rescue
message = "Unable to start websocket since port 8080 is occupied"
message = $!.message unless $!.message[/no acceptor/]
- abort "bs websocket error: #{message}"
+ abort "nirvana websocket error: #{message}"
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.