babascript 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bca98a830cc718b49885be4e80a068789f6451b6
4
+ data.tar.gz: b6cd93a89341591928892f6343f13c3ac2786d70
5
+ SHA512:
6
+ metadata.gz: 742be32479bac08d9c935807b1220e9f17d45f4017b4332cdb3b7cdfe2832b6e0d82b992ecb92b712a3ee8abf6526f228cf8332af980e6883ee5f825b45dfe64
7
+ data.tar.gz: 570f5a08737ae60b64f35098398db584f28f3337d00a9079d9e8d528fda654e16a6661d11110b1be76784a7457afa58b54a45bf1a2368aace154c66a85dbd0ff
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *~
2
+ *#*
3
+ *.gem
4
+ *.rbc
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ .ruby-version
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in babascript.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,25 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ babascript (0.0.1)
5
+ httparty
6
+ json
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ httparty (0.11.0)
12
+ multi_json (~> 1.0)
13
+ multi_xml (>= 0.5.2)
14
+ json (1.8.0)
15
+ multi_json (1.7.7)
16
+ multi_xml (0.5.4)
17
+ rake (10.1.0)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ babascript!
24
+ bundler (~> 1.3)
25
+ rake
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2013-06-20
2
+
3
+ * first release
4
+ * run DSL style BabaScript
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sho Hashimoto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ BabaScript
2
+ ==========
3
+ BabaScript is a script language which runs on @takumibaba
4
+
5
+
6
+ Installation
7
+ ------------
8
+
9
+ % gem install babascript
10
+
11
+
12
+ Usage
13
+ -----
14
+
15
+ ```ruby
16
+ require 'rubygems'
17
+ require 'babascript'
18
+
19
+ BabaScript.baba do
20
+ 起きてください
21
+ end
22
+ ```
23
+
24
+ ```ruby
25
+ BabaScript.baba do
26
+ アイス買ってきてよ("#{rand(10)}本")
27
+ end
28
+ ```
29
+
30
+
31
+ Contributing
32
+ ------------
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'babascript/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "babascript"
8
+ spec.version = BabaScript::VERSION
9
+ spec.authors = ["Sho Hashimoto"]
10
+ spec.email = ["hashimoto@shokai.org"]
11
+ spec.description = %q{BabaScript is a script launguage which runs on @takumibaba}
12
+ spec.summary = spec.description
13
+ spec.homepage = "https://github.com/masuilab/babascript"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "httparty"
22
+ spec.add_dependency "json"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ end
data/bin/babascript ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
+ require 'babascript'
5
+
6
+ code = ARGV.map{|i| i.encode("UTF-8") }.join(" ")
7
+ puts code
8
+ print BabaScript::Baba.instance_eval code
@@ -0,0 +1,20 @@
1
+ module BabaScript
2
+ def self.baba(&block)
3
+ self::Baba.run(&block)
4
+ end
5
+
6
+ class Baba
7
+ def self.run(&block)
8
+ self.instance_eval &block if block_given?
9
+ end
10
+
11
+ def self.method_missing(name, *args)
12
+ tuple = ["notifications", name]
13
+ tuple.push args unless args.empty?
14
+ query = {
15
+ :body => {:tuple => tuple.to_json}
16
+ }
17
+ HTTParty.post("#{LINDA_BASE}/#{LINDA_SPACE}.write", query)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module BabaScript
2
+ VERSION = "0.0.1"
3
+ end
data/lib/babascript.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "babascript/version"
2
+ require "babascript/baba"
3
+ require "httparty"
4
+ require "json"
5
+
6
+ module BabaScript
7
+ LINDA_BASE = "http://linda.masuilab.org"
8
+ LINDA_SPACE = "takumibaba"
9
+ end
data/samples/sample.rb ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+ require 'rubygems'
4
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
5
+ require 'babascript'
6
+
7
+ BabaScript.baba do
8
+ if Time.now.hour < 12
9
+ そろそろ起きたほうがいいのでは?
10
+ else
11
+ アイス買ってきてよ("#{rand(10)}本")
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: babascript
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sho Hashimoto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: BabaScript is a script launguage which runs on @takumibaba
70
+ email:
71
+ - hashimoto@shokai.org
72
+ executables:
73
+ - babascript
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - History.txt
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - babascript.gemspec
85
+ - bin/babascript
86
+ - lib/babascript.rb
87
+ - lib/babascript/baba.rb
88
+ - lib/babascript/version.rb
89
+ - samples/sample.rb
90
+ homepage: https://github.com/masuilab/babascript
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.3
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: BabaScript is a script launguage which runs on @takumibaba
114
+ test_files: []
115
+ has_rdoc: