pdf_tools 0.1.0 → 0.1.2
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 +4 -4
- data/.github/workflows/rubocop.yml +21 -0
- data/.rubocop.yml +22 -0
- data/.ruby-version +1 -1
- data/.travis.yml +9 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +35 -4
- data/README.md +5 -3
- data/Rakefile +1 -1
- data/gemfiles/rubocop.gemfile +3 -0
- data/lib/pdf_tools/shell.rb +3 -3
- data/lib/pdf_tools/tool/image_to_pdf.rb +1 -1
- data/lib/pdf_tools/tool/merge_split.rb +1 -1
- data/lib/pdf_tools/tool.rb +13 -13
- data/lib/pdf_tools/version.rb +3 -1
- data/lib/pdf_tools.rb +4 -2
- data/pdf_tools.gemspec +19 -19
- metadata +12 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfb9fa8f5e36d333d2474a11072af90978df404b600b22cf5e1cc0843e608fa5
|
|
4
|
+
data.tar.gz: b0958ca6b81ea829a9d5ac3445e2757c64d11461277d3788434bf2a29591ad91
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9888b2221a07d203f49d88cb5d1c7f67f5a75db904e41aea86705e3351db1e8575b3760f75581209c14112b8a9f7381a0bac867bc2485ba9d18b4a86fe4c652
|
|
7
|
+
data.tar.gz: 256f6c26ffd36e569f3d28c2e46984e62aac7ddc002791021642f4df20187dfa71fb8adacbb088d24472723c566a9e4243e61130097052b433ac711134b88290
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: RuboCop
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
rubocop:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
- uses: ruby/setup-ruby@v1
|
|
15
|
+
with:
|
|
16
|
+
ruby-version: 2.7
|
|
17
|
+
- name: Lint Ruby code with RuboCop
|
|
18
|
+
run: |
|
|
19
|
+
gem install bundler
|
|
20
|
+
bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
|
|
21
|
+
bundle exec --gemfile gemfiles/rubocop.gemfile rubocop
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require:
|
|
2
|
+
- standard/cop/block_single_line_braces
|
|
3
|
+
|
|
4
|
+
inherit_gem:
|
|
5
|
+
standard: config/base.yml
|
|
6
|
+
|
|
7
|
+
AllCops:
|
|
8
|
+
TargetRubyVersion: 2.6
|
|
9
|
+
|
|
10
|
+
Layout/LineLength:
|
|
11
|
+
Max: 120
|
|
12
|
+
|
|
13
|
+
Metrics/ModuleLength:
|
|
14
|
+
Exclude:
|
|
15
|
+
- "**/*_spec.rb"
|
|
16
|
+
|
|
17
|
+
Metrics/BlockLength:
|
|
18
|
+
Exclude:
|
|
19
|
+
- "**/*_spec.rb"
|
|
20
|
+
|
|
21
|
+
Style/MissingRespondToMissing:
|
|
22
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.7.6
|
data/.travis.yml
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
sudo: false
|
|
3
|
+
env:
|
|
4
|
+
global:
|
|
5
|
+
- CC_TEST_REPORTER_ID=00d85edb6dc560b7f4e05191be8969963f6b27cef854239cf1e6b7c23b3309e0
|
|
3
6
|
language: ruby
|
|
4
7
|
rvm:
|
|
5
8
|
- 2.5.3
|
|
9
|
+
before_script:
|
|
10
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
11
|
+
- chmod +x ./cc-test-reporter
|
|
12
|
+
- ./cc-test-reporter before-build
|
|
6
13
|
script:
|
|
7
14
|
- bundle exec rspec
|
|
15
|
+
after_script:
|
|
16
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
|
8
17
|
before_install: gem install bundler -v 2.0.2
|
|
9
18
|
branches:
|
|
10
19
|
only:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
pdf_tools (0.1.
|
|
4
|
+
pdf_tools (0.1.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
+
ast (2.4.2)
|
|
9
10
|
coderay (1.1.2)
|
|
10
11
|
diff-lcs (1.3)
|
|
11
12
|
docile (1.3.2)
|
|
13
|
+
json (2.6.3)
|
|
14
|
+
language_server-protocol (3.17.0.3)
|
|
12
15
|
method_source (0.9.2)
|
|
16
|
+
parallel (1.22.1)
|
|
17
|
+
parser (3.2.1.1)
|
|
18
|
+
ast (~> 2.4.1)
|
|
13
19
|
pry (0.12.2)
|
|
14
20
|
coderay (~> 1.1.0)
|
|
15
21
|
method_source (~> 0.9.0)
|
|
16
|
-
|
|
22
|
+
rainbow (3.1.1)
|
|
23
|
+
rake (13.0.1)
|
|
24
|
+
regexp_parser (2.7.0)
|
|
25
|
+
rexml (3.2.5)
|
|
17
26
|
rspec (3.9.0)
|
|
18
27
|
rspec-core (~> 3.9.0)
|
|
19
28
|
rspec-expectations (~> 3.9.0)
|
|
@@ -27,10 +36,31 @@ GEM
|
|
|
27
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
28
37
|
rspec-support (~> 3.9.0)
|
|
29
38
|
rspec-support (3.9.2)
|
|
39
|
+
rubocop (1.44.1)
|
|
40
|
+
json (~> 2.3)
|
|
41
|
+
parallel (~> 1.10)
|
|
42
|
+
parser (>= 3.2.0.0)
|
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
44
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
45
|
+
rexml (>= 3.2.5, < 4.0)
|
|
46
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
|
47
|
+
ruby-progressbar (~> 1.7)
|
|
48
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
49
|
+
rubocop-ast (1.27.0)
|
|
50
|
+
parser (>= 3.2.1.0)
|
|
51
|
+
rubocop-performance (1.15.2)
|
|
52
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
53
|
+
rubocop-ast (>= 0.4.0)
|
|
54
|
+
ruby-progressbar (1.13.0)
|
|
30
55
|
simplecov (0.18.5)
|
|
31
56
|
docile (~> 1.1)
|
|
32
57
|
simplecov-html (~> 0.11)
|
|
33
58
|
simplecov-html (0.12.2)
|
|
59
|
+
standard (1.24.3)
|
|
60
|
+
language_server-protocol (~> 3.17.0.2)
|
|
61
|
+
rubocop (= 1.44.1)
|
|
62
|
+
rubocop-performance (= 1.15.2)
|
|
63
|
+
unicode-display_width (2.4.2)
|
|
34
64
|
|
|
35
65
|
PLATFORMS
|
|
36
66
|
ruby
|
|
@@ -39,9 +69,10 @@ DEPENDENCIES
|
|
|
39
69
|
bundler (>= 1.17)
|
|
40
70
|
pdf_tools!
|
|
41
71
|
pry
|
|
42
|
-
rake (
|
|
72
|
+
rake (>= 12.3.3)
|
|
43
73
|
rspec (~> 3.7)
|
|
44
74
|
simplecov
|
|
75
|
+
standard (~> 1.0)!
|
|
45
76
|
|
|
46
77
|
BUNDLED WITH
|
|
47
|
-
2.
|
|
78
|
+
2.4.7
|
data/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
[](https://badge.fury.io/rb/pdf_tools)
|
|
2
|
+
[](https://travis-ci.org/ldrner/pdf_tools)
|
|
3
|
+
[](https://codeclimate.com/github/ldrner/pdf_tools/maintainability)
|
|
4
|
+
[](https://codeclimate.com/github/ldrner/pdf_tools/test_coverage)
|
|
5
|
+
|
|
2
6
|
|
|
3
7
|
# PdfTools
|
|
4
8
|
|
|
5
9
|
Ruby wrapper for the PDF Tools command-line utils.
|
|
6
10
|
[https://www.pdf-tools.com/](https://www.pdf-tools.com/)
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
12
14
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
data/lib/pdf_tools/shell.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "open3"
|
|
4
4
|
|
|
5
5
|
module PdfTools
|
|
6
6
|
# Send commands to the shell
|
|
@@ -9,7 +9,7 @@ module PdfTools
|
|
|
9
9
|
stdout, stderr, status = execute(command)
|
|
10
10
|
|
|
11
11
|
if status != 0
|
|
12
|
-
raise PdfTools::Error, "Command `#{command.join(
|
|
12
|
+
raise PdfTools::Error, "Command `#{command.join(" ")}` failed!\n Error: #{stderr}"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
$stderr.print(stderr) unless options[:stderr] == false
|
|
@@ -29,7 +29,7 @@ module PdfTools
|
|
|
29
29
|
|
|
30
30
|
[stdout, stderr, status.exitstatus]
|
|
31
31
|
rescue Errno::ENOENT, IOError
|
|
32
|
-
[
|
|
32
|
+
["", "executable not found: \"#{command.first}\"", 127]
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
data/lib/pdf_tools/tool.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "pdf_tools/shell"
|
|
4
4
|
|
|
5
5
|
module PdfTools
|
|
6
6
|
# Abstract class that wraps command-line tools.
|
|
@@ -37,8 +37,8 @@ module PdfTools
|
|
|
37
37
|
attr_reader :name, :args
|
|
38
38
|
|
|
39
39
|
def initialize(name)
|
|
40
|
-
@name
|
|
41
|
-
@args
|
|
40
|
+
@name = name
|
|
41
|
+
@args = []
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Build and execute the command.
|
|
@@ -111,9 +111,9 @@ module PdfTools
|
|
|
111
111
|
# tool << 'image.jpg'
|
|
112
112
|
# tool << 'output.pdf'
|
|
113
113
|
KEY_VALUE_OPTIONS.each do |option|
|
|
114
|
-
define_method(option.
|
|
115
|
-
hash.flat_map { |k, v| ["-#{option}", [k.capitalize, "\"#{v}\""].join(
|
|
116
|
-
|
|
114
|
+
define_method(option.tr("-", "_")) do |hash = {}|
|
|
115
|
+
hash.flat_map { |k, v| ["-#{option}", [k.capitalize, "\"#{v}\""].join("=")] }
|
|
116
|
+
.each { |el| self << el }
|
|
117
117
|
self
|
|
118
118
|
end
|
|
119
119
|
end
|
|
@@ -126,22 +126,22 @@ module PdfTools
|
|
|
126
126
|
# licmgr << "your license key"
|
|
127
127
|
# licmgr.command #=> ["licmgr", "info", "your license key"]
|
|
128
128
|
def method_missing(name, *args)
|
|
129
|
-
option = "-#{name.to_s.tr(
|
|
129
|
+
option = "-#{name.to_s.tr("_", "-")}"
|
|
130
130
|
self << option
|
|
131
|
-
|
|
131
|
+
merge!(args)
|
|
132
132
|
self
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def self.available_options
|
|
136
136
|
tool = new
|
|
137
|
-
tool <<
|
|
137
|
+
tool << "-version"
|
|
138
138
|
|
|
139
139
|
help_page = tool.call(stderr: false)
|
|
140
|
-
available_options = help_page.scan(/^\s+-[a-z
|
|
141
|
-
available_options.map { |o| o[1
|
|
140
|
+
available_options = help_page.scan(/^\s+-[a-z-]+/).map(&:strip)
|
|
141
|
+
available_options.map { |o| o[1..].tr("-", "_") }
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
require
|
|
147
|
-
require
|
|
146
|
+
require "pdf_tools/tool/image_to_pdf"
|
|
147
|
+
require "pdf_tools/tool/merge_split"
|
data/lib/pdf_tools/version.rb
CHANGED
data/lib/pdf_tools.rb
CHANGED
data/pdf_tools.gemspec
CHANGED
|
@@ -5,32 +5,32 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
require "pdf_tools/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name
|
|
9
|
-
spec.version
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
8
|
+
spec.name = "pdf_tools"
|
|
9
|
+
spec.version = PdfTools::VERSION
|
|
10
|
+
spec.authors = ["Ilya K."]
|
|
11
|
+
spec.email = ["ldrner@gmail.com"]
|
|
12
12
|
|
|
13
|
-
spec.summary
|
|
14
|
-
spec.description
|
|
15
|
-
spec.homepage
|
|
16
|
-
spec.license
|
|
13
|
+
spec.summary = "Ruby wrapper for the PDF Tools command-line utils"
|
|
14
|
+
spec.description = "Ruby wrapper for the PDF Tools command-line utils. https://www.pdf-tools.com/"
|
|
15
|
+
spec.homepage = "https://github.com/ldrner/pdf_tools"
|
|
16
|
+
spec.license = "MIT"
|
|
17
17
|
|
|
18
18
|
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
19
19
|
|
|
20
|
-
spec.metadata[
|
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
21
21
|
# spec.metadata['source_code_uri'] = "TODO: Put your gem's public repo URL here."
|
|
22
22
|
# spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
23
23
|
|
|
24
|
-
spec.executables
|
|
25
|
-
spec.files
|
|
26
|
-
spec.bindir
|
|
24
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
spec.bindir = "bin"
|
|
27
27
|
|
|
28
|
-
spec.require_paths = [
|
|
29
|
-
spec.required_ruby_version =
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
spec.required_ruby_version = ">= 2.7.0"
|
|
30
30
|
|
|
31
|
-
spec.add_development_dependency
|
|
32
|
-
spec.add_development_dependency
|
|
33
|
-
spec.add_development_dependency
|
|
34
|
-
spec.add_development_dependency
|
|
35
|
-
spec.add_development_dependency
|
|
31
|
+
spec.add_development_dependency "bundler", ">= 1.17"
|
|
32
|
+
spec.add_development_dependency "pry"
|
|
33
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.7"
|
|
35
|
+
spec.add_development_dependency "simplecov"
|
|
36
36
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pdf_tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ilya K.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -42,16 +42,16 @@ dependencies:
|
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 12.3.3
|
|
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
|
-
version:
|
|
54
|
+
version: 12.3.3
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -89,8 +89,10 @@ executables:
|
|
|
89
89
|
extensions: []
|
|
90
90
|
extra_rdoc_files: []
|
|
91
91
|
files:
|
|
92
|
+
- ".github/workflows/rubocop.yml"
|
|
92
93
|
- ".gitignore"
|
|
93
94
|
- ".rspec"
|
|
95
|
+
- ".rubocop.yml"
|
|
94
96
|
- ".ruby-version"
|
|
95
97
|
- ".travis.yml"
|
|
96
98
|
- Gemfile
|
|
@@ -100,6 +102,7 @@ files:
|
|
|
100
102
|
- Rakefile
|
|
101
103
|
- bin/console
|
|
102
104
|
- bin/setup
|
|
105
|
+
- gemfiles/rubocop.gemfile
|
|
103
106
|
- lib/pdf_tools.rb
|
|
104
107
|
- lib/pdf_tools/shell.rb
|
|
105
108
|
- lib/pdf_tools/tool.rb
|
|
@@ -118,17 +121,16 @@ require_paths:
|
|
|
118
121
|
- lib
|
|
119
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
123
|
requirements:
|
|
121
|
-
- - "
|
|
124
|
+
- - ">="
|
|
122
125
|
- !ruby/object:Gem::Version
|
|
123
|
-
version:
|
|
126
|
+
version: 2.7.0
|
|
124
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
128
|
requirements:
|
|
126
129
|
- - ">="
|
|
127
130
|
- !ruby/object:Gem::Version
|
|
128
131
|
version: '0'
|
|
129
132
|
requirements: []
|
|
130
|
-
|
|
131
|
-
rubygems_version: 2.7.6
|
|
133
|
+
rubygems_version: 3.1.6
|
|
132
134
|
signing_key:
|
|
133
135
|
specification_version: 4
|
|
134
136
|
summary: Ruby wrapper for the PDF Tools command-line utils
|