poleica 0.10.0 → 0.10.1.fix1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d3b239c7ce5ff65ab699ed739529adaf38b8bae
4
- data.tar.gz: 72bc48906b05ebe9a97ee6688ca9b3c939907c5a
3
+ metadata.gz: e1d83d3535fc8767e224ae910c97e2920ebdb1e0
4
+ data.tar.gz: d1d946ba9b11059b9660fbcf400f130b73677868
5
5
  SHA512:
6
- metadata.gz: 87c1b7f335b5edee4ba8709b47be61c1947b85417b7ce6d91180e32d080bb4efa81388a96a6e177d58e5ddf5a0a9dcb77329c2fd4f3c3c70cc4e93326b6a2f9a
7
- data.tar.gz: c434159811f12b38281c53e655938a52a6300a8ef5dd6d9c11a327391e852fdd80b0099e8593086ff01cea89f7e2abfca6ba02415883dc4e7753c1ec120773fb
6
+ metadata.gz: 5cf65f99778e581a3254379e8cfbde2f9ec6ca56f3bdfdc95ddf611f87bc949e76379b53e8bf0bb5c43bec69fb2caae6615f09ee1ff0a1168a0480da2f8612b4
7
+ data.tar.gz: 8e332e264e5795b071800806b053b77bf65bec3d341e76d5b54fbd4f37a5d832dc55fab23d2c741900fb4f52512097e1b4bc405855d2c787ea3441ed738ea6f6
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ Exclude:
3
+ - test/**/*
4
+ - Rakefile
5
+ Include:
6
+ - lib/**/*
7
+ Style/MultilineOperationIndentation:
8
+ EnforcedStyle: indented
data/.travis.yml CHANGED
@@ -2,15 +2,17 @@ language: ruby
2
2
  bundler_args: --without development
3
3
  rvm:
4
4
  - 1.9.3
5
- - 2.0.0
6
- - rbx-19mode
5
+ - 2.1
6
+ - 2.0
7
+ - 2.2
8
+ - rbx-2
7
9
  - jruby-19mode
8
10
  before_script:
9
11
  - sudo apt-get update -qq
10
12
  - sudo apt-get install -qq libreoffice
11
- - wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/1.3/GraphicsMagick-1.3.18.tar.gz
12
- - tar -xvf GraphicsMagick-1.3.18.tar.gz
13
- - cd GraphicsMagick-1.3.18
13
+ - wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/1.3/GraphicsMagick-1.3.20.tar.gz
14
+ - tar -xvf GraphicsMagick-1.3.20.tar.gz
15
+ - cd GraphicsMagick-1.3.20
14
16
  - ./configure
15
17
  - make
16
18
  - sudo make install
@@ -20,7 +22,10 @@ script:
20
22
  matrix:
21
23
  fast_finish: true
22
24
  allow_failures:
25
+ - rvm: rbx-2
23
26
  - rvm: jruby-19mode
24
- - rvm: rbx-19mode
25
27
  notifications:
26
28
  email: false
29
+ addons:
30
+ code_climate:
31
+ repo_token: 6e49c9e59b6593fc1eb510222536706a1ab6fbbed3a50747f597a1d4ed74d511
data/Gemfile CHANGED
@@ -11,8 +11,8 @@ end
11
11
  group :test do
12
12
  gem 'rake'
13
13
  gem 'minitest'
14
- gem 'rubocop', github: 'bbatsov/rubocop'
15
- gem 'coveralls', require: false
14
+ gem 'rubocop'
15
+ gem "codeclimate-test-reporter", require: nil
16
16
  end
17
17
 
18
18
  group :development do
data/Gemfile.lock CHANGED
@@ -1,116 +1,108 @@
1
- GIT
2
- remote: git://github.com/bbatsov/rubocop.git
3
- revision: 07c5d73b050e242ce17c4ee4ee5e91fdad554a18
4
- specs:
5
- rubocop (0.18.1)
6
- json (>= 1.7.7, < 2)
7
- parser (~> 2.1.7)
8
- powerpack (~> 0.0.6)
9
- rainbow (>= 1.99.1, < 3.0)
10
- ruby-progressbar (~> 1.4)
11
-
12
1
  GIT
13
2
  remote: git://github.com/guard/guard-minitest.git
14
- revision: b61231b06685ea0b1d480a3da11d015eb59fc7c6
3
+ revision: 7738c49bfe9c1a6a54181d8f413abd9633de9c2e
15
4
  specs:
