fillable-pdf 0.9.0 → 0.9.1

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
  SHA256:
3
- metadata.gz: 4c6c8de9fa4ada4510bb7107e520ce0d32a6723888d30aba6d76e4e398e544cf
4
- data.tar.gz: cade4f5c56cca602d963121aa7f5bd4291c30f5d8f7ef4247b26af01168d1f40
3
+ metadata.gz: 998124f748072a08e1a2f98593b85ba4297952c414bb800c7f05df607d76d1a7
4
+ data.tar.gz: d9f16c8942b1c167b476bcc5c630724f631c40285fe05cae20894d542b2daeb7
5
5
  SHA512:
6
- metadata.gz: 9c09781488b61c8d77d0b08ce978a17d6fb0f124b22bfbb38a278973e78aaabbf8dd746e2a6c253d83e498ad045623f4662563bbd63254d004b668e120b2928a
7
- data.tar.gz: 94f466d2a1af9f91d8262e3b84c482a8bda5dc2ff122fa58aa168592b93314954bfce1f8c5f454e8d38e8a1b0f0b1e5d921251703bd96cab3e0602e321d90761
6
+ metadata.gz: 8e864663a4319fc61ee01448839615ab6125960c5e7a4a39585baa0ce14a339701b748332ffe7dd35bcf7a69fbcc271435e883ee8be86438b818d00d8a034595
7
+ data.tar.gz: 485287c89ed9073a01b97afc72d1ab96eec27b2024891c90b69fb2243d25409b14b22b76046ec0fcd2b4b2ed27262b8752f9d0037baff3bcf7a7004617ac83a3
@@ -1,7 +1,10 @@
1
1
  require:
2
+ - rubocop-minitest
2
3
  - rubocop-performance
4
+ - rubocop-rake
3
5
 
4
6
  AllCops:
7
+ NewCops: enable
5
8
  Exclude:
6
9
  - .git/**/*
7
10
 
@@ -16,6 +19,9 @@ Layout/LineLength:
16
19
  Layout/SpaceInsideHashLiteralBraces:
17
20
  Enabled: false
18
21
 
22
+ Metrics/MethodLength:
23
+ Max: 12
24
+
19
25
  Naming/AccessorMethodName:
20
26
  Enabled: false
21
27
 
@@ -3,8 +3,8 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.6.4
6
+ - 3.0.0
7
7
  jdk:
8
8
  - openjdk8
9
9
  before_install:
10
- - gem install bundler -v 2.0.2
10
+ - gem install bundler
data/README.md CHANGED
@@ -6,6 +6,18 @@
6
6
 
7
7
  FillablePDF is an extremely simple and lightweight utility that bridges iText and Ruby in order to fill out fillable PDF forms or extract field values from previously filled out PDF forms.
8
8
 
9
+ ## Known Issues
10
+
11
+ If the gem hangs in `development`, removing the following gems may fix the issue:
12
+
13
+ ```ruby
14
+ gem 'spring'
15
+ gem 'spring-watcher-listen'
16
+ ```
17
+
18
+ If the gem hangs in `production`, you could try to use `puma` with a reverse proxy to host the application.
19
+
20
+
9
21
  ## Installation
10
22
 
11
23
  **Ensure that your `JAVA_HOME` variable is set before installing this gem (see examples below).**
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
+ require 'rubocop/rake_task'
3
4
 
4
5
  Rake::TestTask.new(:test) do |t|
5
6
  t.libs << 'test'
@@ -7,4 +8,6 @@ Rake::TestTask.new(:test) do |t|
7
8
  t.test_files = FileList['test/**/*_test.rb']
8
9
  end
9
10
 
10
- task default: :test
11
+ RuboCop::RakeTask.new
12
+
13
+ task default: %i[test rubocop]
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'FillablePDF is an extremely simple and lightweight utility that bridges iText and Ruby in order to fill out fillable PDF forms or extract field values from previously filled out PDF forms.'
13
13
  spec.homepage = 'https://github.com/vkononov/fillable-pdf'
14
14
  spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
15
16
 
16
17
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
18
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(example|test|spec|features)/}) }
@@ -20,9 +21,14 @@ Gem::Specification.new do |spec|
20
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
22
  spec.require_paths = %w[ext lib]
22
23
 
