diff --git a/bin/bs b/bin/bs
deleted file mode 100755
index 9d44145..0000000
--- a/bin/bs
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'bs'
-Bs.start
diff --git a/bin/bs-websocket b/bin/bs-websocket
deleted file mode 100755
index a81913e..0000000
--- a/bin/bs-websocket
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'bs/websocket'
-Bs::Websocket.run
diff --git a/bin/nirvana b/bin/nirvana
new file mode 100755
index 0000000..5f0ca09
--- /dev/null
+++ b/bin/nirvana
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require 'nirvana'
+Nirvana.start
diff --git a/bin/nirvana-websocket b/bin/nirvana-websocket
new file mode 100755
index 0000000..6b8955a
--- /dev/null
+++ b/bin/nirvana-websocket
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require 'nirvana/websocket'
+Nirvana::Websocket.run
diff --git a/lib/bs/public/css/bs.css b/lib/bs/public/css/bs.css
deleted file mode 100644
index c0b0f89..0000000
--- a/lib/bs/public/css/bs.css
+++ /dev/null
@@ -1,6 +0,0 @@
-body .bs_exception {
- color: red;
-}
-body .bs_warning {
- color: #ffcc00;
-}
diff --git a/lib/bs.rb b/lib/nirvana.rb
similarity index 57%
rename from lib/bs.rb
rename to lib/nirvana.rb
index 92fea22..c3f4481 100644
--- a/lib/bs.rb
+++ b/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
diff --git a/lib/bs/public/css/jquery.readline.css b/lib/nirvana/public/css/jquery.readline.css
similarity index 100%
rename from lib/bs/public/css/jquery.readline.css
rename to lib/nirvana/public/css/jquery.readline.css
diff --git a/lib/bs/public/css/jquery.repl.css b/lib/nirvana/public/css/jquery.repl.css
similarity index 100%
rename from lib/bs/public/css/jquery.repl.css
rename to lib/nirvana/public/css/jquery.repl.css
diff --git a/lib/bs/public/css/jquery.ui.autocomplete.css b/lib/nirvana/public/css/jquery.ui.autocomplete.css
similarity index 100%
rename from lib/bs/public/css/jquery.ui.autocomplete.css
rename to lib/nirvana/public/css/jquery.ui.autocomplete.css
diff --git a/lib/nirvana/public/css/nirvana.css b/lib/nirvana/public/css/nirvana.css
new file mode 100644
index 0000000..94e10d1
--- /dev/null
+++ b/lib/nirvana/public/css/nirvana.css
@@ -0,0 +1,6 @@
+body .nirvana_exception {
+ color: red;
+}
+body .nirvana_warning {
+ color: #ffcc00;
+}
diff --git a/lib/bs/public/images/spinner.gif b/lib/nirvana/public/images/spinner.gif
similarity index 100%
rename from lib/bs/public/images/spinner.gif
rename to lib/nirvana/public/images/spinner.gif
diff --git a/lib/bs/public/index.html b/lib/nirvana/public/index.html
similarity index 78%
rename from lib/bs/public/index.html
rename to lib/nirvana/public/index.html
index ebd9afd..152baf9 100644
--- a/lib/bs/public/index.html
+++ b/lib/nirvana/public/index.html
@@ -1,10 +1,10 @@
- bs
+ nirvana
-
+
-
+
@@ -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);
diff --git a/lib/bs/public/js/jquery.hotkeys.js b/lib/nirvana/public/js/jquery.hotkeys.js
similarity index 100%
rename from lib/bs/public/js/jquery.hotkeys.js
rename to lib/nirvana/public/js/jquery.hotkeys.js
diff --git a/lib/bs/public/js/jquery.min.js b/lib/nirvana/public/js/jquery.min.js
similarity index 100%
rename from lib/bs/public/js/jquery.min.js
rename to lib/nirvana/public/js/jquery.min.js
diff --git a/lib/bs/public/js/jquery.readline.js b/lib/nirvana/public/js/jquery.readline.js
similarity index 100%
rename from lib/bs/public/js/jquery.readline.js
rename to lib/nirvana/public/js/jquery.readline.js
diff --git a/lib/bs/public/js/jquery.repl.js b/lib/nirvana/public/js/jquery.repl.js
similarity index 100%
rename from lib/bs/public/js/jquery.repl.js
rename to lib/nirvana/public/js/jquery.repl.js
diff --git a/lib/bs/public/js/jquery.ui.autocomplete.min.js b/lib/nirvana/public/js/jquery.ui.autocomplete.min.js
similarity index 100%
rename from lib/bs/public/js/jquery.ui.autocomplete.min.js
rename to lib/nirvana/public/js/jquery.ui.autocomplete.min.js
diff --git a/lib/bs/public/js/bs.js b/lib/nirvana/public/js/nirvana.js
similarity index 64%
rename from lib/bs/public/js/bs.js
rename to lib/nirvana/public/js/nirvana.js
index f7dff3e..fe04f27 100644
--- a/lib/bs/public/js/bs.js
+++ b/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("bs: websocket closed
");
+ return $.repl.log("nirvana: websocket closed
");
};
ws.onerror = function() {
- return $.repl.log("bs: websocket error
");
+ return $.repl.log("nirvana: websocket error
");
};
$.ws = function() { return ws };
- $.ws.bsComplete = function(val) { ws.send(':AUTOCOMPLETE: '+val); };
+ $.ws.nirvanaComplete = function(val) { ws.send(':AUTOCOMPLETE: '+val); };
})(jQuery);
diff --git a/lib/bs/shell.rb b/lib/nirvana/shell.rb
similarity index 83%
rename from lib/bs/shell.rb
rename to lib/nirvana/shell.rb
index c6ffd6f..583344b 100644
--- a/lib/bs/shell.rb
+++ b/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 = "#{@stderr}
" + output unless @stderr.to_s.empty?
+ output = "#{@stderr}
" + output unless @stderr.to_s.empty?
output
end
protected
def html_error(error, message)
- "#{Util.format_output(message + format_error(error))}"
+ "#{Util.format_output(message + format_error(error))}"
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
diff --git a/lib/bs/util.rb b/lib/nirvana/util.rb
similarity index 97%
rename from lib/bs/util.rb
rename to lib/nirvana/util.rb
index e18399c..57bcf02 100644
--- a/lib/bs/util.rb
+++ b/lib/nirvana/util.rb
@@ -1,7 +1,7 @@
require 'stringio'
require 'escape_utils'
-module Bs
+module Nirvana
module Util
extend self
diff --git a/lib/bs/websocket.rb b/lib/nirvana/websocket.rb
similarity index 81%
rename from lib/bs/websocket.rb
rename to lib/nirvana/websocket.rb
index 7205d56..07accee 100644
--- a/lib/bs/websocket.rb
+++ b/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