mireru 0.2.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,8 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Mireru::VERSION
9
9
  spec.authors = ["Masafumi Yokoyama"]
10
10
  spec.email = ["myokoym@gmail.com"]
11
- spec.summary = %q{Flexible File Viewer Keyboard Friend}
12
- spec.description = %q{A file viewer with a focus on flexibility by Ruby/GTK3. A friend of a keyboard.}
11
+ spec.summary = %q{Keyboard friendly multitype file viewer by Ruby/GTK3.}
12
+ spec.description = %q{Mireru is a keyboard friendly file viewer by Ruby/GTK3. It can handle a variety of file types (Picture, Text, PDF, Video and etc.).}
13
+
13
14
  spec.homepage = "https://github.com/myokoym/mireru"
14
15
  spec.license = "GPLv2 or later"
15
16
 
@@ -1,4 +1,5 @@
1
1
  require "mireru/logger"
2
+ require "mireru/command/mireru"
2
3
  require "stringio"
3
4
 
4
5
  class LoggerTest < Test::Unit::TestCase
@@ -14,7 +15,7 @@ class LoggerTest < Test::Unit::TestCase
14
15
  $stdout = io
15
16
  message = <<-EOM
16
17
  #{Mireru::Command::Mireru::USAGE}
17
- If no argument, then search current directory.
18
+ If no argument, then open the current directory.
18
19
  Keybind:
19
20
  n: next
20
21
  p: prev
@@ -1,5 +1,4 @@
1
1
  require "mireru/command/mireru"
2
- require "mireru/container"
3
2
 
4
3
  class MireruTest < Test::Unit::TestCase
5
4
  include MireruTestUtils
@@ -32,70 +31,22 @@ class MireruTest < Test::Unit::TestCase
32
31
  end
33
32
  end
34
33
 
35
- def test_run_empty
36
- arguments = %w(hoge)
37
- stub(@mireru).files_from_arguments { arguments }
38
- mock.instance_of(Mireru::Container).empty? { true }
39
- mock(@mireru).write_empty_message
40
- assert_raise SystemExit do
41
- @mireru.run(arguments)
42
- end
43
- end
44
-
45
34
  def test_files_from_arguments_no_argument
46
35
  arguments = %w()
47
- expected = %w(dir1 file1 dir2)
48
- mock(Dir).glob("*") { expected }
49
- files = @mireru.__send__(:files_from_arguments, arguments)
50
- assert_equal(files, expected)
51
- end
52
-
53
- def test_files_from_arguments_recursive_option_only
54
- arguments = %w(-R)
55
- expected = %w(dir1 file1 dir2 dir1/file1 dir1/file2 dir2/file1)
56
- mock(Dir).glob("**/*") { expected }
57
- files = @mireru.__send__(:files_from_arguments, arguments)
58
- assert_equal(files, expected)
59
- end
60
-
61
- def test_files_from_arguments_recursive_option_and_dir
62
- arguments = %w(-R dir1 file1 dir2)
63
- expected_dir1 = %w(dir1/file1 dir1/file2)
64
- expected_dir2 = %w(dir2/file1)
65
- expected = [expected_dir1, "file1", expected_dir2].flatten
66
- mock(File).directory?("dir1") { true }
67
- mock(File).directory?("file1") { false }
68
- mock(File).directory?("dir2") { true }
69
- mock(Dir).glob("dir1/**/*") { expected_dir1 }
70
- mock(Dir).glob("dir2/**/*") { expected_dir2 }
36
+ expected = [Dir.pwd]
71
37
  files = @mireru.__send__(:files_from_arguments, arguments)
72
38
  assert_equal(files, expected)
73
39
  end
74
40
 
75
- def test_files_from_arguments_all_dir
41
+ def test_files_from_arguments
76
42
  arguments = %w(dir1 dir2)