23
- spec.add_development_dependency 'bundler', '~> 2.0'
24
- spec.add_development_dependency 'minitest', '~> 5.0'
25
- spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'minitest'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rubocop'
28
+ spec.add_development_dependency 'rubocop-md'
29
+ spec.add_development_dependency 'rubocop-minitest'
30
+ spec.add_development_dependency 'rubocop-performance'
31
+ spec.add_development_dependency 'rubocop-rake'
26
32
 
27
33
  spec.add_runtime_dependency 'rjb', '~> 1.6'
28
34
  end
@@ -6,10 +6,10 @@ class Field
6
6
  # between these constants and tries to create the same constant ("A") for both, which causes
7
7
  # an annoying warning "already initialized constant Rjb::Com_itextpdf_kernel_pdf_PdfName::A".
8
8
  # As long as RJB has not fixed this issue, this warning will remain suppressed.
9
- suppress_warnings { PDF_NAME = Rjb.import('com.itextpdf.kernel.pdf.PdfName') }
9
+ suppress_warnings { PDF_NAME = Rjb.import('com.itextpdf.kernel.pdf.PdfName') } # rubocop:disable Lint/ConstantDefinitionInBlock
10
10
 
11
11
  BUTTON = PDF_NAME.Btn.toString
12
12
  CHOICE = PDF_NAME.Ch.toString
13
13
  SIGNATURE = PDF_NAME.Sig.toString
14
14
  TEXT = PDF_NAME.Tx.toString
15
- end
15
+ end
@@ -1,5 +1,6 @@
1
1
  require_relative 'fillable-pdf/itext'
2
2
  require_relative 'field'
3
+ require 'fileutils'
3
4
  require 'securerandom'
4
5
 
5
6
  class FillablePDF
@@ -26,8 +27,8 @@ class FillablePDF
26
27
  @pdf_doc = PDF_DOCUMENT.new @pdf_reader, @pdf_writer
27
28
  @pdf_form = PDF_ACRO_FORM.getAcroForm(@pdf_doc, true)
28
29
  @form_fields = @pdf_form.getFormFields
29
- rescue StandardError => ex
30
- raise "#{ex.message} (input file may be corrupt, incompatible, or may not have any forms)"
30
+ rescue StandardError => e
31
+ raise "#{e.message} (input file may be corrupt, incompatible, or may not have any forms)"
31
32
  end
32
33
  end
33
34
 
@@ -158,7 +159,7 @@ class FillablePDF
158
159
  def save(flatten: false)
159
160
  tmp_file = SecureRandom.uuid
160
161
  save_as(tmp_file, flatten: flatten)
161
- File.rename tmp_file, @file_path
162
+ FileUtils.mv tmp_file, @file_path
162
163
  end
163
164
 
164
165
  ##
@@ -1,3 +1,3 @@
1
1
  class FillablePDF
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
@@ -6,4 +6,4 @@ module Kernel
6
6
  $VERBOSE = original_verbosity
7
7
  result
8
8
  end
9
- end
9
+ end
metadata CHANGED
@@ -1,57 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fillable-pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Kononov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-25 00:00:00.000000000 Z
11
+ date: 2020-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '0'
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: '5.0'
40
+ version: '0'
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
- version: '10.0'
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
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-md
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-performance
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
53
109
  - !ruby/object:Gem::Version
54
- version: '10.0'
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
55
125
  - !ruby/object:Gem::Dependency
56
126
  name: rjb
57
127
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +171,7 @@ homepage: https://github.com/vkononov/fillable-pdf
101
171
  licenses:
102
172
  - MIT
103
173
  metadata: {}
104
- post_install_message:
174
+ post_install_message:
105
175
  rdoc_options: []
106
176
  require_paths:
107
177
  - ext
@@ -110,15 +180,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
180
  requirements:
111
181
  - - ">="
112
182
  - !ruby/object:Gem::Version
113
- version: '0'
183
+ version: 2.4.0
114
184
  required_rubygems_version: !ruby/object:Gem::Requirement
115
185
  requirements:
116
186
  - - ">="
117
187
  - !ruby/object:Gem::Version
118
188
  version: '0'
119
189
  requirements: []
120
- rubygems_version: 3.1.2
121
- signing_key:
190
+ rubygems_version: 3.2.3
191
+ signing_key:
122
192
  specification_version: 4
123
193
  summary: Fill out or extract field values from simple fillable PDF forms using iText.
124
194
  test_files: []