Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add: Clojure eval.

  • Loading branch information...
commit e7e3eccdfbf75506e2e31fd9feae33b47695e234 1 parent 278493e
@gf3 gf3 authored
Showing with 32 additions and 3 deletions.
  1. +32 −3 protobot.js
  2. BIN  srepl-1.0.0-SNAPSHOT-standalone.jar
View
35 protobot.js
@@ -28,8 +28,10 @@ var util = require( 'util' )
options =
{ server: 'irc.freenode.net'
- , nick: 'david_mark'
- , channels: [ '#runlevel6', '#inimino', '#oftn', '#prototype', '#jquery-ot', '#wadsup' ]
+ // , nick: 'david_mark'
+ // , channels: [ '#runlevel6', '#inimino', '#oftn', '#prototype', '#jquery-ot', '#wadsup' ]
+ , nick: 'david_mark2'
+ , channels: [ '#runlevel6' ]
, user:
{ username: 'david_mark'
, hostname: 'intertubes'
@@ -245,7 +247,7 @@ bot = jerk( function( j ) {
})
// Racket Sandbox
- j.watch_for( /^ (.*)/, function ( message ) {
+ j.watch_for( /^rkt[→>] (.*)/, function ( message ) {
var stdout = ''
, stderr = ''
, child = spawn( 'racket', [ 'sandboxed-ipc-repl.rkt' ] )
@@ -271,6 +273,33 @@ bot = jerk( function( j ) {
child.stdin.end()
})
+ // Clojure Sandbox
+ j.watch_for( /^clj[→>] (.*)/, function ( message ) {
+ var stdout = ''
+ , stderr = ''
+ , child = spawn( 'java', [ '-jar', 'srepl-1.0.0-SNAPSHOT-standalone.jar' ] )
+ , stdoutput = function( data ) {
+ if ( !!data )
+ stdout += data
+ }
+ , stderrput = function( data ) {
+ if ( !!data )
+ stderr += data
+ }
+
+ child.stdout.on( 'data', stdoutput )
+ child.stderr.on( 'data', stderrput )
+ child.on( 'exit', function( code ) { var out
+ if ( code )
+ out = stderr
+ else
+ out = stdout
+ message.say( message.user + ': ' + out )
+ })
+ child.stdin.write( message.match_data[1] )
+ child.stdin.end()
+ })
+
// "it doesn't work"
j.watch_for( /^(?:it )?doesn(?:')?t work(?:\s*@\s*([-\[\]\{\}`|_\w]+))?/, function( message ) {
message.say( to( message, "doesn't work" ) + ": What do you mean it doesn't work? What happens when you try to run it? What's the output? What's the error message? Saying \"it doesn't work\" is pointless." )
View
BIN  srepl-1.0.0-SNAPSHOT-standalone.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.