77
- expected_dir1 = %w(dir1/file1 dir1/file2)
78
- expected_dir2 = %w(dir2/file1)
79
- expected = [expected_dir1, expected_dir2].flatten
80
- mock(File).directory?("dir1") { true }
81
- mock(File).directory?("dir2") { true }
82
- mock(Dir).glob("dir1/*") { expected_dir1 }
83
- mock(Dir).glob("dir2/*") { expected_dir2 }
43
+ expected = %w(dir1 dir2)
84
44
  files = @mireru.__send__(:files_from_arguments, arguments)
85
45
  assert_equal(files, expected)
86
46
  end
87
47
 
88
- def test_files_from_arguments_else
89
- arguments = %w(dir1 file1 dir2)
90
- files = @mireru.__send__(:files_from_arguments, arguments)
91
- assert_equal(files, arguments)
92
- end
93
-
94
48
  def test_purge_option
95
- arguments = %w(-R -f ubuntu dir1 file1 dir2)
96
- flag = @mireru.__send__(:purge_option, arguments, /\A(-R|--recursive)\z/)
97
- assert_not_nil(flag)
98
- assert_equal(%w(-f ubuntu dir1 file1 dir2), arguments)
49
+ arguments = %w(-f ubuntu dir1 file1 dir2)
99
50
  value = @mireru.__send__(:purge_option, arguments, /\A-f\z/, true)
100
51
  assert_equal("ubuntu", value)
101
52
  assert_equal(%w(dir1 file1 dir2), arguments)
@@ -4,20 +4,13 @@ class WindowTest < Test::Unit::TestCase
4
4
  include MireruTestUtils
5
5
 
6
6
  def setup
7
- @window = Mireru::Window.new
8
- end
9
-
10
- def test_add_container
11
- container = %w(a, b, c)
12
- mock(container).shift { "a" }
13
- mock(@window).add_from_file("a")
14
- @window.add_container(container)
7
+ @window = Mireru::Window.new([])
15
8
  end
16
9
 
17
10
  class AddFromFileTest
18
11
  def test_scrollable
19
12
  file = __FILE__
20
- mock(Mireru::Widget).create(file, *@window.size) do
13
+ mock(Mireru::Widget).new(file, *@window.size) do
21
14
  Gtk::TextView.new
22
15
  end
23
16
  mock(@window).show_all
@@ -28,7 +21,7 @@ class WindowTest < Test::Unit::TestCase
28
21
 
29
22
  def test_no_scrollable
30
23
  file = File.join(fixtures_dir, "nijip.png")
31
- mock(Mireru::Widget).create(file, *@window.size) do
24
+ mock(Mireru::Widget).new(file, *@window.size) do
32
25
  Gtk::Image.new
33
26
  end
34
27
  mock(@window).show_all
@@ -37,11 +30,5 @@ class WindowTest < Test::Unit::TestCase
37
30
  assert_equal(Gtk::Viewport, @window.child.child.class)
38
31
  assert_equal(Gtk::Image, @window.child.child.child.class)
39
32
  end
40
-
41
- def test_enumable
42
- file = [__FILE__]
43
- @window.add_from_file(file)
44
- assert_equal(Mireru::Widget::Thumbnail, @window.child.child.class)
45
- end
46
33
  end
47
34
  end
@@ -3,11 +3,11 @@ require "mireru/widget/binary"
3
3
  class BinaryTest < Test::Unit::TestCase
4
4
  include MireruTestUtils
5
5
 
6
- def test_create
6
+ def test_new
7
7
  file = File.join(fixtures_dir, "Gemfile.gz")
8
- widget = Mireru::Widget::Binary.create(file)
8
+ widget = Mireru::Widget::Binary.new(file)
9
9
  assert_not_nil(widget)
10
- assert_equal(Gtk::TextView, widget.class)
10
+ assert_kind_of(Gtk::TextView, widget)
11
11
  widget.destroy
12
12
  end
13
13
  end
@@ -3,11 +3,11 @@ require "mireru/widget/pdf"
3
3
  class PDFTest < Test::Unit::TestCase
4
4
  include MireruTestUtils
5
5
 
6
- def test_create
6
+ def test_new
7
7
  file = File.join(fixtures_dir, "sample.pdf")
