grn2drn 1.0.2 → 1.0.3
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 +4 -4
- data/bin/grn2drn +15 -14
- data/bin/grn2drn-schema +3 -0
- data/lib/grn2drn/schema-converter.rb +1 -1
- data/lib/grn2drn/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b881ef409eb9ed83ad1af4b266945828a251a49
|
4
|
+
data.tar.gz: 86b5c9cda0770503aa48faa9fc26ab7a5d6eff8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dabdcf4ed5dfbd0531fac2456c0439138e6f5dc227b98c3bc979332f5afa04204e5aa3beab94e38aa6149a6d0e0cc4f1575beeebe33585f2cb810d1658fed05e
|
7
|
+
data.tar.gz: 843449bcafa9ea97f5e3bed00c06d783125238593858db7a77cecb0d322920bfcbd18ccba71190ebd7548066eeac7267ddb0b99496904018fea86a6e1d39d9cf
|
data/bin/grn2drn
CHANGED
@@ -19,25 +19,34 @@
|
|
19
19
|
require "ostruct"
|
20
20
|
require "optparse"
|
21
21
|
|
22
|
+
require "grn2drn/version"
|
22
23
|
require "grn2drn/command-converter"
|
23
24
|
|
24
25
|
options = OpenStruct.new
|
25
26
|
options.output_path = "-"
|
27
|
+
options.dataset = "Default"
|
28
|
+
options.encoding = "UTF-8"
|
26
29
|
option_parser = OptionParser.new do |parser|
|
30
|
+
parser.version = Grn2Drn::VERSION
|
31
|
+
|
27
32
|
parser.banner += " INPUT"
|
28
33
|
|
29
34
|
parser.separator("")
|
30
35
|
parser.separator("Converts Groonga commands to Droonga messages")
|
31
36
|
|
32
37
|
parser.separator("")
|
33
|
-
parser.separator("Required parameters:")
|
34
38
|
parser.on("--dataset=DATASET",
|
35
|
-
"Use DATASET as \"dataset\" field value"
|
39
|
+
"Use DATASET as \"dataset\" field value",
|
40
|
+
"(#{options.dataset})") do |dataset|
|
36
41
|
options.dataset = dataset
|
37
42
|
end
|
38
43
|
|
39
|
-
parser.
|
40
|
-
|
44
|
+
parser.on("--encoding=ENCODING",
|
45
|
+
"Read input as strings encoded in ENCODING",
|
46
|
+
"(#{options.encoding})") do |encoding|
|
47
|
+
options.encoding = encoding
|
48
|
+
end
|
49
|
+
|
41
50
|
parser.on("--id-prefix=PREFIX",
|
42
51
|
"Use PREFIX as prefix of IDs") do |prefix|
|
43
52
|
options.id_prefix = prefix
|
@@ -76,16 +85,6 @@ convert_options = {
|
|
76
85
|
}
|
77
86
|
converter = Grn2Drn::CommandConverter.new(convert_options)
|
78
87
|
|
79
|
-
def open_input(source_file)
|
80
|
-
if source_file.nil?
|
81
|
-
yield($stdin)
|
82
|
-
else
|
83
|
-
File.open(source_file) do |input|
|
84
|
-
yield(input)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
88
|
def open_output(path)
|
90
89
|
if path == "-"
|
91
90
|
yield($stdout)
|
@@ -96,6 +95,8 @@ def open_output(path)
|
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
98
|
+
ARGF.set_encoding(options.encoding)
|
99
|
+
|
99
100
|
open_output(options.output_path) do |output|
|
100
101
|
converter.convert(ARGF) do |command|
|
101
102
|
output.puts(JSON.generate(command))
|
data/bin/grn2drn-schema
CHANGED
@@ -20,6 +20,7 @@ require "ostruct"
|
|
20
20
|
require "optparse"
|
21
21
|
require "json"
|
22
22
|
|
23
|
+
require "grn2drn/version"
|
23
24
|
require "grn2drn/schema-converter"
|
24
25
|
|
25
26
|
def open_output(path)
|
@@ -35,6 +36,8 @@ end
|
|
35
36
|
options = OpenStruct.new
|
36
37
|
options.output_path = "-"
|
37
38
|
option_parser = OptionParser.new do |parser|
|
39
|
+
parser.version = Grn2Drn::VERSION
|
40
|
+
|
38
41
|
parser.banner += " INPUT"
|
39
42
|
|
40
43
|
parser.separator("")
|
data/lib/grn2drn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grn2drn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Droonga Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -121,9 +121,9 @@ files:
|
|
121
121
|
- Rakefile
|
122
122
|
- Gemfile
|
123
123
|
- grn2drn.gemspec
|
124
|
-
- lib/grn2drn/error.rb
|
125
|
-
- lib/grn2drn/version.rb
|
126
124
|
- lib/grn2drn/schema-converter.rb
|
125
|
+
- lib/grn2drn/version.rb
|
126
|
+
- lib/grn2drn/error.rb
|
127
127
|
- lib/grn2drn/command-converter.rb
|
128
128
|
- bin/grn2drn-schema
|
129
129
|
- bin/grn2drn
|