groonga-schema 1.0.0
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 +7 -0
- data/.yardopts +9 -0
- data/Gemfile +21 -0
- data/README.md +164 -0
- data/Rakefile +45 -0
- data/bin/groonga-schema-diff +21 -0
- data/doc/text/lgpl-2.1.txt +502 -0
- data/doc/text/news.md +5 -0
- data/groonga-schema.gemspec +65 -0
- data/lib/groonga-schema/column.rb +211 -0
- data/lib/groonga-schema/command-line/groonga-schema-diff.rb +112 -0
- data/lib/groonga-schema/diff.rb +268 -0
- data/lib/groonga-schema/differ.rb +120 -0
- data/lib/groonga-schema/plugin.rb +40 -0
- data/lib/groonga-schema/schema.rb +87 -0
- data/lib/groonga-schema/table.rb +258 -0
- data/lib/groonga-schema/version.rb +19 -0
- data/lib/groonga-schema.rb +20 -0
- data/test/run-test.rb +32 -0
- data/test/test-column.rb +52 -0
- data/test/test-diff.rb +549 -0
- data/test/test-differ.rb +222 -0
- data/test/test-plugin.rb +43 -0
- data/test/test-schema.rb +138 -0
- data/test/test-table.rb +92 -0
- metadata +190 -0
data/test/test-differ.rb
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class DifferTest < Test::Unit::TestCase
|
18
|
+
setup do
|
19
|
+
@from = GroongaSchema::Schema.new
|
20
|
+
@to = GroongaSchema::Schema.new
|
21
|
+
@differ = GroongaSchema::Differ.new(@from, @to)
|
22
|
+
end
|
23
|
+
|
24
|
+
def plugin_register(arguments)
|
25
|
+
Groonga::Command::PluginRegister.new(arguments)
|
26
|
+
end
|
27
|
+
|
28
|
+
def table_create(arguments)
|
29
|
+
Groonga::Command::TableCreate.new(arguments)
|
30
|
+
end
|
31
|
+
|
32
|
+
def column_create(arguments)
|
33
|
+
Groonga::Command::ColumnCreate.new(arguments)
|
34
|
+
end
|
35
|
+
|
36
|
+
sub_test_case "#diff" do
|
37
|
+
test "plugin - add" do
|
38
|
+
@to.apply_command(plugin_register("name" => "token_filters/stem"))
|
39
|
+
|
40
|
+
expected = GroongaSchema::Diff.new
|
41
|
+
expected.added_plugins.concat(@to.plugins)
|
42
|
+
assert_equal(expected, @differ.diff)
|
43
|
+
end
|
44
|
+
|
45
|
+
test "plugin - remove" do
|
46
|
+
@from.apply_command(plugin_register("name" => "token_filters/stem"))
|
47
|
+
|
48
|
+
expected = GroongaSchema::Diff.new
|
49
|
+
expected.removed_plugins.concat(@from.plugins)
|
50
|
+
assert_equal(expected, @differ.diff)
|
51
|
+
end
|
52
|
+
|
53
|
+
test "table - add - without columns" do
|
54
|
+
arguments = {
|
55
|
+
"name" => "Words",
|
56
|
+
"flags" => "TABLE_PAT_KEY",
|
57
|
+
"key_type" => "ShortText",
|
58
|
+
"default_tokenizer" => "TokenBigram",
|
59
|
+
"normalizer" => "NormalizerAuto",
|
60
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
61
|
+
}
|
62
|
+
@to.apply_command(table_create(arguments))
|
63
|
+
|
64
|
+
expected = GroongaSchema::Diff.new
|
65
|
+
expected.added_tables["Words"] = @to.tables["Words"]
|
66
|
+
assert_equal(expected, @differ.diff)
|
67
|
+
end
|
68
|
+
|
69
|
+
test "table - add - with columns" do
|
70
|
+
table_create_arguments = {
|
71
|
+
"name" => "Words",
|
72
|
+
"flags" => "TABLE_PAT_KEY",
|
73
|
+
"key_type" => "ShortText",
|
74
|
+
"default_tokenizer" => "TokenBigram",
|
75
|
+
"normalizer" => "NormalizerAuto",
|
76
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
77
|
+
}
|
78
|
+
@to.apply_command(table_create(table_create_arguments))
|
79
|
+
column_create_arguments = {
|
80
|
+
"table" => "Words",
|
81
|
+
"name" => "entries_text",
|
82
|
+
"flags" => "COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_TINY",
|
83
|
+
"type" => "Entries",
|
84
|
+
"source" => "title, content",
|
85
|
+
}
|
86
|
+
@to.apply_command(column_create(column_create_arguments))
|
87
|
+
|
88
|
+
expected = GroongaSchema::Diff.new
|
89
|
+
expected.added_tables["Words"] = @to.tables["Words"]
|
90
|
+
expected.added_columns["Words"] = {
|
91
|
+
"entries_text" => @to.columns["Words"]["entries_text"],
|
92
|
+
}
|
93
|
+
assert_equal(expected, @differ.diff)
|
94
|
+
end
|
95
|
+
|
96
|
+
test "table - remove - without columns" do
|
97
|
+
arguments = {
|
98
|
+
"name" => "Words",
|
99
|
+
"flags" => "TABLE_PAT_KEY",
|
100
|
+
"key_type" => "ShortText",
|
101
|
+
"default_tokenizer" => "TokenBigram",
|
102
|
+
"normalizer" => "NormalizerAuto",
|
103
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
104
|
+
}
|
105
|
+
@from.apply_command(table_create(arguments))
|
106
|
+
|
107
|
+
expected = GroongaSchema::Diff.new
|
108
|
+
expected.removed_tables["Words"] = @from.tables["Words"]
|
109
|
+
assert_equal(expected, @differ.diff)
|
110
|
+
end
|
111
|
+
|
112
|
+
test "table - remove - with columns" do
|
113
|
+
table_create_arguments = {
|
114
|
+
"name" => "Words",
|
115
|
+
"flags" => "TABLE_PAT_KEY",
|
116
|
+
"key_type" => "ShortText",
|
117
|
+
"default_tokenizer" => "TokenBigram",
|
118
|
+
"normalizer" => "NormalizerAuto",
|
119
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
120
|
+
}
|
121
|
+
@from.apply_command(table_create(table_create_arguments))
|
122
|
+
column_create_arguments = {
|
123
|
+
"table" => "Words",
|
124
|
+
"name" => "entries_text",
|
125
|
+
"flags" => "COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_TINY",
|
126
|
+
"type" => "Entries",
|
127
|
+
"source" => "title, content",
|
128
|
+
}
|
129
|
+
@from.apply_command(column_create(column_create_arguments))
|
130
|
+
|
131
|
+
expected = GroongaSchema::Diff.new
|
132
|
+
expected.removed_tables["Words"] = @from.tables["Words"]
|
133
|
+
assert_equal(expected, @differ.diff)
|
134
|
+
end
|
135
|
+
|
136
|
+
test "table - change" do
|
137
|
+
from_arguments = {
|
138
|
+
"name" => "Words",
|
139
|
+
"flags" => "TABLE_PAT_KEY",
|
140
|
+
"key_type" => "ShortText",
|
141
|
+
"default_tokenizer" => "TokenBigram",
|
142
|
+
"normalizer" => "NormalizerAuto",
|
143
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
144
|
+
}
|
145
|
+
to_arguments = from_arguments.merge("default_tokenizer" => "TokenMecab")
|
146
|
+
@from.apply_command(table_create(from_arguments))
|
147
|
+
@to.apply_command(table_create(to_arguments))
|
148
|
+
|
149
|
+
expected = GroongaSchema::Diff.new
|
150
|
+
expected.changed_tables["Words"] = @to.tables["Words"]
|
151
|
+
assert_equal(expected, @differ.diff)
|
152
|
+
end
|
153
|
+
|
154
|
+
sub_test_case "column" do
|
155
|
+
setup do
|
156
|
+
arguments = {
|
157
|
+
"name" => "Words",
|
158
|
+
"flags" => "TABLE_PAT_KEY",
|
159
|
+
"key_type" => "ShortText",
|
160
|
+
"default_tokenizer" => "TokenBigram",
|
161
|
+
"normalizer" => "NormalizerAuto",
|
162
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
163
|
+
}
|
164
|
+
@from.apply_command(table_create(arguments))
|
165
|
+
@to.apply_command(table_create(arguments))
|
166
|
+
end
|
167
|
+
|
168
|
+
test "add" do
|
169
|
+
arguments = {
|
170
|
+
"table" => "Words",
|
171
|
+
"name" => "entries_text",
|
172
|
+
"flags" => "COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_TINY",
|
173
|
+
"type" => "Entries",
|
174
|
+
"source" => "title, content",
|
175
|
+
}
|
176
|
+
@to.apply_command(column_create(arguments))
|
177
|
+
|
178
|
+
expected = GroongaSchema::Diff.new
|
179
|
+
expected.added_columns["Words"] = {
|
180
|
+
"entries_text" => @to.columns["Words"]["entries_text"],
|
181
|
+
}
|
182
|
+
assert_equal(expected, @differ.diff)
|
183
|
+
end
|
184
|
+
|
185
|
+
test "remove" do
|
186
|
+
arguments = {
|
187
|
+
"table" => "Words",
|
188
|
+
"name" => "entries_text",
|
189
|
+
"flags" => "COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_TINY",
|
190
|
+
"type" => "Entries",
|
191
|
+
"source" => "title, content",
|
192
|
+
}
|
193
|
+
@from.apply_command(column_create(arguments))
|
194
|
+
|
195
|
+
expected = GroongaSchema::Diff.new
|
196
|
+
expected.removed_columns["Words"] = {
|
197
|
+
"entries_text" => @from.columns["Words"]["entries_text"],
|
198
|
+
}
|
199
|
+
assert_equal(expected, @differ.diff)
|
200
|
+
end
|
201
|
+
|
202
|
+
test "change" do
|
203
|
+
from_arguments = {
|
204
|
+
"table" => "Words",
|
205
|
+
"name" => "entries_text",
|
206
|
+
"flags" => "COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_TINY",
|
207
|
+
"type" => "Entries",
|
208
|
+
"source" => "title, content",
|
209
|
+
}
|
210
|
+
to_arguments = from_arguments.merge("source" => "title")
|
211
|
+
@from.apply_command(column_create(from_arguments))
|
212
|
+
@to.apply_command(column_create(to_arguments))
|
213
|
+
|
214
|
+
expected = GroongaSchema::Diff.new
|
215
|
+
expected.changed_columns["Words"] = {
|
216
|
+
"entries_text" => @to.columns["Words"]["entries_text"],
|
217
|
+
}
|
218
|
+
assert_equal(expected, @differ.diff)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
data/test/test-plugin.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class PluginTest < Test::Unit::TestCase
|
18
|
+
sub_test_case "#==" do
|
19
|
+
test "equal" do
|
20
|
+
plugin1 = GroongaSchema::Plugin.new("token_filters/stem")
|
21
|
+
plugin2 = GroongaSchema::Plugin.new("token_filters/stem")
|
22
|
+
assert_equal(plugin1, plugin2)
|
23
|
+
end
|
24
|
+
|
25
|
+
test "not equal" do
|
26
|
+
plugin1 = GroongaSchema::Plugin.new("token_filters/stem")
|
27
|
+
plugin2 = GroongaSchema::Plugin.new("token_filters/stop_word")
|
28
|
+
assert_not_equal(plugin1, plugin2)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
test "#to_register_groonga_command" do
|
33
|
+
plugin = GroongaSchema::Plugin.new("token_filters/stem")
|
34
|
+
assert_equal("plugin_register --name \"token_filters/stem\"",
|
35
|
+
plugin.to_register_groonga_command.to_command_format)
|
36
|
+
end
|
37
|
+
|
38
|
+
test "#to_unregister_groonga_command" do
|
39
|
+
plugin = GroongaSchema::Plugin.new("token_filters/stem")
|
40
|
+
assert_equal("plugin_unregister --name \"token_filters/stem\"",
|
41
|
+
plugin.to_unregister_groonga_command.to_command_format)
|
42
|
+
end
|
43
|
+
end
|
data/test/test-schema.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class SchemaTest < Test::Unit::TestCase
|
18
|
+
def setup
|
19
|
+
@schema = GroongaSchema::Schema.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def register(arguments)
|
23
|
+
Groonga::Command::Register.new(arguments)
|
24
|
+
end
|
25
|
+
|
26
|
+
def plugin_register(arguments)
|
27
|
+
Groonga::Command::PluginRegister.new(arguments)
|
28
|
+
end
|
29
|
+
|
30
|
+
def table_create(arguments)
|
31
|
+
Groonga::Command::TableCreate.new(arguments)
|
32
|
+
end
|
33
|
+
|
34
|
+
def column_create(arguments)
|
35
|
+
Groonga::Command::ColumnCreate.new(arguments)
|
36
|
+
end
|
37
|
+
|
38
|
+
sub_test_case "#apply_command" do
|
39
|
+
test "plugin - register" do
|
40
|
+
command = register("path" => "token_filters/stem")
|
41
|
+
@schema.apply_command(command)
|
42
|
+
|
43
|
+
assert_equal(["token_filters/stem"],
|
44
|
+
@schema.plugins.collect(&:name))
|
45
|
+
end
|
46
|
+
|
47
|
+
test "plugin - plugin_register" do
|
48
|
+
command = plugin_register("name" => "token_filters/stem")
|
49
|
+
@schema.apply_command(command)
|
50
|
+
|
51
|
+
assert_equal(["token_filters/stem"],
|
52
|
+
@schema.plugins.collect(&:name))
|
53
|
+
end
|
54
|
+
|
55
|
+
test "lexicon" do
|
56
|
+
arguments = {
|
57
|
+
"name" => "Words",
|
58
|
+
"flags" => "TABLE_PAT_KEY",
|
59
|
+
"key_type" => "ShortText",
|
60
|
+
"default_tokenizer" => "TokenBigram",
|
61
|
+
"normalizer" => "NormalizerAuto",
|
62
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
63
|
+
}
|
64
|
+
command = table_create(arguments)
|
65
|
+
@schema.apply_command(command)
|
66
|
+
|
67
|
+
table_data = @schema.tables.collect do |name, table|
|
68
|
+
{
|
69
|
+
:name => name,
|
70
|
+
:type => table.type,
|
71
|
+
:flags => table.flags,
|
72
|
+
:key_type => table.key_type,
|
73
|
+
:value_type => table.value_type,
|
74
|
+
:default_tokenizer => table.default_tokenizer,
|
75
|
+
:normalizer => table.normalizer,
|
76
|
+
:token_filters => table.token_filters,
|
77
|
+
:reference_key_type? => table.reference_key_type?,
|
78
|
+
}
|
79
|
+
end
|
80
|
+
assert_equal([
|
81
|
+
{
|
82
|
+
:name => "Words",
|
83
|
+
:type => :pat_key,
|
84
|
+
:flags => [],
|
85
|
+
:key_type => "ShortText",
|
86
|
+
:value_type => nil,
|
87
|
+
:default_tokenizer => "TokenBigram",
|
88
|
+
:normalizer => "NormalizerAuto",
|
89
|
+
:token_filters => ["TokenStem", "TokenStopWord"],
|
90
|
+
:reference_key_type? => false,
|
91
|
+
},
|
92
|
+
],
|
93
|
+
table_data)
|
94
|
+
end
|
95
|
+
|
96
|
+
test "index column" do
|
97
|
+
@schema.apply_command(table_create("name" => "Entries",
|
98
|
+
"flags" => "TABLE_NO_KEY"))
|
99
|
+
arguments = {
|
100
|
+
"table" => "Words",
|
101
|
+
"name" => "entries_text",
|
102
|
+
"flags" => "COLUMN_INDEX|WITH_POSITION|WITH_SECTION|INDEX_TINY",
|
103
|
+
"type" => "Entries",
|
104
|
+
"source" => "title, content",
|
105
|
+
}
|
106
|
+
command = column_create(arguments)
|
107
|
+
@schema.apply_command(command)
|
108
|
+
|
109
|
+
column_data = []
|
110
|
+
@schema.columns.each do |table_name, columns|
|
111
|
+
columns.each do |column_name, column|
|
112
|
+
column_data << {
|
113
|
+
:table_name => table_name,
|
114
|
+
:name => column_name,
|
115
|
+
:type => column.type,
|
116
|
+
:flags => column.flags,
|
117
|
+
:value_type => column.value_type,
|
118
|
+
:sources => column.sources,
|
119
|
+
:reference_value_type? => column.reference_value_type?,
|
120
|
+
}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
flags = ["WITH_POSITION", "WITH_SECTION", "INDEX_TINY"]
|
124
|
+
assert_equal([
|
125
|
+
{
|
126
|
+
:table_name => "Words",
|
127
|
+
:name => "entries_text",
|
128
|
+
:type => :index,
|
129
|
+
:flags => flags,
|
130
|
+
:value_type => "Entries",
|
131
|
+
:sources => ["title", "content"],
|
132
|
+
:reference_value_type? => true,
|
133
|
+
},
|
134
|
+
],
|
135
|
+
column_data)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
data/test/test-table.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TableTest < Test::Unit::TestCase
|
18
|
+
def table_create(arguments)
|
19
|
+
Groonga::Command::TableCreate.new(arguments)
|
20
|
+
end
|
21
|
+
|
22
|
+
sub_test_case "#apply_command" do
|
23
|
+
test "lexicon" do
|
24
|
+
arguments = {
|
25
|
+
"name" => "Words",
|
26
|
+
"flags" => "TABLE_PAT_KEY",
|
27
|
+
"key_type" => "ShortText",
|
28
|
+
"default_tokenizer" => "TokenBigram",
|
29
|
+
"normalizer" => "NormalizerAuto",
|
30
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
31
|
+
}
|
32
|
+
command = table_create(arguments)
|
33
|
+
table = GroongaSchema::Table.new("Words")
|
34
|
+
table.apply_command(command)
|
35
|
+
assert_equal({
|
36
|
+
:name => "Words",
|
37
|
+
:type => :pat_key,
|
38
|
+
:flags => [],
|
39
|
+
:key_type => "ShortText",
|
40
|
+
:value_type => nil,
|
41
|
+
:default_tokenizer => "TokenBigram",
|
42
|
+
:normalizer => "NormalizerAuto",
|
43
|
+
:token_filters => ["TokenStem", "TokenStopWord"],
|
44
|
+
},
|
45
|
+
{
|
46
|
+
:name => table.name,
|
47
|
+
:type => table.type,
|
48
|
+
:flags => table.flags,
|
49
|
+
:key_type => table.key_type,
|
50
|
+
:value_type => table.value_type,
|
51
|
+
:default_tokenizer => table.default_tokenizer,
|
52
|
+
:normalizer => table.normalizer,
|
53
|
+
:token_filters => table.token_filters,
|
54
|
+
})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
sub_test_case "#==" do
|
59
|
+
test "equal" do
|
60
|
+
arguments = {
|
61
|
+
"name" => "Words",
|
62
|
+
"flags" => "TABLE_PAT_KEY",
|
63
|
+
"key_type" => "ShortText",
|
64
|
+
"default_tokenizer" => "TokenBigram",
|
65
|
+
"normalizer" => "NormalizerAuto",
|
66
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
67
|
+
}
|
68
|
+
command = table_create(arguments)
|
69
|
+
table1 = GroongaSchema::Table.new("Words")
|
70
|
+
table1.apply_command(command)
|
71
|
+
table2 = GroongaSchema::Table.new("Words")
|
72
|
+
table2.apply_command(command)
|
73
|
+
assert_equal(table1, table2)
|
74
|
+
end
|
75
|
+
|
76
|
+
test "not equal" do
|
77
|
+
arguments = {
|
78
|
+
"name" => "Words",
|
79
|
+
"flags" => "TABLE_PAT_KEY",
|
80
|
+
"key_type" => "ShortText",
|
81
|
+
"default_tokenizer" => "TokenBigram",
|
82
|
+
"normalizer" => "NormalizerAuto",
|
83
|
+
"token_filters" => "TokenStem|TokenStopWord",
|
84
|
+
}
|
85
|
+
table1 = GroongaSchema::Table.new("Words1")
|
86
|
+
table1.apply_command(table_create(arguments.merge("name" => "Words1")))
|
87
|
+
table2 = GroongaSchema::Table.new("Words2")
|
88
|
+
table2.apply_command(table_create(arguments.merge("name" => "Words2")))
|
89
|
+
assert_not_equal(table1, table2)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: groonga-schema
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kouhei Sutou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: groonga-command
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: groonga-command-parser
|
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: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
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
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: packnga
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: kramdown
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: ''
|
126
|
+
email:
|
127
|
+
- kou@clear-code.com
|
128
|
+
executables:
|
129
|
+
- groonga-schema-diff
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".yardopts"
|
134
|
+
- Gemfile
|
135
|
+
- README.md
|
136
|
+
- Rakefile
|
137
|
+
- bin/groonga-schema-diff
|
138
|
+
- doc/text/lgpl-2.1.txt
|
139
|
+
- doc/text/news.md
|
140
|
+
- groonga-schema.gemspec
|
141
|
+
- lib/groonga-schema.rb
|
142
|
+
- lib/groonga-schema/column.rb
|
143
|
+
- lib/groonga-schema/command-line/groonga-schema-diff.rb
|
144
|
+
- lib/groonga-schema/diff.rb
|
145
|
+
- lib/groonga-schema/differ.rb
|
146
|
+
- lib/groonga-schema/plugin.rb
|
147
|
+
- lib/groonga-schema/schema.rb
|
148
|
+
- lib/groonga-schema/table.rb
|
149
|
+
- lib/groonga-schema/version.rb
|
150
|
+
- test/run-test.rb
|
151
|
+
- test/test-column.rb
|
152
|
+
- test/test-diff.rb
|
153
|
+
- test/test-differ.rb
|
154
|
+
- test/test-plugin.rb
|
155
|
+
- test/test-schema.rb
|
156
|
+
- test/test-table.rb
|
157
|
+
homepage: https://github.com/groonga/groonga-schema
|
158
|
+
licenses:
|
159
|
+
- LGPLv2.1+
|
160
|
+
metadata: {}
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.5.1
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: Groonga-schema is a Ruby library and tool to processes [Groonga](http://groonga.org/)'s
|
181
|
+
schema.
|
182
|
+
test_files:
|
183
|
+
- test/test-plugin.rb
|
184
|
+
- test/test-column.rb
|
185
|
+
- test/test-diff.rb
|
186
|
+
- test/run-test.rb
|
187
|
+
- test/test-table.rb
|
188
|
+
- test/test-schema.rb
|
189
|
+
- test/test-differ.rb
|
190
|
+
has_rdoc:
|