Skip to content

Commit 580d4a0

Browse files
authored
Merge pull request #28 from nthachus/master
Fix to support converting office file by URL
2 parents f2f9ca8 + 2252da7 commit 580d4a0

20 files changed

+393
-246
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
max_line_length = 100
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = off
15+
trim_trailing_whitespace = false

.gitignore

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
*.gem
2-
*.rbc
3-
.bundle
4-
.config
5-
.yardoc
6-
InstalledFiles
7-
_yardoc
8-
coverage
9-
doc/
10-
lib/bundler/man
11-
pkg
12-
rdoc
13-
spec/reports
14-
test/tmp
15-
test/version_tmp
16-
tmp
17-
.idea/
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
189

19-
TODO.md
10+
# rspec failure tracking
11+
.rspec_status
2012

21-
spec/.DS_Store
13+
/Gemfile.lock
14+
/.ruby-version
15+
*.gem
16+
/vendor/bundle
2217

18+
# Misc.
2319
.DS_Store
20+
/.idea/

.rspec

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
--color
2-
--format progress
2+
--format documentation
3+
--require spec_helper
4+
--order rand

.rubocop.yml

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
require: rubocop-rspec
22

3-
Metrics/AbcSize:
4-
# Max: 25
5-
Enabled: false
3+
AllCops:
4+
TargetRubyVersion: 2.3
65

7-
Metrics/MethodLength:
8-
# Max: 20
6+
Style/Documentation:
97
Enabled: false
108

11-
Metrics/CyclomaticComplexity:
12-
# Max: 10
13-
Enabled: false
9+
Metrics/LineLength:
10+
Max: 100
1411

15-
Metrics/BlockLength:
16-
Enabled: false
12+
Style/PercentLiteralDelimiters:
13+
PreferredDelimiters:
14+
'%w': '[]'
1715

18-
Metrics/PerceivedComplexity:
16+
Style/ExpandPathArguments:
1917
Enabled: false
2018

21-
RSpec/ExampleLength:
19+
Style/Encoding:
2220
Enabled: false
2321

24-
Style/Documentation:
22+
Layout/EndOfLine:
2523
Enabled: false

.ruby-version

-1
This file was deleted.

.travis.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
sudo: false
12
language: ruby
3+
cache: bundler
24
rvm:
3-
- 2.2.0
4-
- 2.5.3
5+
- 1.9.3
6+
- 2.2
7+
- 2.3
8+
- 2.5
9+
- jruby
510
before_install:
611
- sudo apt-get update -qq
7-
- sudo apt-get install libreoffice
12+
- sudo apt-get install libreoffice-core libreoffice-writer libreoffice-calc libreoffice-impress -y --no-install-recommends
13+
before_script: bundle exec rubocop
14+
script: bundle exec rake

Gemfile

-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,3 @@ source 'https://rubygems.org'
44

55
# Specify your gem's dependencies in libreconv.gemspec
66
gemspec
7-
8-
group :development, :test do
9-
gem 'pry-byebug'
10-
gem 'rubocop', require: false
11-
gem 'rubocop-rspec', require: false
12-
gem 'webmock'
13-
end

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Convert office documents using LibreOffice / OpenOffice to one of their supporte
99

1010
Add this line to your application's Gemfile:
1111

12-
gem 'libreconv'
12+
```ruby
13+
gem 'libreconv'
14+
```
1315

1416
And then execute:
1517

@@ -21,7 +23,7 @@ Or install it yourself as:
2123

2224
## Usage
2325

24-
You need to install Libreoffice or Openoffice on your system to use this gem. The code has been tested with Libreoffice 6.1.3.
26+
You need to install LibreOffice or OpenOffice on your system to use this gem. The code has been tested with LibreOffice 6.1.3.
2527

2628
```ruby
2729
require 'libreconv'
@@ -41,17 +43,23 @@ Libreconv.convert('http://myserver.com/123/document.docx', '/Users/ricn/pdf_docu
4143
Libreconv.convert('https://mybucket.s3.amazonaws.com/myserver/123/document.docx?X-Amz-Expires=456&X-Amz-Signature=abc', '/Users/ricn/pdf_documents/doc.pdf')
4244

4345
# Converts document.docx to document.pdf
44-
# If you for some reason can't have soffice in your PATH you can specifiy the file path to the soffice binary
46+
# If you for some reason can't have soffice in your PATH you can specify the file path to the soffice binary
4547
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents', '/Applications/LibreOffice.app/Contents/MacOS/soffice')
4648

4749
# Converts document.docx to my_document_as.html
4850
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents/my_document_as.html', nil, 'html')
4951

5052
# Converts document.docx to my_document_as.pdf using writer_pdf_Export filter
5153
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents/my_document_as.pdf', nil, 'pdf:writer_pdf_Export')
52-
5354
```
5455

56+
## Development
57+
58+
After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rake` to run the tests.
59+
You can also run `irb -r bundler/setup -r libreconv` for an interactive prompt that will allow you to experiment.
60+
61+
To install this gem onto your local machine, run `bundle exec rake install`.
62+
5563
## Credits
5664

5765
The following people have contributed ideas, documentation, or code to Libreconv:
@@ -69,3 +77,7 @@ The following people have contributed ideas, documentation, or code to Libreconv
6977
3. Commit your changes (`git commit -am 'Add some feature'`)
7078
4. Push to the branch (`git push origin my-new-feature`)
7179
5. Create new Pull Request
80+
81+
## License
82+
83+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)