8
- widget = Mireru::Widget::PDF.create(file)
8
+ widget = Mireru::Widget::PDF.new(file)
9
9
  assert_not_nil(widget)
10
- assert_equal(Gtk::DrawingArea, widget.class)
10
+ assert_kind_of(Gtk::DrawingArea, widget)
11
11
  widget.destroy
12
12
  end
13
13
  end
@@ -3,11 +3,11 @@ require "mireru/widget/svg"
3
3
  class SVGTest < Test::Unit::TestCase
4
4
  include MireruTestUtils
5
5
 
6
- def test_create
6
+ def test_new
7
7
  file = File.join(File.dirname(__FILE__), "..", "fixtures", "sample.svg")
8
- widget = Mireru::Widget::SVG.create(file)
8
+ widget = Mireru::Widget::SVG.new(file)
9
9
  assert_not_nil(widget)
10
- assert_equal(Gtk::DrawingArea, widget.class)
10
+ assert_kind_of(Gtk::DrawingArea, widget)
11
11
  widget.destroy
12
12
  end
13
13
  end
@@ -4,18 +4,22 @@ require "mireru/widget/text"
4
4
  class TextTest < Test::Unit::TestCase
5
5
  include MireruTestUtils
6
6
 
7
+ def setup
8
+ @view = Mireru::Widget::Text.new(__FILE__)
9
+ end
10
+
7
11
  def test_buffer_from_file_of_text
8
- widget = Mireru::Widget::Text.__send__(:buffer_from_file, __FILE__)
9
- assert_equal(GtkSource::Buffer, widget.class)
12
+ buffer = @view.__send__(:buffer_from_file, __FILE__)
13
+ assert_kind_of(GtkSource::Buffer, buffer)
10
14
  end
11
15
 
12
16
  def test_buffer_from_text_of_utf8
13
- widget = Mireru::Widget::Text.__send__(:buffer_from_text, "御庭番")
14
- assert_equal(GtkSource::Buffer, widget.class)
17
+ buffer = @view.__send__(:buffer_from_text, "御庭番")
18
+ assert_kind_of(GtkSource::Buffer, buffer)
15
19
  end
16
20
 
17
21
  def test_buffer_from_text_of_sjis
18
- widget = Mireru::Widget::Text.__send__(:buffer_from_text, "御庭番".encode("SJIS"))
19
- assert_equal(GtkSource::Buffer, widget.class)
22
+ buffer = @view.__send__(:buffer_from_text, "御庭番".encode("SJIS"))
23
+ assert_kind_of(GtkSource::Buffer, buffer)
20
24
  end
21
25
  end
@@ -5,13 +5,13 @@ class VideoTest < Test::Unit::TestCase
5
5
  include MireruTestUtils
6
6
  include ClutterTestUtils
7
7
 
8
- def test_create
8
+ def test_new
9
9
  omit_if_clutter_color_hash_expect_arguments
10
10
 
11
11
  filename = "XXX.ogm"
12
- widget = Mireru::Widget::Video.create(filename)
12
+ widget = Mireru::Widget::Video.new(filename)
13
13
  assert_not_nil(widget)
14
- assert_equal(ClutterGtk::Embed, widget.class)
14
+ assert_kind_of(ClutterGtk::Embed, widget)
15
15
  widget.destroy
16
16
  end
17
17
  end
@@ -4,14 +4,14 @@ en:
4
4
  Launch: "Launch"
5
5
  if_no_argument: "If no argument, then search current directory."
6
6
  Options: "Options"
7
- recursive_search: "recursive search as “**/*”"
8
- set_font: "set font such as “Monospace 16”"
7
+ show_help_message: "show help message"
8
+ set_font: "set a font such as “Monospace 16”"
9
9
  Keybind: "Keybind"
10
10
  Common: "Common"
11
11
  next: "next"
12
12
  prev: "prev"
13
13
  reload: "reload"
14
- expand_path: "expand path"
14
+ expand_path: "expand/collpse"
15
15
  quit: "quit"
16
16
  Scroll: "Scroll"
