poleica 0.9.6 → 0.9.7

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDcyMDk2NWVkMzQ3Nzk2ZjBjN2IzN2NmMzg4OWQ3OGI1NjRmZTM4Yw==
4
+ ZDE5ZmRlMzY4YjkxOTgzM2M2Nzc2Y2NmZjMxNDRiMGIxMzUxYTg5OA==
5
5
  data.tar.gz: !binary |-
6
- OGQ1ZjcxNTVmYTIyOWJiMTE5NGNkYWQ1YWI0NTU1MzZmMzBjYjE2Yg==
6
+ NTJmZGQ2ZThiOTU4ZThiZGJjMGNlYzA3ZTdhMzhjNGU2NmRmYmYxYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTZiOWYzODE4YjQ1NmFlODUzYzQxNDZkYWRjODRiYTcwYTlmYTU3MTYyMDRi
10
- MDEzZDBmNjYzMzcyZWQ1M2FiZjc2YmIyZDFhZThiODA4MzcwZmFiY2JmZWYw
11
- MWM2ZDhhMGZkZmUyZWQ5NTFhOGI1MTNmYTVhZWNmODJkNzMzMjM=
9
+ ZTZjYTVmNTZiZTQ3ZDQ3ZTdlYjQzYTk0ODcwYzUzYjkwNGYzYjI0NjRkYzEx
10
+ NzAyNThmZjUxMDRjNjIyODg0Yzc5YmYyMGI4ZjM1YjE2YmM4ZDZhMGE3MWQw
11
+ NGNjNzE4MzU5ZmRlNTg1OWE4NzgyNTgxMzNmMmEyZjE3ZTVmNzA=
12
12
  data.tar.gz: !binary |-
13
- MDZiNGQ2MzcxMjhjNGI5MjNlZjA4YzJjMGZhNzdkNjI3OGFkMTViZWM0NTVl
14
- MjIzZWMxYjVkMDJmM2FmM2JjNjcxMTMzYjY3YjMxYmMxZThlMDZlZDMxZDEx
15
- YWVmOTI5MDljNjkwNzc1NGNiNWQ2ZjcwN2FkMTFiNmMxN2NhNDA=
13
+ NDQ4OWU5ZDAzZGEyNGU1ZTYxYjIyZTRhOWI4Yjc2NWJhMmRiODU4M2Q4N2Y3
14
+ MTQ2MGZiNjJlM2VkOWVlODIyYTkzMzU4YTIwNzk5MTZkOTJjMmQ5YmIwMzI1
15
+ NWE3Y2RmYjA2YTcyMDNjNjI5MjU1ZGJkNDhiNTVlZWZhZjEzZTg=
data/.travis.yml CHANGED
@@ -9,7 +9,6 @@ before_script:
9
9
  - sudo apt-get update -qq
10
10
  - sudo apt-get install -qq graphicsmagick libreoffice
11
11
  script:
12
- - rake test
13
- - rubocop
12
+ - rake
14
13
  notifications:
15
14
  email: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ # Poleica 0.9.7 (4 August 2013)
2
+ * Add an auto-orient (true by default) to GraphicsMagick
1
3
  # Poleica 0.9.6 (30 July 2013)
2
4
  * Add thumbnail option in GraphicsMagick <3
3
5
  # Poleica 0.9.5 (29 July 2013)
data/Gemfile.lock CHANGED
@@ -17,7 +17,7 @@ GIT
17
17
  PATH
18
18
  remote: .
19
19
  specs:
20
- poleica (0.9.6)
20
+ poleica (0.9.7)
21
21
 
22
22
  GEM
23
23
  remote: https://rubygems.org/
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/Poleica.png?branch=master)](https://travis-ci.org/antoinelyset/Poleica)
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: pixel
40
- - width: pixel
41
- - path: folder or file
42
- - force_resize: boolean (it doesnt preserve the image ratio)
43
- - thumbnail : boolean (it crops the image the given weight and width,
44
- preserving the image ratio)
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
@@ -4,4 +4,11 @@ Rake::TestTask.new do |t|
4
4
  t.libs.push ['lib', 'test']
5
5
  t.test_files = FileList['test/**/*_test.rb']
6
6
  t.verbose = true
7
- end
7
+ end
8
+
9
+ task :rubocop do |t|
10
+ sh 'rubocop'
11
+ end
12
+
13
+ task :default => [:test, :rubocop]
14
+
@@ -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} #{thumbnail_or_resize_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
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Poleica
3
- VERSION ||= '0.9.6'
3
+ VERSION ||= '0.9.7'
4
4
  end # module Poleica
@@ -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.6
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-07-30 00:00:00.000000000 Z
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