mireru 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +11 -0
  3. data/NEWS.md +12 -0
  4. data/README.md +15 -2
  5. data/lib/mireru/version.rb +1 -1
  6. data/lib/mireru/widget.rb +31 -64
  7. data/lib/mireru/widget/binary.rb +32 -0
  8. data/lib/mireru/widget/image.rb +17 -0
  9. data/lib/mireru/widget/pdf.rb +39 -0
  10. data/lib/mireru/widget/text.rb +32 -0
  11. data/lib/mireru/widget/thumbnail.rb +46 -0
  12. data/lib/mireru/widget/video.rb +49 -0
  13. data/lib/mireru/window.rb +1 -1
  14. data/license/lgpl-2.1.txt +502 -0
  15. data/mireru.gemspec +2 -1
  16. data/test/clutter-test-utils.rb +26 -0
  17. data/test/fixtures/sample.pdf +0 -0
  18. data/test/run-test.rb +2 -0
  19. data/test/test-widget.rb +0 -21
  20. data/test/{test-binary.rb → widget/test-binary.rb} +3 -3
  21. data/test/widget/test-pdf.rb +11 -0
  22. data/test/widget/test-text.rb +19 -0
  23. data/test/{test-thumbnail.rb → widget/test-thumbnail.rb} +3 -3
  24. data/test/{test-video.rb → widget/test-video.rb} +6 -2
  25. data/travis-before-script.sh +32 -0
  26. data/{middleman → website}/.gitignore +0 -0
  27. data/{middleman → website}/Gemfile +0 -0
  28. data/{middleman → website}/config.rb +0 -0
  29. data/{middleman → website}/data/links.yml +0 -0
  30. data/{middleman → website}/locales/en.yml +0 -0
  31. data/{middleman → website}/locales/ja.yml +0 -0
  32. data/{middleman → website}/source/layouts/layout.haml +0 -0
  33. data/{middleman → website}/source/localizable/index.haml +0 -0
  34. data/{middleman → website}/source/localizable/usage.html.erb +0 -0
  35. data/{middleman → website}/source/stylesheets/_config.scss +0 -0
  36. data/{middleman → website}/source/stylesheets/index.scss +0 -0
  37. data/{middleman → website}/source/stylesheets/vendor/normalize.css +0 -0
  38. metadata +51 -26
  39. data/LICENSE.txt +0 -22
  40. data/images/sorry.png +0 -0
  41. data/lib/mireru/binary.rb +0 -30
  42. data/lib/mireru/thumbnail.rb +0 -44
  43. data/lib/mireru/video.rb +0 -47
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = %q{Flexible File Viewer Keyboard Friend}
12
12
  spec.description = %q{A file viewer with a focus on flexibility by Ruby/GTK3. A friend of a keyboard.}
13
13
  spec.homepage = "https://github.com/myokoym/mireru"
14
- spec.license = "MIT"
14
+ spec.license = "LGPLv2.1 or later"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency("gtksourceview3", "= 2.1.0")
23
23
  spec.add_runtime_dependency("clutter-gtk", "= 2.1.0")
24
24
  spec.add_runtime_dependency("clutter-gstreamer", "= 2.1.0")
25
+ spec.add_runtime_dependency("poppler", "= 2.1.0")
25
26
  spec.add_runtime_dependency("hexdump")
26
27
 
27
28
  spec.add_development_dependency("test-unit")
@@ -0,0 +1,26 @@
1
+ # Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
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 "test-unit"
18
+ require "test/unit/notify"
19
+
20
+ module ClutterTestUtils
21
+ def omit_if_clutter_color_hash_expect_arguments
22
+ unless Clutter::Color.method(:hash).parameters.empty?
23
+ omit("This test can't be run on this environment.")
24
+ end
25
+ end
26
+ end
Binary file
@@ -8,4 +8,6 @@ base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
8
8
  $LOAD_PATH.unshift(File.join(base_dir, "lib"))
9
9
  $LOAD_PATH.unshift(File.join(base_dir, "test"))
10
10
 
11
+ require "clutter-test-utils"
12
+
11
13
  exit Test::Unit::AutoRunner.run(true)