17
17
  left: "left"
@@ -21,12 +21,13 @@ en:
21
21
  Scale: "Scale"
22
22
  larger: "larger"
23
23
  smaller: "smaller"
24
- Special: "Special"
25
- thumbnail: "thumbnail"
26
24
  Image: "Image"
27
- fits_window: "fits window size"
28
- original_size: "original size"
25
+ fits_window: "fit window size"
26
+ original_size: "scale to the original size"
29
27
  Text: "Text"
30
28
  change_font: "change font (at random)"
31
29
  Video: "Video"
32
30
  play_pause: "play/pause"
31
+ PDF: "PDF"
32
+ pdf_next: "next page"
33
+ pdf_prev: "prev page"
@@ -4,14 +4,14 @@ ja:
4
4
  Launch: "起動"
5
5
  if_no_argument: "引数が指定されなかった場合、カレントディレクトリを検索します。"
6
6
  Options: "オプション"
7
- recursive_search: "“**/*”のように、再帰的に検索します。"
7
+ show_help_message: "ヘルプメッセージを表示します。"
8
8
  set_font: "例えば、“Monospace 16”のように指定します。"
9
9
  Keybind: "キーバインド"
10
10
  Common: "共通"
11
11
  next: "次のファイルへ"
12
12
  prev: "前のファイルへ"
13
13
  reload: "再読み込み"
14
- expand_path: "タイトルバーに絶対パスを表示"
14
+ expand_path: "ツリービューを展開/収縮"
15
15
  quit: "終了"
16
16
  Scroll: "スクロール"
17
17
  left: "左"
@@ -21,8 +21,6 @@ ja:
21
21
  Scale: "拡大・縮小"
22
22
  larger: "拡大"
23
23
  smaller: "縮小"
24
- Special: "ファイル種類別のキーバインド"
25
- thumbnail: "サムネイルを表示"
26
24
  Image: "画像ファイル用"
27
25
  fits_window: "ウィンドウサイズ"
28
26
  original_size: "オリジナルサイズ"
@@ -30,3 +28,6 @@ ja:
30
28
  change_font: "フォントを変更(ランダム)"
31
29
  Video: "ビデオファイル用"
32
30
  play_pause: "再生/一時停止"
31
+ PDF: "PDFファイル用"
32
+ pdf_next: "次のページ"
33
+ pdf_prev: "前のページ"
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: mireru
2
+ title: Mireru
3
3
  ---
4
4
 
5
5
  %h1 mireru
@@ -12,4 +12,4 @@ title: mireru
12
12
  %label(for="#{id}")= link.name
13
13
 
14
14
  %footer
15
- %p (c) 2013 Masafumi Yokoyama
15
+ %p (c) 2013-2014 Masafumi Yokoyama <myokoym@gmail.com>
@@ -2,13 +2,13 @@
2
2
 
3
3
  <h3><%= t(:Launch) %></h3>
4
4
 
5
- <pre> $ mireru [OPTION]... [FILE]...</pre>
5
+ <pre> $ mireru [OPTION]... [FILE_OR_DIRECTORY]...</pre>
6
6
  <%= t(:if_no_argument) %>
7
7
 
8
8
  <h3><%= t(:Options) %></h3>
9
9
 
10
- <pre>-R, --recursive
11
- <%= t(:recursive_search) %></pre>
10
+ <pre>-h, --help
11
+ <%= t(:show_help_message) %></pre>
12
12
  <pre>-f, --font NAME
13
13
  <%= t(:set_font) %></pre>
14
14
 
@@ -19,8 +19,8 @@
19
19
  <ul>
20
20
  <li>n: <%= t(:next) %></li>
21
21
  <li>p: <%= t(:prev) %></li>
22
- <li>r: <%= t(:reload) %></li>
23
22
  <li>e: <%= t(:expand_path) %></li>
23
+ <li>r: <%= t(:reload) %></li>
24
24
  <li>q: <%= t(:quit) %></li>
25
25
  </ul>
26
26
  </p>
