babascript 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/History.txt +4 -0
- data/README.md +24 -0
- data/babascript.gemspec +1 -0
- data/bin/babascript +22 -3
- data/lib/babascript/version.rb +1 -1
- data/samples/sample.bb +8 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23ea2d0a1fcb54388eb2e68f56ea38507a0ff30
|
4
|
+
data.tar.gz: 45fc336f63a8316986309d26e86876f3587c30c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e09584c9eb549e14eb62278802483eb6ffdeb2ce6bafabff934f38fe4a88a807014ae84e39de5514846f38f02ab05a50d75053c1b4301120c310d76bc8fc9680
|
7
|
+
data.tar.gz: e030d3124b4590c0cd9105a36018f7ed8e35b84b25f6ec59ebfd29be7dfe9d80754cd894333401b465379f32cc5240418c72dbbe4e75ea8a225b0549fd71ddcf
|
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,30 @@ Installation
|
|
12
12
|
Usage
|
13
13
|
-----
|
14
14
|
|
15
|
+
### BabaScript interpreter
|
16
|
+
|
17
|
+
% babascript --help
|
18
|
+
|
19
|
+
oneline
|
20
|
+
|
21
|
+
% babascript -e "月曜にかず助に行くので、出欠をとってください"
|
22
|
+
|
23
|
+
interpreter
|
24
|
+
|
25
|
+
sample.bb
|
26
|
+
```ruby
|
27
|
+
if 0 < Time.now.hour and Time.now.hour < 5
|
28
|
+
もう寝よう!!
|
29
|
+
else
|
30
|
+
意識を高めろ!!
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
% babascript sample.bb
|
35
|
+
|
36
|
+
|
37
|
+
### embed BabaScript into Ruby
|
38
|
+
|
15
39
|
```ruby
|
16
40
|
require 'rubygems'
|
17
41
|
require 'babascript'
|
data/babascript.gemspec
CHANGED
data/bin/babascript
CHANGED
@@ -1,8 +1,27 @@
|
|
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
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
args = ArgsParser.parse ARGV do
|
8
|
+
arg :e, "one line of script"
|
9
|
+
arg :help, "show help", :alias => :h
|
10
|
+
end
|
11
|
+
|
12
|
+
if args.has_option? :help
|
13
|
+
STDERR.puts "BabaScript v#{BabaScript::VERSION}"
|
14
|
+
STDERR.puts args.help
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
if args.has_param? :e
|
19
|
+
puts args[:e]
|
20
|
+
print BabaScript::Baba.instance_eval args[:e]
|
21
|
+
else
|
22
|
+
args.argv.each do |fname|
|
23
|
+
File.open(fname) do |f|
|
24
|
+
BabaScript::Baba.instance_eval f.read
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/babascript/version.rb
CHANGED
data/samples/sample.bb
ADDED
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: args_parser
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +100,7 @@ files:
|
|
86
100
|
- lib/babascript.rb
|
87
101
|
- lib/babascript/baba.rb
|
88
102
|
- lib/babascript/version.rb
|
103
|
+
- samples/sample.bb
|
89
104
|
- samples/sample.rb
|
90
105
|
homepage: https://github.com/masuilab/babascript
|
91
106
|
licenses:
|