clipcellar 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +13 -0
- data/README.md +1 -1
- data/lib/clipcellar/command.rb +9 -2
- data/lib/clipcellar/groonga_searcher.rb +1 -1
- data/lib/clipcellar/tree_view.rb +2 -0
- data/lib/clipcellar/version.rb +1 -1
- data/lib/clipcellar/window.rb +7 -4
- data/test/test-command.rb +53 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3334556a4ade285c592621dbfabda41354f6e4af
|
4
|
+
data.tar.gz: 4fb743564c2d596b3fd0f37db0cbb060584a0c44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a77254d551eccb63a6369ef2b53714b583fdec3520fb7d9ffcd585bd3d4e568fdaaf470708b1c048207893f46271a60b72c1957c114eabb44c473bf811e52145
|
7
|
+
data.tar.gz: 0f53223f6bbbe6cb4e821cea6b9230d9d4e455ac360522933dd518c5fd41ad56adb48835d282b84c14472bdfcc1ad6ad899b152bcbc74af8e99d0420c22eb30e
|
data/NEWS.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.0.2: 2014-07-30
|
4
|
+
|
5
|
+
### Changes
|
6
|
+
|
7
|
+
* Improvements
|
8
|
+
* Add --lines option for show command
|
9
|
+
* Add an alias -g for GUI mode option
|
10
|
+
* Support sorting on GUI
|
11
|
+
|
12
|
+
* Fixes
|
13
|
+
* Fix the search order
|
14
|
+
* Fix an error to try to remove when not selected
|
15
|
+
|
3
16
|
## 0.0.1: 2014-07-29
|
4
17
|
|
5
18
|
Initial release!
|
data/README.md
CHANGED
data/lib/clipcellar/command.rb
CHANGED
@@ -72,7 +72,8 @@ module Clipcellar
|
|
72
72
|
end
|
73
73
|
|
74
74
|
desc "show [--gui]", "Show added texts in data store"
|
75
|
-
option :gui, :type => :boolean, :desc => "GUI mode"
|
75
|
+
option :gui, :type => :boolean, :aliases => "-g", :desc => "GUI mode"
|
76
|
+
option :lines, :type => :numeric, :aliases => "-n", :desc => "Number of lines"
|
76
77
|
def show
|
77
78
|
records = []
|
78
79
|
GroongaDatabase.new.open(@database_dir) do |database|
|
@@ -89,6 +90,12 @@ module Clipcellar
|
|
89
90
|
record[:time]
|
90
91
|
end
|
91
92
|
|
93
|
+
if options[:lines]
|
94
|
+
records.reverse!
|
95
|
+
records = records.take(options[:lines])
|
96
|
+
records.reverse!
|
97
|
+
end
|
98
|
+
|
92
99
|
if options[:gui]
|
93
100
|
records.reverse!
|
94
101
|
window = Window.new(records)
|
@@ -104,7 +111,7 @@ module Clipcellar
|
|
104
111
|
end
|
105
112
|
|
106
113
|
desc "search WORD... [--gui]", "Search texts from data store"
|
107
|
-
option :gui, :type => :boolean, :desc => "GUI mode"
|
114
|
+
option :gui, :type => :boolean, :aliases => "-g", :desc => "GUI mode"
|
108
115
|
def search(required_word, *optional_words)
|
109
116
|
words = [required_word]
|
110
117
|
words += optional_words
|
data/lib/clipcellar/tree_view.rb
CHANGED
@@ -83,6 +83,7 @@ module Clipcellar
|
|
83
83
|
renderer = Gtk::CellRendererText.new
|
84
84
|
column.pack_start(renderer, :expand => false)
|
85
85
|
column.add_attribute(renderer, :text, STRFTIME_COLUMN)
|
86
|
+
column.set_sort_column_id(STRFTIME_COLUMN)
|
86
87
|
|
87
88
|
column = Gtk::TreeViewColumn.new
|
88
89
|
column.title = "Part of a Text (the Full Text appears in a Tooltip)"
|
@@ -90,6 +91,7 @@ module Clipcellar
|
|
90
91
|
renderer = Gtk::CellRendererText.new
|
91
92
|
column.pack_start(renderer, :expand => false)
|
92
93
|
column.add_attribute(renderer, :text, LINE_COLUMN)
|
94
|
+
column.set_sort_column_id(LINE_COLUMN)
|
93
95
|
|
94
96
|
expand_all
|
95
97
|
end
|
data/lib/clipcellar/version.rb
CHANGED
data/lib/clipcellar/window.rb
CHANGED
@@ -103,11 +103,14 @@ module Clipcellar
|
|
103
103
|
when Gdk::Keyval::GDK_KEY_p
|
104
104
|
10.times { @tree_view.prev }
|
105
105
|
when Gdk::Keyval::GDK_KEY_d
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
key = @tree_view.selected_key
|
107
|
+
if key
|
108
|
+
# TODO: don't want to use Command class.
|
109
|
+
GroongaDatabase.new.open(Command.new.database_dir) do |database|
|
110
|
+
database.delete(key)
|
111
|
+
end
|
112
|
+
@tree_view.remove_selected_record
|
109
113
|
end
|
110
|
-
@tree_view.remove_selected_record
|
111
114
|
else
|
112
115
|
return false
|
113
116
|
end
|
data/test/test-command.rb
CHANGED
@@ -20,34 +20,68 @@ require "clipcellar/version"
|
|
20
20
|
require "clipcellar/command"
|
21
21
|
|
22
22
|
class CommandTest < Test::Unit::TestCase
|
23
|
-
|
24
|
-
|
25
|
-
@@tmpdir_base = File.join(File.dirname(__FILE__), "tmp")
|
26
|
-
@@tmpdir = File.join(@@tmpdir_base, "database")
|
27
|
-
FileUtils.rm_rf(@@tmpdir)
|
28
|
-
FileUtils.mkdir_p(@@tmpdir)
|
29
|
-
@@command = Clipcellar::Command.new
|
30
|
-
@@command.instance_variable_set(:@base_dir, @@tmpdir_base)
|
31
|
-
@@command.instance_variable_set(:@database_dir, @@tmpdir)
|
32
|
-
end
|
33
|
-
|
34
|
-
def shutdown
|
35
|
-
FileUtils.rm_rf(@@tmpdir)
|
36
|
-
end
|
23
|
+
def setup
|
24
|
+
@command = Clipcellar::Command.new
|
37
25
|
end
|
38
26
|
|
39
27
|
def test_version
|
40
28
|
s = ""
|
41
29
|
io = StringIO.new(s)
|
42
30
|
$stdout = io
|
43
|
-
|
31
|
+
@command.version
|
44
32
|
assert_equal("#{Clipcellar::VERSION}\n", s)
|
45
33
|
$stdout = STDOUT
|
46
34
|
end
|
47
35
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
36
|
+
class DatabaseTest < self
|
37
|
+
def setup
|
38
|
+
@tmpdir_base = File.join(File.dirname(__FILE__), "tmp")
|
39
|
+
@tmpdir = File.join(@tmpdir_base, "database")
|
40
|
+
FileUtils.rm_rf(@tmpdir)
|
41
|
+
FileUtils.mkdir_p(@tmpdir)
|
42
|
+
super
|
43
|
+
@command.instance_variable_set(:@base_dir, @tmpdir_base)
|
44
|
+
@command.instance_variable_set(:@database_dir, @tmpdir)
|
45
|
+
end
|
46
|
+
|
47
|
+
def teardown
|
48
|
+
FileUtils.rm_rf(@tmpdir)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_set
|
52
|
+
# TODO
|
53
|
+
assert_nothing_raised do
|
54
|
+
@command.set("text")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_input
|
59
|
+
# TODO
|
60
|
+
assert_nothing_raised do
|
61
|
+
ARGV.push("input")
|
62
|
+
ARGV.push(__FILE__)
|
63
|
+
@command.input
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_show
|
68
|
+
# TODO
|
69
|
+
assert_nothing_raised do
|
70
|
+
@command.show
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_search
|
75
|
+
# TODO
|
76
|
+
assert_nothing_raised do
|
77
|
+
@command.search("word")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_destroy
|
82
|
+
assert_true(File.exist?(@tmpdir))
|
83
|
+
@command.destroy
|
84
|
+
assert_false(File.exist?(@tmpdir))
|
85
|
+
end
|
52
86
|
end
|
53
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipcellar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gtk2
|