@@ -9,25 +9,4 @@ class WidgetTest < Test::Unit::TestCase
9
9
  assert_not_nil(Mireru::Widget.image?("hoge.jpeg"))
10
10
  assert_not_nil(Mireru::Widget.image?("hoge.gif"))
11
11
  end
12
-
13
- def test_buffer_from_file_of_text
14
- widget = Mireru::Widget.__send__(:buffer_from_file, __FILE__)
15
- assert_equal(GtkSource::Buffer, widget.class)
16
- end
17
-
18
- def test_buffer_from_file_of_binary
19
- assert_raise Mireru::Error do
20
- Mireru::Widget.__send__(:buffer_from_file, "test/fixtures/nijip.png")
21
- end
22
- end
23
-
24
- def test_buffer_from_text_of_utf8
25
- widget = Mireru::Widget.__send__(:buffer_from_text, "御庭番")
26
- assert_equal(GtkSource::Buffer, widget.class)
27
- end
28
-
29
- def test_buffer_from_text_of_sjis
30
- widget = Mireru::Widget.__send__(:buffer_from_text, "御庭番".encode("SJIS"))
31
- assert_equal(GtkSource::Buffer, widget.class)
32
- end
33
12
  end
@@ -1,9 +1,9 @@
1
- require "mireru/binary"
1
+ require "mireru/widget/binary"
2
2
 
3
3
  class BinaryTest < Test::Unit::TestCase
4
4
  def test_create
5
- file = File.join(File.dirname(__FILE__), "fixtures", "Gemfile.gz")
6
- widget = Mireru::Binary.create(file)
5
+ file = File.join(File.dirname(__FILE__), "..", "fixtures", "Gemfile.gz")
6
+ widget = Mireru::Widget::Binary.create(file)
7
7
  assert_not_nil(widget)
8
8
  assert_equal(Gtk::TextView, widget.class)
9
9
  widget.destroy
@@ -0,0 +1,11 @@
1
+ require "mireru/widget/pdf"
2
+
3
+ class PDFTest < Test::Unit::TestCase
4
+ def test_create
5
+ file = File.join(File.dirname(__FILE__), "..", "fixtures", "sample.pdf")
6
+ widget = Mireru::Widget::PDF.create(file)
7
+ assert_not_nil(widget)
8
+ assert_equal(Gtk::DrawingArea, widget.class)
9
+ widget.destroy
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "mireru/widget/text"
3
+
4
+ class TextTest < Test::Unit::TestCase
5
+ def test_buffer_from_file_of_text
6
+ widget = Mireru::Widget::Text.__send__(:buffer_from_file, __FILE__)
7
+ assert_equal(GtkSource::Buffer, widget.class)
8
+ end
9
+
10
+ def test_buffer_from_text_of_utf8
11
+ widget = Mireru::Widget::Text.__send__(:buffer_from_text, "御庭番")
12
+ assert_equal(GtkSource::Buffer, widget.class)
13
+ end
14
+
15
+ def test_buffer_from_text_of_sjis
16
+ widget = Mireru::Widget::Text.__send__(:buffer_from_text, "御庭番".encode("SJIS"))
17
+ assert_equal(GtkSource::Buffer, widget.class)
18
+ end
19
+ end
@@ -1,14 +1,14 @@
1
- require "mireru/thumbnail"
1
+ require "mireru/widget/thumbnail"
2
2
 
3
3
  class ThumbnailTest < Test::Unit::TestCase
4
4
  def test_image_from_file