16
- guard-minitest (2.2.0)
17
- guard (~> 2.0)
5
+ guard-minitest (2.4.4)
6
+ guard-compat (~> 1.2)
18
7
  minitest (>= 3.0)
19
8
 
20
9
  PATH
21
10
  remote: .
22
11
  specs:
23
- poleica (0.9.12)
12
+ poleica (0.10.0)
24
13
  childprocess
25
14
 
26
15
  GEM
27
16
  remote: https://rubygems.org/
28
17
  specs:
29
- ast (1.1.0)
30
- byebug (2.7.0)
31
- columnize (~> 0.3)
18
+ ast (2.0.0)
19
+ astrolabe (1.3.0)
20
+ parser (>= 2.2.0.pre.3, < 3.0)
21
+ byebug (3.5.1)
22
+ columnize (~> 0.8)
32
23
  debugger-linecache (~> 1.2)
33
- celluloid (0.15.2)
34
- timers (~> 1.1.0)
35
- celluloid-io (0.15.0)
36
- celluloid (>= 0.15.0)
37
- nio4r (>= 0.5.0)
38
- childprocess (0.5.1)
24
+ slop (~> 3.6)
25
+ celluloid (0.16.0)
26
+ timers (~> 4.0.0)
27
+ childprocess (0.5.5)
39
28
  ffi (~> 1.0, >= 1.0.11)
29
+ codeclimate-test-reporter (0.4.7)
30
+ simplecov (>= 0.7.1, < 1.0.0)
40
31
  coderay (1.1.0)
41
32
  columnize (0.9.0)
42
- coveralls (0.7.0)
43
- multi_json (~> 1.3)
44
- rest-client
45
- simplecov (>= 0.7)
46
- term-ansicolor
47
- thor
48
33
  debugger-linecache (1.2.0)
49
- docile (1.1.3)
50
- ffi (1.9.3)
51
- formatador (0.2.4)
52
- guard (2.5.1)
34
+ docile (1.1.5)
35
+ ffi (1.9.6)
36
+ formatador (0.2.5)
37
+ guard (2.12.4)
53
38
  formatador (>= 0.2.4)
54
- listen (~> 2.6)
39
+ listen (~> 2.7)
55
40
  lumberjack (~> 1.0)
41
+ nenv (~> 0.1)
42
+ notiffany (~> 0.0)
56
43
  pry (>= 0.9.12)
44
+ shellany (~> 0.0)
57
45
  thor (>= 0.18.1)
58
- guard-rubocop (1.0.2)
46
+ guard-compat (1.2.1)
47
+ guard-rubocop (1.2.0)
59
48
  guard (~> 2.0)
60
- rubocop (~> 0.10)
61
- json (1.8.1)
62
- listen (2.7.0)
49
+ rubocop (~> 0.20)
50
+ hitimes (1.2.2)
51
+ listen (2.9.0)
63
52
  celluloid (>= 0.15.2)
64
- celluloid-io (>= 0.15.0)
65
53
  rb-fsevent (>= 0.9.3)
66
54
  rb-inotify (>= 0.9)
67
- lumberjack (1.0.4)
55
+ lumberjack (1.0.9)
68
56
  method_source (0.8.2)
69
- mime-types (1.25.1)
70
- minitest (5.3.0)
71
- multi_json (1.9.2)
72
- nio4r (1.0.0)
73
- parser (2.1.7)
74
- ast (~> 1.1)
75
- slop (~> 3.4, >= 3.4.5)
76
- powerpack (0.0.9)
77
- pry (0.9.12.6)
78
- coderay (~> 1.0)
79
- method_source (~> 0.8)
57
+ minitest (5.5.1)
58
+ multi_json (1.11.0)
59
+ nenv (0.2.0)
60
+ notiffany (0.0.6)
61
+ nenv (~> 0.1)
62
+ shellany (~> 0.0)
63
+ parser (2.2.0.3)
64
+ ast (>= 1.1, < 3.0)
65
+ powerpack (0.1.0)
66
+ pry (0.10.1)
67
+ coderay (~> 1.1.0)
68
+ method_source (~> 0.8.1)
80
69
  slop (~> 3.4)
81
- pry-byebug (1.3.2)
82
- byebug (~> 2.7)
83
- pry (~> 0.9.12)
70
+ pry-byebug (3.0.1)
71
+ byebug (~> 3.4)
72
+ pry (~> 0.10)
84
73
  rainbow (2.0.0)
