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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bca98a830cc718b49885be4e80a068789f6451b6
4
- data.tar.gz: b6cd93a89341591928892f6343f13c3ac2786d70
3
+ metadata.gz: d23ea2d0a1fcb54388eb2e68f56ea38507a0ff30
4
+ data.tar.gz: 45fc336f63a8316986309d26e86876f3587c30c6
5
5
  SHA512:
6
- metadata.gz: 742be32479bac08d9c935807b1220e9f17d45f4017b4332cdb3b7cdfe2832b6e0d82b992ecb92b712a3ee8abf6526f228cf8332af980e6883ee5f825b45dfe64
7
- data.tar.gz: 570f5a08737ae60b64f35098398db584f28f3337d00a9079d9e8d528fda654e16a6661d11110b1be76784a7457afa58b54a45bf1a2368aace154c66a85dbd0ff
6
+ metadata.gz: e09584c9eb549e14eb62278802483eb6ffdeb2ce6bafabff934f38fe4a88a807014ae84e39de5514846f38f02ab05a50d75053c1b4301120c310d76bc8fc9680
7
+ data.tar.gz: e030d3124b4590c0cd9105a36018f7ed8e35b84b25f6ec59ebfd29be7dfe9d80754cd894333401b465379f32cc5240418c72dbbe4e75ea8a225b0549fd71ddcf
data/Gemfile.lock CHANGED
@@ -1,13 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- babascript (0.0.1)
4
+ babascript (0.0.2)
5
+ args_parser
5
6
  httparty
6
7
  json
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ args_parser (0.1.6)
11
13
  httparty (0.11.0)
12
14
  multi_json (~> 1.0)
13
15
  multi_xml (>= 0.5.2)
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.2 2013-06-20
2
+
3
+ * BabaScript interpreter
4
+
1
5
  === 0.0.1 2013-06-20
2
6
 
3
7
  * first release
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
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "httparty"
22
22
  spec.add_dependency "json"
23
+ spec.add_dependency "args_parser"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.3"
25
26
  spec.add_development_dependency "rake"
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
- code = ARGV.map{|i| i.encode("UTF-8") }.join(" ")
7
- puts code
8
- print BabaScript::Baba.instance_eval code
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
@@ -1,3 +1,3 @@
1
1
  module BabaScript
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/samples/sample.bb ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env babascript
2
+
3
+ if 0 < Time.now.hour and Time.now.hour < 5
4
+ もう寝よう!!
5
+ else
6
+ 意識を高めろ!!
7
+ end
8
+
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.1
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: