poleica 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -2
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +20 -8
- data/Rakefile +8 -1
- data/lib/poleica/converters/graphics_magick.rb +8 -2
- data/lib/poleica/version.rb +1 -1
- data/test/poleica/converters/libre_office_test.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDE5ZmRlMzY4YjkxOTgzM2M2Nzc2Y2NmZjMxNDRiMGIxMzUxYTg5OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTJmZGQ2ZThiOTU4ZThiZGJjMGNlYzA3ZTdhMzhjNGU2NmRmYmYxYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTZjYTVmNTZiZTQ3ZDQ3ZTdlYjQzYTk0ODcwYzUzYjkwNGYzYjI0NjRkYzEx
|
10
|
+
NzAyNThmZjUxMDRjNjIyODg0Yzc5YmYyMGI4ZjM1YjE2YmM4ZDZhMGE3MWQw
|
11
|
+
NGNjNzE4MzU5ZmRlNTg1OWE4NzgyNTgxMzNmMmEyZjE3ZTVmNzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDQ4OWU5ZDAzZGEyNGU1ZTYxYjIyZTRhOWI4Yjc2NWJhMmRiODU4M2Q4N2Y3
|
14
|
+
MTQ2MGZiNjJlM2VkOWVlODIyYTkzMzU4YTIwNzk5MTZkOTJjMmQ5YmIwMzI1
|
15
|
+
NWE3Y2RmYjA2YTcyMDNjNjI5MjU1ZGJkNDhiNTVlZWZhZjEzZTg=
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Poleica
|
2
2
|
## Poleica = Polaroid + Leica (Real Hipster)
|
3
3
|
|
4
|
-
[![Build Status](https://travis-ci.org/antoinelyset/
|
4
|
+
[![Build Status](https://travis-ci.org/antoinelyset/poleica.png?branch=master)](https://travis-ci.org/antoinelyset/poleica)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/antoinelyset/Poleica/badge.png)](https://coveralls.io/r/antoinelyset/Poleica)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/antoinelyset/Poleica.png)](https://codeclimate.com/github/antoinelyset/Poleica)
|
7
7
|
[![Dependency Status](https://gemnasium.com/antoinelyset/Poleica.png)](https://gemnasium.com/antoinelyset/Poleica)
|
@@ -17,7 +17,19 @@ apt-get install graphicsmagick libreoffice
|
|
17
17
|
__MacOS__ :
|
18
18
|
|
19
19
|
```
|
20
|
-
brew install graphicsmagick
|
20
|
+
brew install ghostscript graphicsmagick
|
21
|
+
```
|
22
|
+
|
23
|
+
__Then__ :
|
24
|
+
|
25
|
+
```
|
26
|
+
gem install poleica
|
27
|
+
```
|
28
|
+
|
29
|
+
or in __Gemfile__ :
|
30
|
+
|
31
|
+
```
|
32
|
+
gem 'poleica'
|
21
33
|
```
|
22
34
|
|
23
35
|
Then download [LibreOffice](http://www.libreoffice.org/download) and install it.
|
@@ -36,12 +48,12 @@ Poleica.new(file_path).to_png(width: 400, weight: 400)
|
|
36
48
|
|
37
49
|
## Options
|
38
50
|
|
39
|
-
- weight:
|
40
|
-
- width:
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
|
51
|
+
- weight : pixels number
|
52
|
+
- width : pixels number
|
53
|
+
- force_resize : boolean(false) (it doesnt preserve the image ratio)
|
54
|
+
- thumbnail : boolean(false) (it crops the image, preserving the image ratio)
|
55
|
+
- path : string folder or file
|
56
|
+
- auto_orient : boolean(true) (keep the orientation extracted from EXIF)
|
45
57
|
|
46
58
|
## Dependencies
|
47
59
|
|
data/Rakefile
CHANGED
@@ -27,7 +27,7 @@ module Poleica
|
|
27
27
|
def to_png(options = {})
|
28
28
|
opts_gen = OptionsGenerator.new(polei, options)
|
29
29
|
cmd = "#{bin_path} convert "
|
30
|
-
cmd << "#{Utils.escape(polei.path)}#{opts_gen.generate}
|
30
|
+
cmd << "#{Utils.escape(polei.path)}#{opts_gen.generate}"
|
31
31
|
`#{cmd}`
|
32
32
|
expected_file_path = opts_gen[:path]
|
33
33
|
File.exists?(expected_file_path) ? expected_file_path : nil
|
@@ -46,7 +46,8 @@ module Poleica
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def generate
|
49
|
-
"#{page_options} #{
|
49
|
+
"#{page_options} #{orient_options}" +
|
50
|
+
" #{thumbnail_or_resize_options}" +
|
50
51
|
" #{Utils.escape(output_options)}"
|
51
52
|
end
|
52
53
|
|
@@ -61,6 +62,7 @@ module Poleica
|
|
61
62
|
height: DEFAULT_MEASURE,
|
62
63
|
width: DEFAULT_MEASURE,
|
63
64
|
force_resize: false,
|
65
|
+
auto_orient: true,
|
64
66
|
thumbnail: false,
|
65
67
|
page: 0,
|
66
68
|
}
|
@@ -71,6 +73,10 @@ module Poleica
|
|
71
73
|
"#{Array(options[:page]).flatten.compact.uniq.sort.to_s}"
|
72
74
|
end
|
73
75
|
|
76
|
+
def orient_options
|
77
|
+
@orient_options ||= options[:auto_orient] ? '-auto-orient' : ''
|
78
|
+
end
|
79
|
+
|
74
80
|
def thumbnail_or_resize_options
|
75
81
|
@thumbnail_or_resize_options ||=
|
76
82
|
options[:thumbnail] ? thumbnail_options : resize_options
|
data/lib/poleica/version.rb
CHANGED
@@ -41,8 +41,29 @@ class LibreOfficeTest < Minitest::Test
|
|
41
41
|
assert_equal(returned_path, path_option)
|
42
42
|
end
|
43
43
|
|
44
|
+
# FIXME fail on Ubuntu
|
45
|
+
# def test_multithreading
|
46
|
+
# threads = multithreaded_conversion
|
47
|
+
# threads.each_with_index do |t, n|
|
48
|
+
# t.join
|
49
|
+
# assert_equal(t[:expected_path], t[:returned_path])
|
50
|
+
# assert(File.exists?(t[:expected_path]))
|
51
|
+
# File.delete(t[:expected_path]) if File.exists?(t[:expected_path])
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
|
44
55
|
private
|
45
56
|
|
57
|
+
def multithreaded_conversion(threads_number = 5)
|
58
|
+
(0..threads_number - 1).map do |n|
|
59
|
+
Thread.new do
|
60
|
+
path_option = "#{Support.support_path}/files/path_test#{n}.pdf"
|
61
|
+
Thread.current[:expected_path] = path_option
|
62
|
+
Thread.current[:returned_path] = doc_polei.to_pdf(path: path_option)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
46
67
|
def clean_pdf_file
|
47
68
|
if File.exists?(Support.expected_converted_path(DOC_PATH, :pdf))
|
48
69
|
File.delete(Support.expected_converted_path(DOC_PATH, :pdf))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poleica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Lyset
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|