grnlip 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/grnlip +50 -0
- data/grnlip.gemspec +24 -0
- data/lib/grnlip/version.rb +3 -0
- data/lib/grnlip.rb +5 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f534c9d9692b8283653bd6d285ab1bbb47e598f9
|
4
|
+
data.tar.gz: 562552624434d59da11521569500c81d71070b5d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3aa2e0058c96b5f87e94cee7896b429e6e87e2f4b2cef59cbc384a03dabddea8f53990e2a81fd81dc9ed4d3eb5a15dc0c1f2547f117bbbe12a838ae8473ca7f7
|
7
|
+
data.tar.gz: b0b3a49233b7ca545c90722cba0502823a234e74eb83f66ad924434c57c693c567229c9685361ac0690e68c7bf061daa218af86a311ebf89fc248627fc03d0bb
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Masafumi Yokoyama <myokoym@gmail.com>
|
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,34 @@
|
|
1
|
+
# Grnlip
|
2
|
+
|
3
|
+
A command line interface for [Groonga](http://groonga.org/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install grnlip
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
$ grnlip GROONGA_EXE_PATH DB_PATH
|
12
|
+
|
13
|
+
For example:
|
14
|
+
|
15
|
+
$ grnlip groonga ~/.milkode/db/milkode.db
|
16
|
+
|
17
|
+
Then, REPL by Readline for Groonga is started:
|
18
|
+
|
19
|
+
> status
|
20
|
+
|
21
|
+
And, you can use pretty-print:
|
22
|
+
|
23
|
+
> pp status
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/myokoym/grnlip.
|
34
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "grnlip"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/grnlip
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "readline"
|
4
|
+
require "tempfile"
|
5
|
+
|
6
|
+
if ARGV.size < 2
|
7
|
+
$stderr.puts("Usage: #{$0} GROONGA_EXE DB_PATH [DB_ENCODING]")
|
8
|
+
exit(1)
|
9
|
+
end
|
10
|
+
|
11
|
+
groonga_exe = ARGV.shift
|
12
|
+
db_path = ARGV.shift
|
13
|
+
basename = File.basename(db_path)
|
14
|
+
db_encoding = ARGV.shift
|
15
|
+
|
16
|
+
if /mswin|mingw|cygwin/i =~ RUBY_PLATFORM
|
17
|
+
input_encoding = "sjis"
|
18
|
+
else
|
19
|
+
input_encoding = "utf-8"
|
20
|
+
end
|
21
|
+
|
22
|
+
while line = Readline.readline("groonga(#{basename})> ", true)
|
23
|
+
if db_encoding
|
24
|
+
line = line.encode(db_encoding, input_encoding)
|
25
|
+
end
|
26
|
+
pretty_print = false
|
27
|
+
case line
|
28
|
+
when "quit"
|
29
|
+
break
|
30
|
+
when /\App /
|
31
|
+
pretty_print = true
|
32
|
+
line = line[3..-1]
|
33
|
+
end
|
34
|
+
Tempfile.open(['readliroonga', '.grn']) do |file|
|
35
|
+
file.write(line)
|
36
|
+
file.flush
|
37
|
+
response = `#{groonga_exe} #{db_path} < #{file.path}`
|
38
|
+
if db_encoding == "utf-8" and input_encoding != "utf-8"
|
39
|
+
response.force_encoding("utf-8")
|
40
|
+
end
|
41
|
+
if pretty_print
|
42
|
+
require "json"
|
43
|
+
puts jj(JSON.parse!(response))
|
44
|
+
else
|
45
|
+
puts response
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
puts
|
data/grnlip.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'grnlip/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "grnlip"
|
8
|
+
spec.version = Grnlip::VERSION
|
9
|
+
spec.authors = ["Masafumi Yokoyama"]
|
10
|
+
spec.email = ["myokoym@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A command line interface for Groonga.}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/myokoym/grnlip"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
data/lib/grnlip.rb
ADDED
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grnlip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masafumi Yokoyama
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: A command line interface for Groonga.
|
42
|
+
email:
|
43
|
+
- myokoym@gmail.com
|
44
|
+
executables:
|
45
|
+
- grnlip
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- exe/grnlip
|
58
|
+
- grnlip.gemspec
|
59
|
+
- lib/grnlip.rb
|
60
|
+
- lib/grnlip/version.rb
|
61
|
+
homepage: https://github.com/myokoym/grnlip
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.4.5.1
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: A command line interface for Groonga.
|
85
|
+
test_files: []
|
86
|
+
has_rdoc:
|