groonga-database-viewer-gtk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/NEWS.md +5 -0
- data/README.md +33 -0
- data/Rakefile +25 -0
- data/bin/groonga-database-viewer-gtk +21 -0
- data/groonga-database-viewer-gtk.gemspec +54 -0
- data/lib/groonga/database-viewer-gtk.rb +18 -0
- data/lib/groonga/database-viewer-gtk/version.rb +21 -0
- data/lib/groonga/database-viewer-gtk/window.rb +260 -0
- data/test/run-test.rb +26 -0
- data/test/test-window.rb +41 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1fda9b07864087f8a3d2c871764520900aa608ba
|
4
|
+
data.tar.gz: 53596509c98d1ee9cca7a79feee50445a8f4f24d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3460cf8e7d0b9843f3d9bf2695b549011cba95dd08055fa43d37f4e0e7c2aa17ca6eeb1260ef7565164dbc081581df8f3046a7d1f57e253245d9251fb994fac0
|
7
|
+
data.tar.gz: f6c08d4c8d7f785c734b83e2823b558dfcd3cf81bf98e57101380701e9796c1dfd1882e6d6bfae84363d9caf3993068dade718b8b563c9a88aa53b4f55a3417a
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# README
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/myokoym/groonga-database-viewer-gtk.png?branch=master)](https://travis-ci.org/myokoym/groonga-database-viewer-gtk)
|
4
|
+
|
5
|
+
## Name
|
6
|
+
|
7
|
+
groonga-database-viewer-gtk
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
a graphical database viewer for [Groonga][] by [GTK+][] with [Ruby][].
|
12
|
+
|
13
|
+
[Groonga]:http://groonga.org/
|
14
|
+
[GTK+]:http://www.gtk.org/
|
15
|
+
[Ruby]:https://www.ruby-lang.org/
|
16
|
+
|
17
|
+
## Install
|
18
|
+
|
19
|
+
$ gem install groonga-database-viewer-gtk
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
$ groonga-database-viewer-gtk DB_PATH
|
24
|
+
|
25
|
+
## Authors
|
26
|
+
|
27
|
+
* Masafumi Yokoyama `<myokoym@gmail.com>`
|
28
|
+
|
29
|
+
## License
|
30
|
+
|
31
|
+
LGPLv2.1 or later.
|
32
|
+
|
33
|
+
See LICENSE.txt or http://www.gnu.org/licenses/lgpl-2.1 for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.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
|
+
require "bundler/gem_tasks"
|
18
|
+
|
19
|
+
desc "Run test"
|
20
|
+
task :test do
|
21
|
+
Bundler::GemHelper.install_tasks
|
22
|
+
ruby("test/run-test.rb")
|
23
|
+
end
|
24
|
+
|
25
|
+
task :default => :test
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "groonga/database-viewer-gtk/window"
|
20
|
+
|
21
|
+
Groonga::DatabaseViewerGtk::Window.new(ARGV[0]).run
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
base_dir = File.dirname(__FILE__)
|
20
|
+
lib_dir = File.join(base_dir, "lib")
|
21
|
+
|
22
|
+
$LOAD_PATH.unshift(lib_dir)
|
23
|
+
require "groonga/database-viewer-gtk/version"
|
24
|
+
|
25
|
+
Gem::Specification.new do |spec|
|
26
|
+
spec.name = "groonga-database-viewer-gtk"
|
27
|
+
spec.version = Groonga::DatabaseViewerGtk::VERSION
|
28
|
+
|
29
|
+
spec.authors = ["Masafumi Yokoyama"]
|
30
|
+
spec.email = ["myokoym@gmail.com"]
|
31
|
+
|
32
|
+
spec.summary = %q{a graphical database viewer for Groonga by GTK+ with Ruby.}
|
33
|
+
spec.description = spec.summary
|
34
|
+
|
35
|
+
spec.files = ["README.md", "Rakefile", "Gemfile", "#{spec.name}.gemspec"]
|
36
|
+
spec.files += ["NEWS.md"]
|
37
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
38
|
+
spec.test_files += Dir.glob("test/**/*")
|
39
|
+
Dir.chdir("bin") do
|
40
|
+
spec.executables = Dir.glob("*")
|
41
|
+
end
|
42
|
+
|
43
|
+
spec.homepage = "https://github.com/myokoym/groonga-database-viewer-gtk"
|
44
|
+
spec.licenses = ["LGPLv2+"]
|
45
|
+
spec.require_paths = ["lib"]
|
46
|
+
|
47
|
+
spec.add_runtime_dependency("rroonga")
|
48
|
+
spec.add_runtime_dependency("gtk2")
|
49
|
+
|
50
|
+
spec.add_development_dependency("test-unit", ">= 3.0.0")
|
51
|
+
spec.add_development_dependency("test-unit-notify")
|
52
|
+
spec.add_development_dependency("bundler")
|
53
|
+
spec.add_development_dependency("rake")
|
54
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.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
|
+
require "groonga/database_viewer_gtk/version"
|
18
|
+
require "groonga/database_viewer_gtk/window"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.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
|
+
module Groonga
|
18
|
+
module DatabaseViewerGtk
|
19
|
+
VERSION = "0.0.1"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.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
|
+
require "groonga"
|
18
|
+
require "gtk2"
|
19
|
+
|
20
|
+
module Groonga
|
21
|
+
module DatabaseViewerGtk
|
22
|
+
class Window < Gtk::Window
|
23
|
+
def initialize(db_path)
|
24
|
+
super()
|
25
|
+
set_default_size(640, 480)
|
26
|
+
@grn_database = Database.open(db_path)
|
27
|
+
signal_connect("destroy") do
|
28
|
+
@grn_database.close unless @grn_database.closed?
|
29
|
+
Gtk.main_quit
|
30
|
+
end
|
31
|
+
|
32
|
+
vbox = Gtk::VBox.new
|
33
|
+
add(vbox)
|
34
|
+
|
35
|
+
search_hbox = create_search_hbox
|
36
|
+
vbox.pack_start(search_hbox, false, false, 4)
|
37
|
+
|
38
|
+
@notebook = create_notebook
|
39
|
+
vbox.pack_start(@notebook, true, true, 0)
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
show_all
|
44
|
+
Gtk.main
|
45
|
+
end
|
46
|
+
|
47
|
+
def init_view(page_num)
|
48
|
+
target = get_tree_view(page_num)
|
49
|
+
return unless target
|
50
|
+
return if target.updated
|
51
|
+
limit = @limit_combo.active_text.delete(",").to_i
|
52
|
+
target.update_model(limit)
|
53
|
+
end
|
54
|
+
|
55
|
+
def select(column, word)
|
56
|
+
if word.empty?
|
57
|
+
query = nil
|
58
|
+
elsif column == "_id"
|
59
|
+
query = "#{column}:#{word}"
|
60
|
+
else
|
61
|
+
query = "#{column}:@#{word}"
|
62
|
+
end
|
63
|
+
target = get_tree_view(@notebook.page)
|
64
|
+
return unless target
|
65
|
+
limit = @limit_combo.active_text.delete(",").to_i
|
66
|
+
target.update_model(limit, query)
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_tree_view(page_num)
|
70
|
+
page_widget = @notebook.children[page_num]
|
71
|
+
if page_widget.is_a?(Gtk::ScrolledWindow)
|
72
|
+
page_widget.each do |child|
|
73
|
+
if child.is_a?(TreeView)
|
74
|
+
return child
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
return nil
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
def create_search_hbox
|
83
|
+
hbox = Gtk::HBox.new
|
84
|
+
|
85
|
+
@combo_box = Gtk::ComboBox.new
|
86
|
+
hbox.pack_start(@combo_box, false, false, 4)
|
87
|
+
|
88
|
+
@entry = Gtk::Entry.new
|
89
|
+
@entry.signal_connect("activate") do |_entry|
|
90
|
+
select(@combo_box.active_text, _entry.text)
|
91
|
+
end
|
92
|
+
hbox.pack_start(@entry, false, false, 0)
|
93
|
+
|
94
|
+
@search_button = Gtk::Button.new("Search")
|
95
|
+
@search_button.signal_connect("clicked") do
|
96
|
+
select(@combo_box.active_text, @entry.text)
|
97
|
+
end
|
98
|
+
hbox.pack_start(@search_button, false, false, 0)
|
99
|
+
|
100
|
+
@limit_combo = Gtk::ComboBox.new
|
101
|
+
9.times do |i|
|
102
|
+
text = (10 ** i).to_s.reverse.gsub(/(\d{3})(?=\d)/, '\1,').reverse
|
103
|
+
@limit_combo.append_text(text)
|
104
|
+
end
|
105
|
+
@limit_combo.append_text("268,435,455")
|
106
|
+
@limit_combo.active = 0
|
107
|
+
hbox.pack_end(@limit_combo, false, false, 4)
|
108
|
+
|
109
|
+
label = Gtk::Label.new("Limit:")
|
110
|
+
hbox.pack_end(label, false, false, 0)
|
111
|
+
|
112
|
+
hbox
|
113
|
+
end
|
114
|
+
|
115
|
+
def update_combo_box(page_num)
|
116
|
+
# TODO
|
117
|
+
100.times do
|
118
|
+
@combo_box.remove_text(0)
|
119
|
+
end
|
120
|
+
target = get_tree_view(page_num)
|
121
|
+
if target
|
122
|
+
@combo_box.append_text("_id")
|
123
|
+
@combo_box.append_text("_key")
|
124
|
+
target.grn_table.columns.each do |column|
|
125
|
+
@combo_box.append_text(column.local_name)
|
126
|
+
end
|
127
|
+
@combo_box.active = 1
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def create_notebook
|
132
|
+
notebook = Gtk::Notebook.new
|
133
|
+
|
134
|
+
#label = Gtk::Label.new("Groonga")
|
135
|
+
#notebook.append_page(Gtk::Label.new, label)
|
136
|
+
|
137
|
+
@grn_database.tables.each do |grn_table|
|
138
|
+
scrolled_window = Gtk::ScrolledWindow.new
|
139
|
+
scrolled_window.set_policy(:automatic, :automatic)
|
140
|
+
|
141
|
+
tree_view = TreeView.new(grn_table, @grn_database.path)
|
142
|
+
scrolled_window.add(tree_view)
|
143
|
+
|
144
|
+
label = Gtk::Label.new(grn_table.name)
|
145
|
+
notebook.append_page(scrolled_window, label)
|
146
|
+
end
|
147
|
+
|
148
|
+
notebook.signal_connect("switch-page") do |_notebook, page, page_num|
|
149
|
+
init_view(page_num)
|
150
|
+
update_combo_box(page_num)
|
151
|
+
end
|
152
|
+
|
153
|
+
notebook
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
class TreeView < Gtk::TreeView
|
158
|
+
ID_COLUMN_INDEX = 0
|
159
|
+
KEY_COLUMN_INDEX = 1
|
160
|
+
|
161
|
+
attr_reader :updated
|
162
|
+
attr_reader :grn_table
|
163
|
+
|
164
|
+
def initialize(grn_table, db_path)
|
165
|
+
super()
|
166
|
+
@grn_table = grn_table
|
167
|
+
@db_path = db_path
|
168
|
+
@updated = false
|
169
|
+
@threads = []
|
170
|
+
signal_connect("destroy") do
|
171
|
+
@threads.each do |thread|
|
172
|
+
thread.kill
|
173
|
+
end
|
174
|
+
end
|
175
|
+
create_tree_view
|
176
|
+
end
|
177
|
+
|
178
|
+
def create_tree_view
|
179
|
+
self.rules_hint = true
|
180
|
+
|
181
|
+
create_column("_id", ID_COLUMN_INDEX)
|
182
|
+
create_column("_key", KEY_COLUMN_INDEX)
|
183
|
+
|
184
|
+
@grn_table.columns.each_with_index do |grn_column, i|
|
185
|
+
create_column(grn_column.local_name, i + 2)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def create_column(name, index)
|
190
|
+
gtk_column = Gtk::TreeViewColumn.new
|
191
|
+
gtk_column.title = name.gsub(/_/, "__")
|
192
|
+
gtk_column.resizable = true
|
193
|
+
gtk_column.set_sort_column_id(index)
|
194
|
+
append_column(gtk_column)
|
195
|
+
|
196
|
+
renderer = Gtk::CellRendererText.new
|
197
|
+
gtk_column.pack_start(renderer, :expand => false)
|
198
|
+
gtk_column.add_attribute(renderer, :text, index)
|
199
|
+
end
|
200
|
+
|
201
|
+
def update_model(limit, query=nil)
|
202
|
+
@threads.reject! do |thread|
|
203
|
+
thread.kill
|
204
|
+
true
|
205
|
+
end
|
206
|
+
|
207
|
+
column_types = @grn_table.columns.collect do |column|
|
208
|
+
# TODO
|
209
|
+
String
|
210
|
+
end
|
211
|
+
column_types.unshift(String) # _key
|
212
|
+
column_types.unshift(Integer) # _id
|
213
|
+
|
214
|
+
model = Gtk::ListStore.new(*column_types)
|
215
|
+
self.model = model
|
216
|
+
|
217
|
+
thread = Thread.new do
|
218
|
+
each_records(limit, query).each do |grn_record|
|
219
|
+
load_record(model, grn_record)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
@threads << thread
|
223
|
+
|
224
|
+
@updated = true
|
225
|
+
end
|
226
|
+
|
227
|
+
def load_record(model, grn_record)
|
228
|
+
iter = model.append
|
229
|
+
iter.set_value(ID_COLUMN_INDEX, grn_record._id)
|
230
|
+
iter.set_value(KEY_COLUMN_INDEX, grn_record._key) if grn_record.respond_to?(:_key)
|
231
|
+
@grn_table.columns.each_with_index do |grn_column, i|
|
232
|
+
value = grn_record[grn_column.local_name]
|
233
|
+
iter.set_value(i + 2, value.to_s)
|
234
|
+
if grn_column.index?
|
235
|
+
ids = grn_column.search(grn_record._id).records.collect {|record| record._id}
|
236
|
+
value = "#{ids.size}, #{ids.to_s}"
|
237
|
+
else
|
238
|
+
value = grn_record[grn_column.local_name].to_s
|
239
|
+
end
|
240
|
+
iter.set_value(2 + i, value)
|
241
|
+
GC.start if i % 100 == 0
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def each_records(limit, query=nil)
|
246
|
+
grn_records = Groonga[@grn_table.name]
|
247
|
+
if query
|
248
|
+
grn_records = grn_records.select(query)
|
249
|
+
end
|
250
|
+
if block_given?
|
251
|
+
grn_records.take(limit).each do |grn_record|
|
252
|
+
yield(grn_record)
|
253
|
+
end
|
254
|
+
else
|
255
|
+
grn_records.take(limit)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
data/test/run-test.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "test-unit"
|
20
|
+
require "test/unit/notify"
|
21
|
+
|
22
|
+
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
23
|
+
$LOAD_PATH.unshift(File.join(base_dir, "lib"))
|
24
|
+
$LOAD_PATH.unshift(File.join(base_dir, "test"))
|
25
|
+
|
26
|
+
exit Test::Unit::AutoRunner.run(true)
|
data/test/test-window.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.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
|
+
require "fileutils"
|
18
|
+
require "groonga/database-viewer-gtk/window"
|
19
|
+
|
20
|
+
class WindowTest < Test::Unit::TestCase
|
21
|
+
class DatabaseTest < self
|
22
|
+
def setup
|
23
|
+
@tmpdir_base = File.join(File.dirname(__FILE__), "tmp")
|
24
|
+
@tmpdir = File.join(@tmpdir_base, "database")
|
25
|
+
FileUtils.rm_rf(@tmpdir)
|
26
|
+
FileUtils.mkdir_p(@tmpdir)
|
27
|
+
@db_path = File.join(@tmpdir, "test.db")
|
28
|
+
Groonga::Database.create(:path => @db_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def teardown
|
32
|
+
FileUtils.rm_rf(@tmpdir)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_new
|
36
|
+
assert do
|
37
|
+
Groonga::DatabaseViewerGtk::Window.new(@db_path)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: groonga-database-viewer-gtk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masafumi Yokoyama
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rroonga
|
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: gtk2
|
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: 3.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit-notify
|
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: rake
|
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
|
+
description: a graphical database viewer for Groonga by GTK+ with Ruby.
|
98
|
+
email:
|
99
|
+
- myokoym@gmail.com
|
100
|
+
executables:
|
101
|
+
- groonga-database-viewer-gtk
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- Gemfile
|
106
|
+
- NEWS.md
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- bin/groonga-database-viewer-gtk
|
110
|
+
- groonga-database-viewer-gtk.gemspec
|
111
|
+
- lib/groonga/database-viewer-gtk.rb
|
112
|
+
- lib/groonga/database-viewer-gtk/version.rb
|
113
|
+
- lib/groonga/database-viewer-gtk/window.rb
|
114
|
+
- test/run-test.rb
|
115
|
+
- test/test-window.rb
|
116
|
+
homepage: https://github.com/myokoym/groonga-database-viewer-gtk
|
117
|
+
licenses:
|
118
|
+
- LGPLv2+
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.2.2
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: a graphical database viewer for Groonga by GTK+ with Ruby.
|
140
|
+
test_files:
|
141
|
+
- test/test-window.rb
|
142
|
+
- test/run-test.rb
|
143
|
+
has_rdoc:
|