5
- widget = Mireru::Thumbnail.__send__(:image_from_file,
5
+ widget = Mireru::Widget::Thumbnail.__send__(:image_from_file,
6
6
  "test/fixtures/nijip.png")
7
7
  assert_equal(Gtk::Image, widget.class)
8
8
  end
9
9
 
10
10
  def test_label_from_fil
11
- widget = Mireru::Thumbnail.__send__(:label_from_file,
11
+ widget = Mireru::Widget::Thumbnail.__send__(:label_from_file,
12
12
  __FILE__)
13
13
  assert_equal(Gtk::Label, widget.class)
14
14
  end
@@ -1,10 +1,14 @@
1
- require "mireru/video"
1
+ require "mireru/widget/video"
2
2
  require "clutter-gtk"
3
3
 
4
4
  class VideoTest < Test::Unit::TestCase
5
+ include ClutterTestUtils
6
+
5
7
  def test_create
8
+ omit_if_clutter_color_hash_expect_arguments
9
+
6
10
  filename = "XXX.ogm"
7
- widget = Mireru::Video.create(filename)
11
+ widget = Mireru::Widget::Video.create(filename)
8
12
  assert_not_nil(widget)
9
13
  assert_equal(ClutterGtk::Embed, widget.class)
10
14
  widget.destroy
@@ -0,0 +1,32 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
4
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+
20
+ set -e
21
+ set -u
22
+
23
+ sudo add-apt-repository -y ppa:gstreamer-developers
24
+ sudo apt-get update -qq
25
+ sudo apt-get install -qq -y \
26
+ libgirepository1.0-dev \
27
+ libgstreamer1.0-dev \
28
+ gir1.2-clutter-1.0 \
29
+ gir1.2-clutter-gst-1.0 \
30
+ gir1.2-gtkclutter-1.0 \
31
+ hicolor-icon-theme \
32
+ gnome-icon-theme
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-29 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk3
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: poppler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.1.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.1.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: hexdump
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -162,52 +176,59 @@ files:
162
176
  - ".gitignore"
163
177
  - ".travis.yml"
164
178
  - Gemfile
165
- - LICENSE.txt
166
179
  - NEWS.md
167
180
  - README.md
168
181
  - Rakefile
169
182
  - bin/mireru
170
- - images/sorry.png
171
183
  - lib/mireru.rb
172
- - lib/mireru/binary.rb
173
184
  - lib/mireru/command/mireru.rb
174
185
  - lib/mireru/container.rb
175
186
  - lib/mireru/logger.rb
176
- - lib/mireru/thumbnail.rb
177
187
  - lib/mireru/version.rb
178
- - lib/mireru/video.rb
179
188
  - lib/mireru/widget.rb
189
+ - lib/mireru/widget/binary.rb
190
+ - lib/mireru/widget/image.rb
191
+ - lib/mireru/widget/pdf.rb
192
+ - lib/mireru/widget/text.rb
193
+ - lib/mireru/widget/thumbnail.rb
194
+ - lib/mireru/widget/video.rb
180
195
  - lib/mireru/window.rb
181
- - middleman/.gitignore
182
- - middleman/Gemfile
183
- - middleman/config.rb
184
- - middleman/data/links.yml
185
- - middleman/locales/en.yml
186
- - middleman/locales/ja.yml
187
- - middleman/source/layouts/layout.haml
188
- - middleman/source/localizable/index.haml
189
- - middleman/source/localizable/usage.html.erb
190
- - middleman/source/stylesheets/_config.scss
191
- - middleman/source/stylesheets/index.scss
192
- - middleman/source/stylesheets/vendor/normalize.css
196
+ - license/lgpl-2.1.txt
193
197
  - mireru.gemspec
198
+ - test/clutter-test-utils.rb
194
199
  - test/fixtures/Gemfile.gz
195
200
  - test/fixtures/LICENSE.txt
196
201
  - test/fixtures/nijip.png
197
202
  - test/fixtures/nijip.rb
198
203
  - test/fixtures/no-extention
204
+ - test/fixtures/sample.pdf
199
205
  - test/run-test.rb
200
- - test/test-binary.rb
201
206
  - test/test-container.rb
202
207
  - test/test-logger.rb
203
208
  - test/test-mireru.rb
204
- - test/test-thumbnail.rb
205
- - test/test-video.rb
206
209
  - test/test-widget.rb
207
210
  - test/test-window.rb
211
+ - test/widget/test-binary.rb
212
+ - test/widget/test-pdf.rb
213
+ - test/widget/test-text.rb
214
+ - test/widget/test-thumbnail.rb
215
+ - test/widget/test-video.rb
216
+ - travis-before-script.sh
217
+ - website/.gitignore
218
+ - website/Gemfile
219
+ - website/config.rb
220
+ - website/data/links.yml
221
+ - website/locales/en.yml
222
+ - website/locales/ja.yml
223
+ - website/source/layouts/layout.haml
224
+ - website/source/localizable/index.haml
225
+ - website/source/localizable/usage.html.erb
226
+ - website/source/stylesheets/_config.scss
227
+ - website/source/stylesheets/index.scss
228
+ - website/source/stylesheets/vendor/normalize.css
208
229
  homepage: https://github.com/myokoym/mireru
209
230
  licenses:
210
- - MIT
231
+ - LGPLv2.1 or later
211
232
  metadata: {}
212
233
  post_install_message:
213
234
  rdoc_options: []
@@ -230,17 +251,21 @@ signing_key:
230
251
  specification_version: 4
231
252
  summary: Flexible File Viewer Keyboard Friend
232
253
  test_files:
254
+ - test/clutter-test-utils.rb
233
255
  - test/fixtures/Gemfile.gz
234
256
  - test/fixtures/LICENSE.txt
235
257
  - test/fixtures/nijip.png
236
258
  - test/fixtures/nijip.rb
237
259
  - test/fixtures/no-extention
260
+ - test/fixtures/sample.pdf
238
261
  - test/run-test.rb
239
- - test/test-binary.rb
240
262
  - test/test-container.rb
241
263
  - test/test-logger.rb
242
264
  - test/test-mireru.rb
243
- - test/test-thumbnail.rb
244
- - test/test-video.rb
245
265
  - test/test-widget.rb
246
266
  - test/test-window.rb
267
+ - test/widget/test-binary.rb
268
+ - test/widget/test-pdf.rb
269
+ - test/widget/test-text.rb
270
+ - test/widget/test-thumbnail.rb
271
+ - test/widget/test-video.rb
@@ -1,22 +0,0 @@
1
- Copyright (c) 2013 Masafumi Yokoyama
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file
@@ -1,30 +0,0 @@
1
- require "stringio"
2
- require "hexdump"
3
-
4
- module Mireru
5
- class Binary
6
- class << self
7
- def create(file)
8
- dump = hexdump(file).string
9
- create_text_view(dump)
10
- end
11
-
12
- private
13
- def hexdump(file)
14
- io = StringIO.new
15
- bytes = File.open(file, "rb").read(20 * 1024)
16
- Hexdump.dump(bytes, :output => io)
17
- io
18
- end
19
-
20
- def create_text_view(text)
21
- buffer = Gtk::TextBuffer.new
22
- buffer.text = text
23
- view = Gtk::TextView.new(buffer)
24
- view.editable = false
25
- view.override_font(Pango::FontDescription.new("Monospace"))
26
- view
27
- end
28
- end
29
- end
30
- end
@@ -1,44 +0,0 @@
1
- require "gtk3"
2
- require "mireru/widget"
3
-
4
- module Mireru
5
- class Thumbnail
6
- class << self
7
- def create(files, width, height)
8
- nums_in_a_row = Math.sqrt(files.size)
9
- rows = Gtk::Box.new(:vertical)
10
- files.each_slice(nums_in_a_row) do |a_row_files|
11
- row = Gtk::Box.new(:horizontal)
12
- a_row_files.each do |file|
13
- cell_width = width / nums_in_a_row
14
- cell_height = height / nums_in_a_row
15
- if Widget.image?(file)
16
- image = image_from_file(file, cell_width, cell_height)
17
- row.add(image)
18
- else
19
- label = label_from_file(file, cell_width, cell_height)
20
- row.add(label)
21
- end
22
- end
23
- rows.add(row)
24
- end
25
- rows
26
- end
27
-
28
- private
29
- def image_from_file(file, width=100, height=100)
30
- image = Gtk::Image.new
31
- pixbuf = Gdk::Pixbuf.new(file, width, height)
32
- image.pixbuf = pixbuf
33
- image
34
- end
35
-
36
- def label_from_file(file, width=100, height=100)
37
- label = Gtk::Label.new(File.basename(file))
38
- label.set_size_request(width, height)
39
- label.wrap = true
40
- label
41
- end
42
- end
43
- end
44
- end