85
- rake (10.3.0)
74
+ rake (10.4.2)
86
75
  rb-fsevent (0.9.4)
87
- rb-inotify (0.9.3)
76
+ rb-inotify (0.9.5)
88
77
  ffi (>= 0.5.0)
89
- rest-client (1.6.7)
90
- mime-types (>= 1.16)
91
- ruby-progressbar (1.4.2)
92
- simplecov (0.8.2)
78
+ rubocop (0.29.1)
79
+ astrolabe (~> 1.3)
80
+ parser (>= 2.2.0.1, < 3.0)
81
+ powerpack (~> 0.1)
82
+ rainbow (>= 1.99.1, < 3.0)
83
+ ruby-progressbar (~> 1.4)
84
+ ruby-progressbar (1.7.1)
85
+ shellany (0.0.1)
86
+ simplecov (0.9.2)
93
87
  docile (~> 1.1.0)
94
- multi_json
95
- simplecov-html (~> 0.8.0)
96
- simplecov-html (0.8.0)
97
- slop (3.5.0)
98
- term-ansicolor (1.3.0)
99
- tins (~> 1.0)
88
+ multi_json (~> 1.0)
89
+ simplecov-html (~> 0.9.0)
90
+ simplecov-html (0.9.0)
91
+ slop (3.6.0)
100
92
  thor (0.19.1)
101
- timers (1.1.0)
102
- tins (1.0.0)
93
+ timers (4.0.1)
94
+ hitimes
103
95
 
104
96
  PLATFORMS
105
97
  ruby
106
98
 
107
99
  DEPENDENCIES
108
100
  bundler (~> 1.3)
109
- coveralls
101
+ codeclimate-test-reporter
110
102
  guard-minitest!
111
103
  guard-rubocop
112
104
  minitest
113
105
  poleica!
114
106
  pry-byebug
115
107
  rake
116
- rubocop!
108
+ rubocop
data/README.md CHANGED
@@ -37,14 +37,14 @@ gem install poleica
37
37
 
38
38
  or in __Gemfile__ :
39
39
 
40
- ```
40
+ ```ruby
41
41
  gem 'poleica'
