pdf_tools 0.1.1 → 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 +11 -2
- data/.ruby-version +1 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +33 -2
- 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 +1 -1
- data/lib/pdf_tools.rb +2 -2
- data/pdf_tools.gemspec +21 -21
- metadata +7 -6
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
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
require:
|
2
|
+
- standard/cop/block_single_line_braces
|
3
|
+
|
4
|
+
inherit_gem:
|
5
|
+
standard: config/base.yml
|
6
|
+
|
1
7
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
8
|
+
TargetRubyVersion: 2.6
|
3
9
|
|
4
10
|
Layout/LineLength:
|
5
11
|
Max: 120
|
@@ -10,4 +16,7 @@ Metrics/ModuleLength:
|
|
10
16
|
|
11
17
|
Metrics/BlockLength:
|
12
18
|
Exclude:
|
13
|
-
- "**/*_spec.rb"
|
19
|
+
- "**/*_spec.rb"
|
20
|
+
|
21
|
+
Style/MissingRespondToMissing:
|
22
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.6
|
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)
|
22
|
+
rainbow (3.1.1)
|
16
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
|
@@ -42,6 +72,7 @@ DEPENDENCIES
|
|
42
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/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
@@ -1,36 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
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
|
@@ -89,6 +89,7 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- ".github/workflows/rubocop.yml"
|
92
93
|
- ".gitignore"
|
93
94
|
- ".rspec"
|
94
95
|
- ".rubocop.yml"
|
@@ -101,6 +102,7 @@ files:
|
|
101
102
|
- Rakefile
|
102
103
|
- bin/console
|
103
104
|
- bin/setup
|
105
|
+
- gemfiles/rubocop.gemfile
|
104
106
|
- lib/pdf_tools.rb
|
105
107
|
- lib/pdf_tools/shell.rb
|
106
108
|
- lib/pdf_tools/tool.rb
|
@@ -119,17 +121,16 @@ require_paths:
|
|
119
121
|
- lib
|
120
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
123
|
requirements:
|
122
|
-
- - "
|
124
|
+
- - ">="
|
123
125
|
- !ruby/object:Gem::Version
|
124
|
-
version: 2.
|
126
|
+
version: 2.7.0
|
125
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
128
|
requirements:
|
127
129
|
- - ">="
|
128
130
|
- !ruby/object:Gem::Version
|
129
131
|
version: '0'
|
130
132
|
requirements: []
|
131
|
-
|
132
|
-
rubygems_version: 2.7.6
|
133
|
+
rubygems_version: 3.1.6
|
133
134
|
signing_key:
|
134
135
|
specification_version: 4
|
135
136
|
summary: Ruby wrapper for the PDF Tools command-line utils
|