Skip to content

Commit

Permalink
skeleton here
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Jun 6, 2008
1 parent a2be6bb commit 0727fd7
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.txt
@@ -0,0 +1,6 @@

= reshell CHANGELOG.txt


== reshell - 0.0.1 not yet released

21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,21 @@

Copyright (c) 2008, John Mettraux, jmettraux@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

4 changes: 4 additions & 0 deletions lib/serve.rb
@@ -0,0 +1,4 @@

require 'rubygems'
require 'sinatra'

74 changes: 74 additions & 0 deletions public/bak.html
@@ -0,0 +1,74 @@

<html>
<head>
<title>reshell</title>
<style>
body {
/*text-align: center;*/
color: #888;
font-family: Helvetica;
font-size: 14px;
margin: 20px 10px;
}
input {
color: #888;
font-family: Helvetica;
font-size: 14px;
border: 0px;
}
.reshell_in {
color: blue;
}
</style>
</head>

<body>

<script>

var count = 0;

function get_stdin () {
return document.getElementById("reshell_stdin");
}

function reshell_puts (eid, clazz, text) {

var t = document.createElement('div');
t['id'] = eid;
t.setAttribute('id', eid);
t.setAttribute('class', clazz);

var tt = document.createTextNode(text);

t.appendChild(tt);

document.getElementById("reshell_stdout").appendChild(t);
}

function reshell_eval () {

var code = get_stdin().value;

reshell_puts("in_"+count, "reshell_in", "$ "+code);

get_stdin().value = "";
count++;
get_stdin().focus();
}

</script>

<div id="reshell_stdout"></div>
<form onsubmit="reshell_eval(); return false;">
$ <input id="reshell_stdin" type="text" />
</form>

<script>
reshell_puts("welcome", "welcome", "reshell v0.0.1 (c) 2008 jmettraux");
get_stdin().focus();
</script>

</body>
</html>

91 changes: 91 additions & 0 deletions public/js/reshell.js
@@ -0,0 +1,91 @@

/*
* Copyright (c) 2008, John Mettraux, jmettraux@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

//
// Reshell
//
// Made in Japan
//

var Reshell = function (prefix) {

this.prefix = prefix;
this.count = 0;
this.env = {};
this.stdin = document.getElementById(this.prefix+"_stdin");
this.stdout = document.getElementById(this.prefix+"_stdin");

this.puts = function (eid, clazz, text) {

var t = document.createElement('div');
t['id'] = eid;
t.setAttribute('id', eid);
t.setAttribute('class', clazz);

var tt = document.createTextNode(text);

t.appendChild(tt);

document.getElementById(this.prefix+"_stdout").appendChild(t);
}

this.eval = function () {

var code = this.stdin.value;
this.stdin.value = "";
this.stdin.focus();

var f = this.env[code];

if (f) {
f();
}
else {
this.puts("in_"+this.count, this.prefix+"_in", "$ "+code);
}


this.count++;
}

this.focus = function () {

this.stdin.focus();
}

this.clear = function () {
while(this.stdout.removeChild(this.stdout.lastChild)) {}
}

this.def = function (name, func) {

this.env[name] = func;
}

//
// some basic commands

this.def('clear', this.clear);

}

43 changes: 43 additions & 0 deletions public/reshell.html
@@ -0,0 +1,43 @@

<html>
<head>
<title>reshell</title>
<style>
body {
/*text-align: center;*/
color: #888;
font-family: Helvetica;
font-size: 14px;
margin: 20px 10px;
}
input {
color: #888;
font-family: Helvetica;
font-size: 14px;
border: 0px;
}
.reshell_in {
color: blue;
}
</style>

<script src="/js/reshell.js"></script>

</head>

<body>

<div id="reshell_stdout"></div>
<form onsubmit="reshell.eval(); return false;">
$ <input id="reshell_stdin" type="text" />
</form>

<script>
var reshell = new Reshell('reshell');
reshell.puts("welcome", "welcome", "reshell v0.0.1 (c) 2008 john mettraux");
reshell.focus();
</script>

</body>
</html>

0 comments on commit 0727fd7

Please sign in to comment.