42
42
  ```
43
43
 
44
44
 
45
45
  ## Usage
46
46
 
47
- ```
47
+ ```ruby
48
48
  Poleica.new(file_path).to_png
49
49
  Poleica.new(file_path).to_pdf
50
50
  Poleica.new(file_path).to_thumbnail
@@ -55,7 +55,7 @@ Poleica.new(file_path).to_png(width: 400, weight: 400)
55
55
 
56
56
  Example :
57
57
 
58
- ```
58
+ ```ruby
59
59
  Poleica.configure do |config|
60
60
  config.timeout = 2 # time in secs
61
61
  config.libre_office[:bin_paths][:linux] = '/usr/local/bin/gm'
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ Rake::TestTask.new do |t|
7
7
  t.verbose = true
8
8
  end
9
9
 
10
- Rubocop::RakeTask.new
10
+ RuboCop::RakeTask.new
11
11
 
12
12
  task :default => [:test, :rubocop]
13
13
 
@@ -2,9 +2,9 @@
2
2
  module Poleica
3
3
  # Conversion Logic, given a type it can search for compatible converters
4
4
  module Convertible
5
- CONVERTERS = Poleica::Converters
6
- .constants.map { |c| Poleica::Converters.const_get(c) } -
7
- [Poleica::Converters::Utils]
5
+ CONVERTERS = Poleica::Converters.constants
6
+ .map { |c| Poleica::Converters.const_get(c) } -
7
+ [Poleica::Converters::Utils]
8
8
 
9
9
  def method_missing(method, *args, &block)
10
10
  extension, options =
@@ -28,7 +28,7 @@ module Poleica
28
28
  def compatible_converters
29
29
  @compatible_converters ||=
30
30
  compatible_converters_by_type(file_type.class) <<
31
- Converters::General
31
+ Converters::General
32
32
  end
33
33
 
34
34
  def compatible_convert_methods
@@ -14,7 +14,7 @@ module Poleica
14
14
  @polei = polei
15
15
  end
16
16
 
17
- def to_bin(options = {})
17
+ def to_bin(_options = {})
18
18
  File.binread(polei.path)
19
19
  end
20
20
 
@@ -26,8 +26,9 @@ module Poleica
26
26
 
27
27
  def default_options
28
28
  {
29
+ path: polei.path_with_md5(:png),
29
30
  height: DEFAULT_MEASURE,
30
- width: DEFAULT_MEASURE,
31
+ width: DEFAULT_MEASURE,
31
32
  force_resize: false,
32
33
  auto_orient: true,
33
34
  page: 0
@@ -52,15 +53,11 @@ module Poleica
52
53
  end
53
54
 
54
55
  def output_options
55
- @output_path = if options[:path]
56
- if File.directory?(options[:path])
57
- name = File.basename(polei.path_with_md5(:png))
58
- File.join(options[:path], name)
59
- else
60
- options[:path]
61
- end
56
+ @output_path = if File.directory?(options[:path])
57
+ name = File.basename(polei.path_with_md5(:png))
58
+ File.join(options[:path], name)
62
59
  else
63
- polei.path_with_md5(:png)
60
+ options[:path]
64
61
  end
65
62
  end
66
63
  end # class OptionsGenerator
@@ -29,6 +29,7 @@ module Poleica
29
29
 
30
30
  def default_options
31
31
  {
32
+ path: polei.path_with_md5(:png),
32
33
  height: DEFAULT_MEASURE,
33
34
  width: DEFAULT_MEASURE,
34
35
  auto_orient: true
@@ -44,7 +45,7 @@ module Poleica
44
45
  [
45
46
  '-resize',
46
47
  "#{width_and_height_options}"
47
- ]
48
+ ]
48
49
  end
49
50
 
50
51
  def width_and_height_options
@@ -91,15 +92,11 @@ module Poleica
91
92
  end
92
93
 
93
94
  def output_options
94
- @output_path = if options[:path]
95
- if File.directory?(options[:path])
96
- name = File.basename(polei.path_with_md5(:png))
97
- File.join(options[:path], name)
98
- else
99
- options[:path]
100
- end
95
+ @output_path = if File.directory?(options[:path])
96
+ name = File.basename(polei.path_with_md5(:png))
97
+ File.join(options[:path], name)
101
98
  else
102
- polei.path_with_md5(:png)
99
+ options[:path]
103
100
  end
104
101
  end
105
102
  end # class ThumbnailOptionsGenerator
@@ -20,38 +20,36 @@ module Poleica
20
20
  def to_pdf(options = {})
21
21
  opts_gen = OptionsGenerator.new(polei, options, :pdf)
22
22
  exec_with_timeout(bin_path, opts_gen.generate)
23
- expected_file_path = opts_gen[:path] || polei.path_with_md5(:pdf)
23
+ expected_file_path = opts_gen.output_path
24
24
  File.exist?(expected_file_path) ? expected_file_path : nil
25
25
  ensure
26
26
  temp_file_path = opts_gen.temp_path
27
27
  File.delete(temp_file_path) if File.exist?(temp_file_path)
28
28
  end
29
29
 
30
- private
31
-
32
30
  # Generate options for the soffice command
33
31
  class OptionsGenerator
34
- attr_reader :options, :format, :polei
32
+ attr_reader :options, :format, :polei, :output_path
35
33
 
36
34
  def initialize(polei, options = {}, format = :pdf)
37
- defaults = {}
38
- @options = defaults.merge(options)
39
- @polei = polei
40
- @format = format
35
+ @polei = polei
36
+ @format = format
37
+ @output_path = options[:path] || polei.path_with_md5(format)
38
+ @options = default_options.merge(options)
39
+ end
40
+
41
+ def default_options
42
+ { path: polei.path_with_md5 }
41
43
  end
42
44
 
43
45
  def generate
44
46
  [
45
- default_options,
47
+ default_arguments,
46
48
  format,
47
49
  output_options
48
50
  ].flatten
49
51
  end
50
52
 
51
- def [](key)
52
- options[key]
53
- end
54
-
55
53
  # Generate a temp path, and create the file this is needed in order to
56
54
  # have the right filename, LibreOffice just copy the original filename
57
55
  # in the choosen directory, it doesn't accept filename params.
@@ -65,15 +63,10 @@ module Poleica
65
63
  private
66
64
 
67
65
  def generate_temp_path
68
- if options[:path]
69
- if File.directory?(options[:path])
70
- basename = File.basename(polei.path_with_md5)
71
- return File.join(options[:path], basename)
72
- end
73
- extension = File.extname(polei.path)
74
- return pathable_object.path_for_extension(extension[1..-1])
66
+ if File.directory?(options[:path])
67
+ File.join(options[:path], File.basename(polei.path_with_md5))
75
68
  else
76
- return polei.path_with_md5(polei.file_extension)
69
+ pathable_object.path_for_extension(File.extname(polei.path))
77
70
  end
78
71
  end
79
72
 
@@ -82,7 +75,7 @@ module Poleica
82
75
  pathable_object.extend(Poleica::Pathable)
83
76
  end
84
77
 
85
- def default_options
78
+ def default_arguments
86
79
  %w(
87
80
  --nologo
88
81
  --headless
@@ -9,15 +9,15 @@ module Poleica
9
9
  HOST_OS ||= (defined?('RbConfig') ? RbConfig : Config)::CONFIG['host_os']
10
10
 
11
11
  def windows?
12
- !!HOST_OS.match(/mswin|windows|cygwin/i)
12
+ !HOST_OS.match(/mswin|windows|cygwin/i).nil?
13
13
  end
14
14
 
15
15
  def osx?
16
- !!HOST_OS.match(/darwin/i)
16
+ !HOST_OS.match(/darwin/i).nil?
17
17
  end
18
18
 
19
19
  def linux?
20
- !!HOST_OS.match(/linux/i)
20
+ !HOST_OS.match(/linux/i).nil?
21
21
  end
22
22
 
23
23
  def host_os
@@ -61,7 +61,7 @@ module Poleica
61
61
  raise Poleica::TimeoutError, e.message
62
62
  end
63
63
 
64
- def map_std(process, &block)
64
+ def map_std(process, &_block)
65
65
  stdout, stdout_w, stderr, stderr_w = init_process_std(process)
66
66
  yield
67
67
  stderr_w.close.nil? && fail_if_error(process, stderr)
@@ -82,10 +82,9 @@ module Poleica
82
82
  end
83
83
 
84
84
  def fail_if_error(process, stderr)
85
- unless process.exit_code == 0
86
- message = "Code: #{process.exit_code} #{stderr.read}"
87
- fail Poleica::ProcessError, message
88
- end
85
+ return if process.exit_code == 0
86
+ message = "Code: #{process.exit_code} #{stderr.read}"
87
+ fail Poleica::ProcessError, message
89
88
  end
90
89
  end # module Utils
91
90
  end # module Converters
@@ -45,7 +45,7 @@ module Poleica
45
45
  rft
46
46
  )
47
47
 
48
- def initialize(file_path)
48
+ def initialize(_file_path)
49
49
  end
50
50
  end # class Document
51
51
  end # module Types
@@ -7,7 +7,7 @@ module Poleica
7
7
  COMPATIBLE_MIMETYPES = []
8
8
  COMPATIBLE_EXTENSIONS = []
9
9
 
10
- def initialize(file_path)
10
+ def initialize(_file_path)
11
11
  end
12
12
  end # class General
13
13
  end # module Types
@@ -29,7 +29,7 @@ module Poleica
29
29
  png
30
30
  )
31
31
 
32
- def initialize(file_path)
32
+ def initialize(_file_path)
33
33
  end
34
34
  end # class Image
35
35
  end # module Types
@@ -11,7 +11,7 @@ module Poleica
11
11
  pdf
12
12
  )
13
13
 
14
- def initialize(file_path)
14
+ def initialize(_file_path)
15
15
  end
16
16
  end # class PDF
17
17
  end # module Types
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # Poleica namespace
3
3
  module Poleica
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1.fix1'
5
5
  end # module Poleica
data/test/test_helper.rb CHANGED
@@ -1,13 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  if ENV['COVERAGE'] || ENV['TRAVIS']
3
- require 'coveralls'
4
- require 'simplecov'
5
-
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7
- SimpleCov::Formatter::HTMLFormatter,
8
- Coveralls::SimpleCov::Formatter
9
- ]
10
- Coveralls.wear!
3
+ require 'codeclimate-test-reporter'
4
+ CodeClimate::TestReporter.start
11
5
  end
12
6
 
13
7
  Bundler.require(:default, :test)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poleica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1.fix1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antoine Lyset
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
+ - ".rubocop.yml"
49
50
  - ".travis.yml"
50
51
  - CHANGELOG.md
51
52
  - Gemfile
@@ -110,9 +111,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
111
  version: '0'
111
112
  required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  requirements:
113
- - - ">="
114
+ - - ">"
114
115
  - !ruby/object:Gem::Version
115
- version: '0'
116
+ version: 1.3.1
116
117
  requirements: []
117
118
  rubyforge_project:
118
119
  rubygems_version: 2.2.2