mohair 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.
- data/.gitignore +21 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +3 -0
- data/bin/mohair +5 -0
- data/lib/mohair.rb +17 -0
- data/lib/mohair/selector.rb +43 -0
- data/lib/mohair/version.rb +3 -0
- data/mohair.gemspec +19 -0
- metadata +64 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 UENISHI Kota
|
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,29 @@
|
|
1
|
+
# Mohair
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'mohair'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mohair
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/mohair
ADDED
data/lib/mohair.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "mohair/version"
|
2
|
+
require "mohair/selector"
|
3
|
+
|
4
|
+
module Mohair
|
5
|
+
# Your code goes here...
|
6
|
+
def self.main
|
7
|
+
case ARGV[0].downcase
|
8
|
+
when 'select'
|
9
|
+
Selector.new(ARGV).exec!
|
10
|
+
when 'insert'
|
11
|
+
when 'show'
|
12
|
+
when 'create'
|
13
|
+
else
|
14
|
+
print "bad query: ", ARGV, "\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'mohair'
|
2
|
+
|
3
|
+
module Mohair
|
4
|
+
class Selector
|
5
|
+
def initialize argv
|
6
|
+
@cols = []
|
7
|
+
@from = []
|
8
|
+
@where = []
|
9
|
+
argv.shift
|
10
|
+
parse_first argv
|
11
|
+
end
|
12
|
+
def parse_first tokens
|
13
|
+
token = tokens.shift.downcase
|
14
|
+
case token.downcase
|
15
|
+
when 'from'
|
16
|
+
parse_from tokens
|
17
|
+
when 'where'
|
18
|
+
parse_where tokens
|
19
|
+
else
|
20
|
+
@cols << token
|
21
|
+
parse_first tokens
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def parse_from tokens
|
25
|
+
token = tokens.shift.downcase
|
26
|
+
p token
|
27
|
+
case token.downcase
|
28
|
+
when 'where'
|
29
|
+
parse_where tokens
|
30
|
+
else
|
31
|
+
@from << token
|
32
|
+
end
|
33
|
+
end
|
34
|
+
def parse_where tokens
|
35
|
+
end
|
36
|
+
def exec!
|
37
|
+
pr
|
38
|
+
end
|
39
|
+
def pr
|
40
|
+
print "<select> #{@cols} <from> #{@from};\n"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/mohair.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mohair/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "mohair"
|
8
|
+
gem.version = Mohair::VERSION
|
9
|
+
gem.authors = ["UENISHI Kota"]
|
10
|
+
gem.email = ["kuenishi@gmail.com"]
|
11
|
+
gem.description = %q{a new type of Riak client}
|
12
|
+
gem.summary = %q{a new type of a riak client}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mohair
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- UENISHI Kota
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2013-03-18 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: a new type of Riak client
|
17
|
+
email:
|
18
|
+
- kuenishi@gmail.com
|
19
|
+
executables:
|
20
|
+
- mohair
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- Gemfile
|
28
|
+
- LICENSE.txt
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- bin/mohair
|
32
|
+
- lib/mohair.rb
|
33
|
+
- lib/mohair/selector.rb
|
34
|
+
- lib/mohair/version.rb
|
35
|
+
- mohair.gemspec
|
36
|
+
homepage: ""
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.8.23
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: a new type of a riak client
|
63
|
+
test_files: []
|
64
|
+
|