babascript 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/bin/baba-vm +9 -3
- data/bin/ibb +40 -9
- data/lib/babascript/options.rb +9 -0
- data/lib/babascript/version.rb +1 -1
- data/lib/babascript.rb +1 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d99b91a66d5e51f4d399b53ac83c08d05abe78
|
4
|
+
data.tar.gz: a50d34c3084cd917a5bc349c59bdd17e093ae2b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 468250ac8debfecbb82859ac9a763983d5c2497bf362d7bd8bc0ddbc6bdf9d4d90930552f2cc5981c82880a2d76f490d1501a999f4be27ee8e797ac192a181dd
|
7
|
+
data.tar.gz: db1d8eb0d48119c883fb89191ef41b3d87a8830ec0730dda41a12b1d0a853ff86e15fb22c49583953370b67fc9af60de8a8dfd7f02acfe9a0311cb770130163d
|
data/History.txt
CHANGED
data/bin/baba-vm
CHANGED
@@ -18,10 +18,12 @@ if args.has_option? :help
|
|
18
18
|
end
|
19
19
|
|
20
20
|
if args.has_option? :version
|
21
|
-
STDERR.puts "BabaScript v#{BabaScript::VERSION} - ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
21
|
+
STDERR.puts "BabaScript VM v#{BabaScript::VERSION} - ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
22
22
|
exit 1
|
23
23
|
end
|
24
24
|
|
25
|
+
STDERR.puts "(connecting..)"
|
26
|
+
|
25
27
|
EM::run do
|
26
28
|
linda = EM::RocketIO::Linda::Client.new BabaScript.LINDA_BASE
|
27
29
|
ts = linda.tuplespace[ BabaScript.LINDA_SPACE ]
|
@@ -29,7 +31,7 @@ EM::run do
|
|
29
31
|
def take_task_and_run(ts)
|
30
32
|
ts.take [:babascript, :eval] do |tuple|
|
31
33
|
loop do
|
32
|
-
print %Q{
|
34
|
+
print %Q{#{tuple[2]}(#{tuple[3].join(', ')}) >}
|
33
35
|
line = STDIN.gets.strip
|
34
36
|
next if line.empty?
|
35
37
|
ts.write [:babascript, :return, tuple[4]["callback"], line]
|
@@ -40,7 +42,11 @@ EM::run do
|
|
40
42
|
end
|
41
43
|
|
42
44
|
linda.io.on :connect do
|
43
|
-
puts "
|
45
|
+
STDERR.puts "(#{type} connect! You are now BABA.)"
|
44
46
|
take_task_and_run(ts)
|
45
47
|
end
|
48
|
+
|
49
|
+
linda.io.on :disconnect do
|
50
|
+
STDERR.puts "(#{type} closed)"
|
51
|
+
end
|
46
52
|
end
|
data/bin/ibb
CHANGED
@@ -1,18 +1,49 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
+
require 'args_parser'
|
3
4
|
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
4
5
|
require 'babascript'
|
5
6
|
load "#{ENV['HOME']}/.ibbrc" if File.exists? "#{ENV['HOME']}/.ibbrc"
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
args = ArgsParser.parse ARGV do
|
9
|
+
arg :version, "show version", :alias => :v
|
10
|
+
arg :help, "show help", :alias => :h
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
binname = File.basename(__FILE__)
|
15
|
+
if args.has_option? :help
|
16
|
+
STDERR.puts "Interactive BabaScript v#{BabaScript::VERSION}"
|
17
|
+
STDERR.puts args.help
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
|
21
|
+
if args.has_option? :version
|
22
|
+
STDERR.puts "Interactive BabaScript v#{BabaScript::VERSION} - ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
STDERR.puts "(connecting..)"
|
27
|
+
|
28
|
+
EM::run do
|
29
|
+
BabaScript::Baba.linda.io.on :connect do
|
30
|
+
STDERR.puts "(#{type} connect!)"
|
31
|
+
end
|
32
|
+
|
33
|
+
BabaScript::Baba.linda.io.on :disconnect do
|
34
|
+
STDERR.puts
|
35
|
+
STDERR.puts "(#{type} closed)"
|
36
|
+
end
|
37
|
+
|
38
|
+
BabaScript.baba do
|
16
39
|
print "[IBB] > "
|
40
|
+
while line = STDIN.gets do
|
41
|
+
line.strip!
|
42
|
+
unless line.empty?
|
43
|
+
STDERR.puts "(waiting response)"
|
44
|
+
p instance_eval line
|
45
|
+
end
|
46
|
+
print "[IBB] > "
|
47
|
+
end
|
17
48
|
end
|
18
49
|
end
|
data/lib/babascript/version.rb
CHANGED
data/lib/babascript.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "babascript/version"
|
2
|
+
require "babascript/options"
|
2
3
|
require "babascript/baba"
|
3
4
|
require "eventmachine"
|
4
5
|
require "em-rocketio-linda-client"
|
@@ -6,11 +7,4 @@ require "json"
|
|
6
7
|
require 'digest/md5'
|
7
8
|
|
8
9
|
module BabaScript
|
9
|
-
def self.LINDA_BASE
|
10
|
-
ENV["LINDA_BASE"] || "http://linda.masuilab.org"
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.LINDA_SPACE
|
14
|
-
ENV["BABA"] || "takumibaba"
|
15
|
-
end
|
16
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babascript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: em-rocketio-linda-client
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- bin/ibb
|
105
105
|
- lib/babascript.rb
|
106
106
|
- lib/babascript/baba.rb
|
107
|
+
- lib/babascript/options.rb
|
107
108
|
- lib/babascript/version.rb
|
108
109
|
- samples/sample.bb
|
109
110
|
- samples/sample.rb
|