mireru 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -3
- data/NEWS.md +10 -0
- data/README.md +7 -1
- data/bin/mireru +2 -2
- data/lib/mireru/{command/mireru.rb → command.rb} +69 -53
- data/lib/mireru/navigator.rb +14 -1
- data/lib/mireru/version.rb +1 -1
- data/lib/mireru/window.rb +31 -33
- data/mireru.gemspec +6 -6
- data/test/{test-mireru.rb → test-command.rb} +11 -18
- data/test/test-logger.rb +3 -3
- data/test/test-widget.rb +24 -7
- metadata +42 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c15bcd415d1a41b3c251afb76654223b50a5874
|
4
|
+
data.tar.gz: eeb5d54078f6bbe1cd12b6fa4cc0fcac6d18cbdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b39993b1e4524e098ad9f7afe5bd5448f54740193092d804022f951e3d8f2c9f0f16b0c84773aebd02f0a9f445afeeac10202c5d7ffec5acd62d63614cec6b5f
|
7
|
+
data.tar.gz: c72652188dc900e843c31b9e667dfb5edea100c964a9035cf4067016bd14fce169b1b397897f1be1a7f44c0dfb7f068a4f8127f0e66319a31367a4cedf279b43
|
data/.travis.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
cache:
|
2
|
+
- bundler
|
3
|
+
- apt
|
1
4
|
env:
|
2
5
|
global:
|
3
6
|
- DISPLAY=":99.0"
|
@@ -6,12 +9,11 @@ rvm:
|
|
6
9
|
- 1.9.3
|
7
10
|
- 2.0.0
|
8
11
|
- 2.1
|
9
|
-
- rbx-2
|
12
|
+
# - rbx-2
|
10
13
|
- ruby-head
|
11
14
|
matrix:
|
12
15
|
allow_failures:
|
13
|
-
- rvm: rbx-2
|
14
|
-
- rvm: ruby-head
|
16
|
+
# - rvm: rbx-2
|
15
17
|
fast_finish: true
|
16
18
|
before_install:
|
17
19
|
- ./travis-before-script.sh
|
data/NEWS.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.9.2: 2014-10-19
|
4
|
+
|
5
|
+
### Changes
|
6
|
+
|
7
|
+
* Improvements
|
8
|
+
* Use Ruby-GNOME2 2.2.2.
|
9
|
+
* Added --regexp option for selecting for file name by
|
10
|
+
regular expression.
|
11
|
+
* Added --compact option for hiding for empty directory.
|
12
|
+
|
3
13
|
## 0.9.1: 2014-07-29
|
4
14
|
|
5
15
|
Introduce ChupaText!
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Mireru [![Build Status](https://secure.travis-ci.org/myokoym/mireru.png?branch=master)](http://travis-ci.org/myokoym/mireru)
|
1
|
+
# Mireru [![Gem Version](https://badge.fury.io/rb/mireru.svg)](http://badge.fury.io/rb/mireru) [![Build Status](https://secure.travis-ci.org/myokoym/mireru.png?branch=master)](http://travis-ci.org/myokoym/mireru)
|
2
2
|
|
3
3
|
Mireru is a keyboard friendly file viewer by Ruby/GTK3.
|
4
4
|
|
@@ -36,6 +36,12 @@ If no argument, then open the current directory.
|
|
36
36
|
* `-f`, `--font NAME`
|
37
37
|
* set a font such as "Monospace 16"
|
38
38
|
|
39
|
+
* `--regexp "PATTERN"`
|
40
|
+
* select file name by regular expression
|
41
|
+
|
42
|
+
* `--compact`
|
43
|
+
* hide empty directory
|
44
|
+
|
39
45
|
### Key bindings
|
40
46
|
|
41
47
|
#### Common
|
data/bin/mireru
CHANGED
@@ -16,6 +16,6 @@
|
|
16
16
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
17
17
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
18
18
|
|
19
|
-
require "mireru/command
|
19
|
+
require "mireru/command"
|
20
20
|
|
21
|
-
Mireru::Command
|
21
|
+
Mireru::Command.run(*ARGV)
|
@@ -14,67 +14,78 @@
|
|
14
14
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
15
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
16
|
|
17
|
+
require "optparse"
|
17
18
|
require "mireru/logger"
|
18
19
|
require "mireru/window"
|
19
20
|
require "mireru/version"
|
20
21
|
|
21
22
|
module Mireru
|
22
|
-
|
23
|
-
|
24
|
-
USAGE = "Usage: mireru [OPTION]... [FILE_OR_DIRECTORY]..."
|
25
|
-
|
26
|
-
class << self
|
27
|
-
def run(*arguments)
|
28
|
-
new.run(arguments)
|
29
|
-
end
|
30
|
-
end
|
23
|
+
class Command
|
24
|
+
USAGE = "Usage: mireru [OPTION]... [FILE_OR_DIRECTORY]..."
|
31
25
|
|
32
|
-
|
33
|
-
|
26
|
+
class << self
|
27
|
+
def run(*arguments)
|
28
|
+
new.run(arguments)
|
34
29
|
end
|
30
|
+
end
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
exit(true)
|
40
|
-
elsif /\A(-v|--version)\z/ =~ arguments[0]
|
41
|
-
write_version_message
|
42
|
-
exit(true)
|
43
|
-
end
|
32
|
+
def initialize
|
33
|
+
@logger = Logger.new
|
34
|
+
end
|
44
35
|
|
45
|
-
|
36
|
+
def run(arguments)
|
37
|
+
options = parse_options(arguments)
|
46
38
|
|
47
|
-
|
39
|
+
files = files_from_arguments(arguments)
|
48
40
|
|
49
|
-
|
50
|
-
window.font = font if font
|
41
|
+
window = Window.new(files, options)
|
51
42
|
|
52
|
-
|
53
|
-
|
43
|
+
window.run
|
44
|
+
end
|
54
45
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
46
|
+
private
|
47
|
+
def parse_options(arguments)
|
48
|
+
options = {}
|
49
|
+
|
50
|
+
parser = OptionParser.new
|
51
|
+
parser.on("-h", "--help",
|
52
|
+
"Show help message") do
|
53
|
+
write_help_message
|
54
|
+
exit(true)
|
55
|
+
end
|
56
|
+
parser.on("-v", "--version",
|
57
|
+
"Show version number") do
|
58
|
+
write_version_message
|
59
|
+
exit(true)
|
60
|
+
end
|
61
|
+
parser.on("-f", "--font=NAME",
|
62
|
+
"Set a font such as \"Monospace 16\"") do |name|
|
63
|
+
options[:font] = name
|
64
|
+
end
|
65
|
+
parser.on("--regexp=PATTERN",
|
66
|
+
"Select file name by regular expression pattern") do |pattern|
|
67
|
+
options[:regexp] = pattern
|
63
68
|
end
|
69
|
+
parser.on("--compact",
|
70
|
+
"Hide empty directory") do |boolean|
|
71
|
+
options[:compact] = boolean
|
72
|
+
end
|
73
|
+
parser.parse!(arguments)
|
74
|
+
|
75
|
+
options
|
76
|
+
end
|
64
77
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
arguments.delete_at(index) # value
|
71
|
-
else
|
72
|
-
arguments.delete_at(index)
|
73
|
-
end
|
78
|
+
def files_from_arguments(arguments)
|
79
|
+
if arguments.empty?
|
80
|
+
files = [Dir.pwd]
|
81
|
+
else
|
82
|
+
files = arguments
|
74
83
|
end
|
84
|
+
files
|
85
|
+
end
|
75
86
|
|
76
|
-
|
77
|
-
|
87
|
+
def write_help_message
|
88
|
+
message = <<-EOM
|
78
89
|
#{USAGE}
|
79
90
|
If no argument, then open the current directory.
|
80
91
|
|
@@ -85,6 +96,12 @@ Options:
|
|
85
96
|
-f, --font NAME
|
86
97
|
set a font such as "Monospace 16"
|
87
98
|
|
99
|
+
--regexp "PATTERN"
|
100
|
+
select file name by regular expression
|
101
|
+
|
102
|
+
--compact
|
103
|
+
hide empty directory
|
104
|
+
|
88
105
|
Key bindings:
|
89
106
|
n: next
|
90
107
|
p: prev
|
@@ -132,16 +149,15 @@ Key bindings:
|
|
132
149
|
PDF:
|
133
150
|
j: next page
|
134
151
|
k: prev page
|
135
|
-
|
136
|
-
|
137
|
-
|
152
|
+
EOM
|
153
|
+
@logger.info(message)
|
154
|
+
end
|
138
155
|
|
139
|
-
|
140
|
-
|
141
|
-
#{
|
142
|
-
|
143
|
-
|
144
|
-
end
|
156
|
+
def write_version_message
|
157
|
+
message = <<-EOM
|
158
|
+
#{VERSION}
|
159
|
+
EOM
|
160
|
+
@logger.info(message)
|
145
161
|
end
|
146
162
|
end
|
147
163
|
end
|
data/lib/mireru/navigator.rb
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
15
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
16
|
|
17
|
+
require "find"
|
17
18
|
require "gtk3"
|
18
19
|
require "gio2"
|
19
20
|
|
@@ -21,10 +22,12 @@ module Mireru
|
|
21
22
|
class Navigator < Gtk::ScrolledWindow
|
22
23
|
PATH_COLUMN, FILENAME_COLUMN, ICON_COLUMN = 0, 1, 2
|
23
24
|
|
24
|
-
def initialize(window, files)
|
25
|
+
def initialize(window, files, options={})
|
25
26
|
super()
|
26
27
|
@window = window
|
27
28
|
@files = files
|
29
|
+
@regexp = options[:regexp]
|
30
|
+
@compact = options[:compact]
|
28
31
|
@dir_iters = {}
|
29
32
|
@icons = {}
|
30
33
|
set_policy(:automatic, :automatic)
|
@@ -151,6 +154,8 @@ module Mireru
|
|
151
154
|
end
|
152
155
|
|
153
156
|
def load_file(model, file, parent=nil, recursive=false)
|
157
|
+
return if File.file?(file) and @regexp and /#{@regexp}/ !~ file
|
158
|
+
return if @compact and empty_dir?(file)
|
154
159
|
iter = model.append(parent)
|
155
160
|
iter.set_value(PATH_COLUMN, file)
|
156
161
|
iter.set_value(FILENAME_COLUMN, File.basename(file))
|
@@ -202,5 +207,13 @@ module Mireru
|
|
202
207
|
content_type, _uncertain = Gio::ContentType.guess(file)
|
203
208
|
content_type
|
204
209
|
end
|
210
|
+
|
211
|
+
def empty_dir?(dir)
|
212
|
+
return false unless File.directory?(dir)
|
213
|
+
Find.find(*Dir.glob("#{dir}/*")) do |path|
|
214
|
+
return false if /#{@regexp}/ =~ File.basename(path)
|
215
|
+
end
|
216
|
+
true
|
217
|
+
end
|
205
218
|
end
|
206
219
|
end
|
data/lib/mireru/version.rb
CHANGED
data/lib/mireru/window.rb
CHANGED
@@ -20,16 +20,16 @@ require "mireru/navigator"
|
|
20
20
|
|
21
21
|
module Mireru
|
22
22
|
class Window < Gtk::Window
|
23
|
-
attr_accessor :font
|
24
23
|
attr_accessor :file
|
25
|
-
def initialize(files)
|
24
|
+
def initialize(files, options={})
|
26
25
|
super()
|
27
26
|
@files = files
|
27
|
+
@font = options[:font]
|
28
28
|
|
29
29
|
@paned = Gtk::Paned.new(:horizontal)
|
30
30
|
add(@paned)
|
31
31
|
|
32
|
-
@navigator = Navigator.new(self, files)
|
32
|
+
@navigator = Navigator.new(self, files, options)
|
33
33
|
@paned.add(@navigator)
|
34
34
|
|
35
35
|
@scroll = Gtk::ScrolledWindow.new
|
@@ -85,21 +85,21 @@ module Mireru
|
|
85
85
|
|
86
86
|
def action_from_keyval(keyval)
|
87
87
|
case keyval
|
88
|
-
when Gdk::Keyval::
|
88
|
+
when Gdk::Keyval::KEY_n
|
89
89
|
@navigator.next
|
90
|
-
when Gdk::Keyval::
|
90
|
+
when Gdk::Keyval::KEY_p
|
91
91
|
@navigator.prev
|
92
|
-
when Gdk::Keyval::
|
92
|
+
when Gdk::Keyval::KEY_r
|
93
93
|
add_from_file(@file) # reload
|
94
|
-
when Gdk::Keyval::
|
94
|
+
when Gdk::Keyval::KEY_e
|
95
95
|
@navigator.expand_toggle
|
96
|
-
when Gdk::Keyval::
|
96
|
+
when Gdk::Keyval::KEY_Return
|
97
97
|
@navigator.expand_toggle
|
98
|
-
when Gdk::Keyval::
|
98
|
+
when Gdk::Keyval::KEY_space
|
99
99
|
if @widget.is_a?(Widget::Video)
|
100
100
|
@widget.pause_or_play
|
101
101
|
end
|
102
|
-
when Gdk::Keyval::
|
102
|
+
when Gdk::Keyval::KEY_f
|
103
103
|
if Mireru::Widget.image?(@file)
|
104
104
|
width = @scroll.allocated_width - 10
|
105
105
|
height = @scroll.allocated_height - 10
|
@@ -108,12 +108,12 @@ module Mireru
|
|
108
108
|
font = @widget.pango_context.families.sample.name
|
109
109
|
@widget.override_font(Pango::FontDescription.new(font))
|
110
110
|
end
|
111
|
-
when Gdk::Keyval::
|
111
|
+
when Gdk::Keyval::KEY_o
|
112
112
|
if Mireru::Widget.image?(@file)
|
113
113
|
pixbuf = Gdk::Pixbuf.new(@file)
|
114
114
|
@widget.pixbuf = pixbuf
|
115
115
|
end
|
116
|
-
when Gdk::Keyval::
|
116
|
+
when Gdk::Keyval::KEY_plus
|
117
117
|
if Mireru::Widget.image?(@file)
|
118
118
|
pixbuf = @widget.pixbuf
|
119
119
|
scale = 1.1
|
@@ -125,7 +125,7 @@ module Mireru
|
|
125
125
|
font = font.sub(/\d+\z/, (font_size + 1).to_s)
|
126
126
|
@widget.override_font(Pango::FontDescription.new(font))
|
127
127
|
end
|
128
|
-
when Gdk::Keyval::
|
128
|
+
when Gdk::Keyval::KEY_minus
|
129
129
|
if Mireru::Widget.image?(@file)
|
130
130
|
pixbuf = @widget.pixbuf
|
131
131
|
scale = 0.9
|
@@ -137,35 +137,35 @@ module Mireru
|
|
137
137
|
font = font.sub(/\d+\z/, (font_size - 1).to_s)
|
138
138
|
@widget.override_font(Pango::FontDescription.new(font))
|
139
139
|
end
|
140
|
-
when Gdk::Keyval::
|
140
|
+
when Gdk::Keyval::KEY_E
|
141
141
|
add_from_file(@file, true)
|
142
|
-
when Gdk::Keyval::
|
142
|
+
when Gdk::Keyval::KEY_h
|
143
143
|
@scroll.hadjustment.value -= 17
|
144
|
-
when Gdk::Keyval::
|
144
|
+
when Gdk::Keyval::KEY_j
|
145
145
|
if @widget.is_a?(Widget::PDF)
|
146
146
|
@widget.next
|
147
147
|
else
|
148
148
|
@scroll.vadjustment.value += 17
|
149
149
|
end
|
150
|
-
when Gdk::Keyval::
|
150
|
+
when Gdk::Keyval::KEY_k
|
151
151
|
if @widget.is_a?(Widget::PDF)
|
152
152
|
@widget.prev
|
153
153
|
else
|
154
154
|
@scroll.vadjustment.value -= 17
|
155
155
|
end
|
156
|
-
when Gdk::Keyval::
|
156
|
+
when Gdk::Keyval::KEY_l
|
157
157
|
@scroll.hadjustment.value += 17
|
158
|
-
when Gdk::Keyval::
|
158
|
+
when Gdk::Keyval::KEY_H
|
159
159
|
@scroll.hadjustment.value -= 17 * 100
|
160
|
-
when Gdk::Keyval::
|
160
|
+
when Gdk::Keyval::KEY_J
|
161
161
|
@scroll.vadjustment.value += 17 * 100
|
162
|
-
when Gdk::Keyval::
|
162
|
+
when Gdk::Keyval::KEY_G
|
163
163
|
@scroll.vadjustment.value = @scroll.vadjustment.upper
|
164
|
-
when Gdk::Keyval::
|
164
|
+
when Gdk::Keyval::KEY_K
|
165
165
|
@scroll.vadjustment.value -= 17 * 100
|
166
|
-
when Gdk::Keyval::
|
166
|
+
when Gdk::Keyval::KEY_L
|
167
167
|
@scroll.hadjustment.value += 17 * 100
|
168
|
-
when Gdk::Keyval::
|
168
|
+
when Gdk::Keyval::KEY_q
|
169
169
|
destroy
|
170
170
|
else
|
171
171
|
return false
|
@@ -175,17 +175,17 @@ module Mireru
|
|
175
175
|
|
176
176
|
def action_from_keyval_with_control_mask(keyval)
|
177
177
|
case keyval
|
178
|
-
when Gdk::Keyval::
|
178
|
+
when Gdk::Keyval::KEY_n
|
179
179
|
10.times { @navigator.next }
|
180
|
-
when Gdk::Keyval::
|
180
|
+
when Gdk::Keyval::KEY_p
|
181
181
|
10.times { @navigator.prev }
|
182
|
-
when Gdk::Keyval::
|
182
|
+
when Gdk::Keyval::KEY_e
|
183
183
|
@navigator.expand_toggle(true)
|
184
|
-
when Gdk::Keyval::
|
184
|
+
when Gdk::Keyval::KEY_h
|
185
185
|
@paned.position -= 2
|
186
|
-
when Gdk::Keyval::
|
186
|
+
when Gdk::Keyval::KEY_l
|
187
187
|
@paned.position += 2
|
188
|
-
when Gdk::Keyval::
|
188
|
+
when Gdk::Keyval::KEY_Return
|
189
189
|
execute_selected_file
|
190
190
|
else
|
191
191
|
return false
|
@@ -209,9 +209,7 @@ Only supports Windows (use `start` command) and OS X (use `open` command).
|
|
209
209
|
return
|
210
210
|
end
|
211
211
|
|
212
|
-
|
213
|
-
system(command, @file.encode("locale"))
|
214
|
-
end
|
212
|
+
spawn(command, @file.encode("locale"))
|
215
213
|
end
|
216
214
|
end
|
217
215
|
end
|
data/mireru.gemspec
CHANGED
@@ -19,12 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_runtime_dependency("gtk3", "
|
23
|
-
spec.add_runtime_dependency("gtksourceview3", "
|
24
|
-
spec.add_runtime_dependency("clutter-gtk", "
|
25
|
-
spec.add_runtime_dependency("clutter-gstreamer", "
|
26
|
-
spec.add_runtime_dependency("poppler", "
|
27
|
-
spec.add_runtime_dependency("rsvg2", "
|
22
|
+
spec.add_runtime_dependency("gtk3", "2.2.2")
|
23
|
+
spec.add_runtime_dependency("gtksourceview3", "2.2.2")
|
24
|
+
spec.add_runtime_dependency("clutter-gtk", "2.2.2")
|
25
|
+
spec.add_runtime_dependency("clutter-gstreamer", "2.2.2")
|
26
|
+
spec.add_runtime_dependency("poppler", "2.2.2")
|
27
|
+
spec.add_runtime_dependency("rsvg2", "2.2.2")
|
28
28
|
spec.add_runtime_dependency("hexdump")
|
29
29
|
spec.add_runtime_dependency("chupa-text")
|
30
30
|
spec.add_runtime_dependency("chupa-text-decomposer-html")
|
@@ -14,57 +14,50 @@
|
|
14
14
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
15
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
16
|
|
17
|
-
require "mireru/command
|
17
|
+
require "mireru/command"
|
18
18
|
|
19
|
-
class
|
19
|
+
class CommandTest < Test::Unit::TestCase
|
20
20
|
include MireruTestUtils
|
21
21
|
|
22
22
|
def setup
|
23
|
-
@
|
23
|
+
@command = Mireru::Command.new
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_run_help_option
|
27
27
|
arguments = %w(--help)
|
28
|
-
mock(@
|
28
|
+
mock(@command).write_help_message
|
29
29
|
assert_raise SystemExit do
|
30
|
-
@
|
30
|
+
@command.run(arguments)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_run_help_option_sugar
|
35
35
|
arguments = %w(-h)
|
36
|
-
mock(@
|
36
|
+
mock(@command).write_help_message
|
37
37
|
assert_raise SystemExit do
|
38
|
-
@
|
38
|
+
@command.run(arguments)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_run_version_option
|
43
43
|
arguments = %w(--version)
|
44
|
-
mock(@
|
44
|
+
mock(@command).write_version_message
|
45
45
|
assert_raise SystemExit do
|
46
|
-
@
|
46
|
+
@command.run(arguments)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_files_from_arguments_no_argument
|
51
51
|
arguments = %w()
|
52
52
|
expected = [Dir.pwd]
|
53
|
-
files = @
|
53
|
+
files = @command.__send__(:files_from_arguments, arguments)
|
54
54
|
assert_equal(files, expected)
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_files_from_arguments
|
58
58
|
arguments = %w(dir1 dir2)
|
59
59
|
expected = %w(dir1 dir2)
|
60
|
-
files = @
|
60
|
+
files = @command.__send__(:files_from_arguments, arguments)
|
61
61
|
assert_equal(files, expected)
|
62
62
|
end
|
63
|
-
|
64
|
-
def test_purge_option
|
65
|
-
arguments = %w(-f ubuntu dir1 file1 dir2)
|
66
|
-
value = @mireru.__send__(:purge_option, arguments, /\A-f\z/, true)
|
67
|
-
assert_equal("ubuntu", value)
|
68
|
-
assert_equal(%w(dir1 file1 dir2), arguments)
|
69
|
-
end
|
70
63
|
end
|
data/test/test-logger.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
16
|
|
17
17
|
require "mireru/logger"
|
18
|
-
require "mireru/command
|
18
|
+
require "mireru/command"
|
19
19
|
require "stringio"
|
20
20
|
|
21
21
|
class LoggerTest < Test::Unit::TestCase
|
@@ -30,7 +30,7 @@ class LoggerTest < Test::Unit::TestCase
|
|
30
30
|
io = StringIO.new(s)
|
31
31
|
$stdout = io
|
32
32
|
message = <<-EOM
|
33
|
-
#{Mireru::Command::
|
33
|
+
#{Mireru::Command::USAGE}
|
34
34
|
If no argument, then open the current directory.
|
35
35
|
Keybind:
|
36
36
|
n: next
|
@@ -48,7 +48,7 @@ Keybind:
|
|
48
48
|
$stderr = io
|
49
49
|
message = <<-EOM
|
50
50
|
Warning: valid file not found.
|
51
|
-
#{Mireru::Command::
|
51
|
+
#{Mireru::Command::USAGE}
|
52
52
|
Support file types: png, gif, jpeg(jpg). The others are...yet.
|
53
53
|
EOM
|
54
54
|
@logger.error(message)
|
data/test/test-widget.rb
CHANGED
@@ -19,12 +19,29 @@ require "mireru/widget"
|
|
19
19
|
class WidgetTest < Test::Unit::TestCase
|
20
20
|
include MireruTestUtils
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
class ImageTest < self
|
23
|
+
def test_not_image
|
24
|
+
assert_nil(Mireru::Widget.image?(__FILE__))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_png
|
28
|
+
assert_not_nil(Mireru::Widget.image?("test/fixtures/nijip.png"))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_uppercase
|
32
|
+
assert_not_nil(Mireru::Widget.image?("hoge.PNG"))
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_jpg
|
36
|
+
assert_not_nil(Mireru::Widget.image?("hoge.jpg"))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_jpeg
|
40
|
+
assert_not_nil(Mireru::Widget.image?("hoge.jpeg"))
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_gif
|
44
|
+
assert_not_nil(Mireru::Widget.image?("hoge.gif"))
|
45
|
+
end
|
29
46
|
end
|
30
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mireru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.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-
|
11
|
+
date: 2014-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gtk3
|
@@ -16,222 +16,222 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.2.
|
19
|
+
version: 2.2.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.2.
|
26
|
+
version: 2.2.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gtksourceview3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.2.
|
33
|
+
version: 2.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.2.
|
40
|
+
version: 2.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: clutter-gtk
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.2.
|
47
|
+
version: 2.2.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.2.
|
54
|
+
version: 2.2.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: clutter-gstreamer
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.2.
|
61
|
+
version: 2.2.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.2.
|
68
|
+
version: 2.2.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: poppler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.2.
|
75
|
+
version: 2.2.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.2.
|
82
|
+
version: 2.2.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rsvg2
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.2.
|
89
|
+
version: 2.2.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.2.
|
96
|
+
version: 2.2.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: hexdump
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: chupa-text
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: chupa-text-decomposer-html
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: chupa-text-decomposer-pdf
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: chupa-text-decomposer-libreoffice
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: test-unit
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: test-unit-notify
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: test-unit-rr
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: bundler
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - ~>
|
213
|
+
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '1.6'
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - ~>
|
220
|
+
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.6'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: rake
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
description: Mireru is a keyboard friendly file viewer by Ruby/GTK3. It can handle
|
@@ -243,15 +243,15 @@ executables:
|
|
243
243
|
extensions: []
|
244
244
|
extra_rdoc_files: []
|
245
245
|
files:
|
246
|
-
- .gitignore
|
247
|
-
- .travis.yml
|
246
|
+
- ".gitignore"
|
247
|
+
- ".travis.yml"
|
248
248
|
- Gemfile
|
249
249
|
- NEWS.md
|
250
250
|
- README.md
|
251
251
|
- Rakefile
|
252
252
|
- bin/mireru
|
253
253
|
- lib/mireru.rb
|
254
|
-
- lib/mireru/command
|
254
|
+
- lib/mireru/command.rb
|
255
255
|
- lib/mireru/logger.rb
|
256
256
|
- lib/mireru/navigator.rb
|
257
257
|
- lib/mireru/version.rb
|
@@ -276,8 +276,8 @@ files:
|
|
276
276
|
- test/fixtures/sample.svg
|
277
277
|
- test/mireru-test-utils.rb
|
278
278
|
- test/run-test.rb
|
279
|
+
- test/test-command.rb
|
279
280
|
- test/test-logger.rb
|
280
|
-
- test/test-mireru.rb
|
281
281
|
- test/test-widget.rb
|
282
282
|
- test/test-window.rb
|
283
283
|
- test/widget/test-binary.rb
|
@@ -308,17 +308,17 @@ require_paths:
|
|
308
308
|
- lib
|
309
309
|
required_ruby_version: !ruby/object:Gem::Requirement
|
310
310
|
requirements:
|
311
|
-
- -
|
311
|
+
- - ">="
|
312
312
|
- !ruby/object:Gem::Version
|
313
313
|
version: '0'
|
314
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
315
315
|
requirements:
|
316
|
-
- -
|
316
|
+
- - ">="
|
317
317
|
- !ruby/object:Gem::Version
|
318
318
|
version: '0'
|
319
319
|
requirements: []
|
320
320
|
rubyforge_project:
|
321
|
-
rubygems_version: 2.
|
321
|
+
rubygems_version: 2.4.1
|
322
322
|
signing_key:
|
323
323
|
specification_version: 4
|
324
324
|
summary: Keyboard friendly multitype file viewer by Ruby/GTK3.
|
@@ -333,8 +333,8 @@ test_files:
|
|
333
333
|
- test/fixtures/sample.svg
|
334
334
|
- test/mireru-test-utils.rb
|
335
335
|
- test/run-test.rb
|
336
|
+
- test/test-command.rb
|
336
337
|
- test/test-logger.rb
|
337
|
-
- test/test-mireru.rb
|
338
338
|
- test/test-widget.rb
|
339
339
|
- test/test-window.rb
|
340
340
|
- test/widget/test-binary.rb
|