@@ -43,12 +43,6 @@
43
43
  </ul>
44
44
  </p>
45
45
 
46
- <p><%= t(:Special) %>
47
- <ul>
48
- <li>T: <%= t(:thumbnail) %></li>
49
- </ul>
50
- </p>
51
-
52
46
  <p><%= t(:Image) %>
53
47
  <ul>
54
48
  <li>f: <%= t(:fits_window) %></li>
@@ -67,3 +61,10 @@
67
61
  <li>space: <%= t(:play_pause) %></li>
68
62
  </ul>
69
63
  </p>
64
+
65
+ <p><%= t(:PDF) %>
66
+ <ul>
67
+ <li>j: <%= t(:pdf_next) %></li>
68
+ <li>k: <%= t(:pdf_prev) %></li>
69
+ </ul>
70
+ </p>
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.2.1
4
+ version: 0.9.0
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-05-29 00:00:00.000000000 Z
11
+ date: 2014-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk3
@@ -178,8 +178,8 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- description: A file viewer with a focus on flexibility by Ruby/GTK3. A friend of a
182
- keyboard.
181
+ description: Mireru is a keyboard friendly file viewer by Ruby/GTK3. It can handle
182
+ a variety of file types (Picture, Text, PDF, Video and etc.).
183
183
  email:
184
184
  - myokoym@gmail.com
185
185
  executables:
@@ -196,8 +196,8 @@ files:
196
196
  - bin/mireru
197
197
  - lib/mireru.rb
198
198
  - lib/mireru/command/mireru.rb
199
- - lib/mireru/container.rb
200
199
  - lib/mireru/logger.rb
200
+ - lib/mireru/navigator.rb
201
201
  - lib/mireru/version.rb
202
202
  - lib/mireru/widget.rb
203
203
  - lib/mireru/widget/binary.rb
@@ -205,7 +205,6 @@ files:
205
205
  - lib/mireru/widget/pdf.rb
206
206
  - lib/mireru/widget/svg.rb
207
207
  - lib/mireru/widget/text.rb
208
- - lib/mireru/widget/thumbnail.rb
209
208
  - lib/mireru/widget/video.rb
210
209
  - lib/mireru/window.rb
211
210
  - license/gpl-2.0.txt
@@ -220,7 +219,6 @@ files:
220
219
  - test/fixtures/sample.svg
221
220
  - test/mireru-test-utils.rb
222
221
  - test/run-test.rb
223
- - test/test-container.rb
224
222
  - test/test-logger.rb
225
223
  - test/test-mireru.rb
226
224
  - test/test-widget.rb
@@ -229,7 +227,6 @@ files:
229
227
  - test/widget/test-pdf.rb
230
228
  - test/widget/test-svg.rb
231
229
  - test/widget/test-text.rb
232
- - test/widget/test-thumbnail.rb
233
230
  - test/widget/test-video.rb
234
231
  - travis-before-script.sh
235
232
  - website/.gitignore
@@ -267,7 +264,7 @@ rubyforge_project:
267
264
  rubygems_version: 2.2.2
268
265
  signing_key:
269
266
  specification_version: 4
270
- summary: Flexible File Viewer Keyboard Friend
267
+ summary: Keyboard friendly multitype file viewer by Ruby/GTK3.
271
268
  test_files:
272
269
  - test/clutter-test-utils.rb
273
270
  - test/fixtures/Gemfile.gz
@@ -279,7 +276,6 @@ test_files:
279
276
  - test/fixtures/sample.svg
280
277
  - test/mireru-test-utils.rb
281
278
  - test/run-test.rb
282
- - test/test-container.rb
283
279
  - test/test-logger.rb
284
280
  - test/test-mireru.rb
285
281
  - test/test-widget.rb
@@ -288,6 +284,5 @@ test_files:
288
284
  - test/widget/test-pdf.rb
289
285
  - test/widget/test-svg.rb
290
286
  - test/widget/test-text.rb
291
- - test/widget/test-thumbnail.rb
292
287
  - test/widget/test-video.rb
293
288
  has_rdoc: