clipcellar 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 803db9c5bcf45ecf932632fab71ed464df055009
4
- data.tar.gz: acfa00b12c77e33fc8bf12b8e6947e4fd73836ba
3
+ metadata.gz: 3334556a4ade285c592621dbfabda41354f6e4af
4
+ data.tar.gz: 4fb743564c2d596b3fd0f37db0cbb060584a0c44
5
5
  SHA512:
6
- metadata.gz: aa2653faa857c7ab99ef2121553a1d3ad43c7678b1e38311f71d9d812f38d1fd3f2105dd63616f97c4444ddf1f208e2c17b722c7656d713f7a2bb3a91c4f8370
7
- data.tar.gz: cf639f117ef1d91e8bccb16a961e0604504358fc4d4fa6707a2d2afd3712014237ba47fa351a43d16e75525cde0650bc5d7e0a45ecde75c33f1ad49adcec4f5f
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
@@ -39,7 +39,7 @@ Or install it yourself as:
39
39
 
40
40
  ### Show added texts in data store
41
41
 
42
- $ clipcellar show [--gui]
42
+ $ clipcellar show [--lines=N] [--gui]
43
43
 
44
44
  ### Full-text search (and set a text to clipboard)
45
45
 
@@ -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
@@ -43,7 +43,7 @@ module Clipcellar
43
43
  expression
44
44
  end
45
45
 
46
- order = options[:reverse] ? "ascending" : "descending"
46
+ order = options[:reverse] ? "descending" : "ascending"
47
47
  sorted_clipboards = selected_clipboards.sort([{
48
48
  :key => "created_at",
49
49
  :order => order,
@@ -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
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module Clipcellar
18
- VERSION = "0.0.1"
18
+ VERSION = "0.0.2"
19
19
  end
@@ -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
- # TODO: don't want to use Command class.
107
- GroongaDatabase.new.open(Command.new.database_dir) do |database|
108
- database.delete(@tree_view.selected_key)
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
@@ -20,34 +20,68 @@ require "clipcellar/version"
20
20
  require "clipcellar/command"
21
21
 
22
22
  class CommandTest < Test::Unit::TestCase
23
- class << self
24
- def startup
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
- @@command.version
31
+ @command.version
44
32
  assert_equal("#{Clipcellar::VERSION}\n", s)
45
33
  $stdout = STDOUT
46
34
  end
47
35
 
48
- def test_destroy
49
- assert_true(File.exist?(@@tmpdir))
50
- @@command.destroy
51
- assert_false(File.exist?(@@tmpdir))
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.1
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-29 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk2