libreconv 0.8.1 → 0.9.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39baec4c6b5f1e2ad2cd9763a544fc2f509f9782
4
- data.tar.gz: 33000e19179616640f0f1453bac7fce018df8084
3
+ metadata.gz: 14a16a3e394c4ba9f9d7f69656286f2cdd309a07
4
+ data.tar.gz: f2768dd2c7905a798f24b62e107270430f37dd57
5
5
  SHA512:
6
- metadata.gz: 4285c8657072f9abd1db33cefcf1b76d63891055365f5beffb97211950a0da976cef03070166c9060ddc27bd81cec074270f85667a93dbcd9d0356528130cb2f
7
- data.tar.gz: ca0464c97b73fb5b97dc7d4762eeef479c562fae354bab940838838688ff93a87fbc42b7a7868fceabcacfac5f73dcf42c0d75cb5373e63172ae0980e7d164e5
6
+ metadata.gz: 07d5b921a16008271f6a4eaf5ed074279e3ab47199fe694ab5b96d9608e8f322f4c4297a1f3119c436bb2701c16a691050a29ce9efbeca4fa24c4991e2a9b676
7
+ data.tar.gz: 04805b8bf5fd94960161f22c2d9635ddb8361990059e18fdfb2d61758ead3030292c16b261550c28ece1531739e930dbf564bd7da39400c3eb4aa56a7b605c17
data/.travis.yml CHANGED
@@ -2,11 +2,11 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - rbx-19mode
5
+ - 2.1.1
6
6
  - jruby-19mode
7
7
  - jruby-head
8
8
  notifications:
9
9
  recipients:
10
10
  - ricny046@gmail.com
11
11
  before_install:
12
- - sudo apt-get install libreoffice
12
+ - sudo apt-get install libreoffice
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Richard Nyström
1
+ Copyright (c) 2014 Richard Nyström
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- You need to install Libreoffice or Openoffice on your system to use this gem. The code has been tested with Libreoffice 4.0.
24
+ You need to install Libreoffice or Openoffice on your system to use this gem. The code has been tested with Libreoffice 4.2.
25
25
 
26
26
  ```ruby
27
27
  require 'libreconv'
data/lib/libreconv.rb CHANGED
@@ -17,11 +17,11 @@ module Libreconv
17
17
  @source = source
18
18
  @target = target
19
19
  @target_path = Dir.tmpdir
20
- @soffice_command = soffice_command
20
+ @soffice_command = soffice_command
21
21
  determine_soffice_command
22
22
  check_source_type
23
-
24
- unless @soffice_command && File.exists?(@soffice_command)
23
+
24
+ unless @soffice_command && File.exists?(@soffice_command)
25
25
  raise IOError, "Can't find Libreoffice or Openoffice executable."
26
26
  end
27
27
  end
@@ -29,7 +29,7 @@ module Libreconv
29
29
  def convert
30
30
  orig_stdout = $stdout.clone
31
31
  $stdout.reopen File.new('/dev/null', 'w')
32
- pid = Spoon.spawnp(@soffice_command, "--headless", "--convert-to", "pdf", @source, "-outdir", @target_path)
32
+ pid = Spoon.spawnp(@soffice_command, "--headless", "--convert-to", "pdf", @source, "--outdir", @target_path)
33
33
  Process.waitpid(pid)
34
34
  $stdout.reopen orig_stdout
35
35
  target_tmp_file = "#{@target_path}/#{File.basename(@source, ".*")}.pdf"
@@ -53,15 +53,15 @@ module Libreconv
53
53
  return exe if File.executable? exe
54
54
  end
55
55
  end
56
-
56
+
57
57
  return nil
58
58
  end
59
59
 
60
60
  def check_source_type
61
61
  is_file = File.exists?(@source) && !File.directory?(@source)
62
62
  is_http = URI(@source).scheme == "http" && Net::HTTP.get_response(URI(@source)).is_a?(Net::HTTPSuccess)
63
- is_https = URI(@source).scheme == "https" && Net::HTTP.get_response(URI(@source)).is_a?(Net::HTTPSuccess)
63
+ is_https = URI(@source).scheme == "https" && Net::HTTP.get_response(URI(@source)).is_a?(Net::HTTPSuccess)
64
64
  raise IOError, "Source (#{@source}) is neither a file nor an URL." unless is_file || is_http || is_https
65
65
  end
66
66
  end
67
- end
67
+ end
@@ -1,3 +1,3 @@
1
1
  module Libreconv
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
data/libreconv.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
  spec.add_dependency "spoon"
21
- spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "bundler", "~> 1.6.0.rc2"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec"
24
- end
23
+ spec.add_development_dependency "rspec", "~> 3.0.0.rc1"
24
+ end
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
-
4
- describe Libreconv do
5
-
3
+
4
+ describe Libreconv do
5
+
6
6
  before(:all) do
7
7
  @docx_file = file_path("docx.docx")
8
8
  @doc_file = file_path("doc.doc")
@@ -23,11 +23,11 @@ describe Libreconv do
23
23
  describe Libreconv::Converter do
24
24
  describe "#new" do
25
25
  it "should raise error if soffice command does not exists" do
26
- lambda { Libreconv::Converter.new(@doc_file, "/target", "/Whatever/soffice") }.should raise_error(IOError)
26
+ expect { Libreconv::Converter.new(@doc_file, "/target", "/Whatever/soffice") }.to raise_error(IOError)
27
27
  end
28
28
 
29
29
  it "should raise error if source does not exists" do
30
- lambda { Libreconv::Converter.new(file_path("nonsense.txt"), "/target") }.should raise_error(IOError)
30
+ expect { Libreconv::Converter.new(file_path("nonsense.txt"), "/target") }.to raise_error(IOError)
31
31
  end
32
32
  end
33
33
 
@@ -36,42 +36,42 @@ describe Libreconv do
36
36
  target_file = "#{@target_path}/#{File.basename(@doc_file, ".doc")}.pdf"
37
37
  converter = Libreconv::Converter.new(@doc_file, target_file)
38
38
  converter.convert
39
- File.file?(target_file).should == true
39
+ expect(File.file?(target_file)).to eq true
40
40
  end
41
41
 
42
42
  it "should convert a doc to pdf" do
43
- target_file = "#{@target_path}/#{File.basename(@doc_file, ".doc")}.pdf"
43
+ target_file = "#{@target_path}/#{File.basename(@doc_file, ".doc")}.pdf"
44
44
  converter = Libreconv::Converter.new(@doc_file, @target_path)
45
45
  converter.convert
46
- File.file?(target_file).should == true
46
+ expect(File.file?(target_file)).to eq true
47
47
  end
48
48
 
49
49
  it "should convert a docx to pdf" do
50
- target_file = "#{@target_path}/#{File.basename(@docx_file, ".docx")}.pdf"
50
+ target_file = "#{@target_path}/#{File.basename(@docx_file, ".docx")}.pdf"
51
51
  converter = Libreconv::Converter.new(@docx_file, @target_path)
52
52
  converter.convert
53
- File.file?(target_file).should == true
53
+ expect(File.file?(target_file)).to eq true
54
54
  end
55
55
 
56
56
  it "should convert a pptx to pdf" do
57
- target_file = "#{@target_path}/#{File.basename(@pptx_file, ".pptx")}.pdf"
57
+ target_file = "#{@target_path}/#{File.basename(@pptx_file, ".pptx")}.pdf"
58
58
  converter = Libreconv::Converter.new(@pptx_file, @target_path)
59
59
  converter.convert
60
- File.file?(target_file).should == true
60
+ expect(File.file?(target_file)).to eq true
61
61
  end
62
62
 
63
63
  it "should convert a ppt to pdf" do
64
- target_file = "#{@target_path}/#{File.basename(@ppt_file, ".ppt")}.pdf"
64
+ target_file = "#{@target_path}/#{File.basename(@ppt_file, ".ppt")}.pdf"
65
65
  converter = Libreconv::Converter.new(@ppt_file, @target_path)
66
66
  converter.convert
67
- File.file?(target_file).should == true
67
+ expect(File.file?(target_file)).to eq true
68
68
  end
69
69
 
70
70
  it "should convert a docx to pdf specifying an URL as source" do
71
71
  target_file = "#{@target_path}/docx.pdf"
72
72
  converter = Libreconv::Converter.new(@url, @target_path)
73
73
  converter.convert
74
- File.file?(target_file).should == true
74
+ expect(File.file?(target_file)).to eq true
75
75
  end
76
76
  end
77
77
 
@@ -79,22 +79,22 @@ describe Libreconv do
79
79
  it "should return the user specified command path" do
80
80
  cmd = file_path("soffice") # just faking that the command is present here
81
81
  converter = Libreconv::Converter.new(@doc_file, "/target", cmd)
82
- converter.soffice_command.should == cmd
82
+ expect(converter.soffice_command).to eq cmd
83
83
  end
84
84
 
85
85
  it "should return the command found in path" do
86
86
  cmd = `which soffice`.strip
87
87
  converter = Libreconv::Converter.new(@doc_file, "/target")
88
- converter.soffice_command.should == cmd
88
+ expect(converter.soffice_command).to eq cmd
89
89
  end
90
90
  end
91
91
 
92
92
  describe ".convert" do
93
93
  it "should convert a file to pdf" do
94
- target_file = "#{@target_path}/#{File.basename(@doc_file, ".doc")}.pdf"
94
+ target_file = "#{@target_path}/#{File.basename(@doc_file, ".doc")}.pdf"
95
95
  Libreconv.convert(@doc_file, @target_path)
96
- File.file?(target_file).should == true
96
+ expect(File.file?(target_file)).to eq true
97
97
  end
98
98
  end
99
99
  end
100
- end
100
+ end
data/spec/spec_helper.rb CHANGED
@@ -5,9 +5,8 @@ def file_path( *paths )
5
5
  end
6
6
 
7
7
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
8
  config.run_all_when_everything_filtered = true
10
9
  config.filter_run :focus
11
10
 
12
11
  config.order = 'random'
13
- end
12
+ end
metadata CHANGED
@@ -1,81 +1,81 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libreconv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Nyström
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spoon
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: 1.6.0.rc2
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: 1.6.0.rc2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 3.0.0.rc1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description: ' Convert office documents to PDF using LibreOffice. '
68
+ version: 3.0.0.rc1
69
+ description: " Convert office documents to PDF using LibreOffice. "
70
70
  email:
71
71
  - ricny046@gmail.com
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .rspec
78
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
81
  - README.md
@@ -100,17 +100,17 @@ require_paths:
100
100
  - lib
101
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.0.0
113
+ rubygems_version: 2.2.2
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Convert office documents to PDF.