pdf_links_checker 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 244603c961f81cca8061c369527ea98836af422cc46045cae57ce420cc3d49c5
4
- data.tar.gz: a8a5158995e37b40d9d0180a43a9a8196f93b30a927ae5c9fba22b726778ee59
3
+ metadata.gz: ce8e50b31b32e8b7fc0a62dc7b3b3fc8818e54e1e86aef62394f303338e9be03
4
+ data.tar.gz: ceb5be089c2c35581b6f32106212be5abb19893ab7ac08416b9ac66953320136
5
5
  SHA512:
6
- metadata.gz: 94501c39b1043b98acfd2a65ceb23fe5d6438c1f889e0f6b90624cb2eb1df23b23203489871a1665e5787686210793835b2489c23b5d87ca513442c05f9b4266
7
- data.tar.gz: f8587232058d13e9c9101c65549da9cc4323f4eafb45791c27d1bdc03f1f26344a3a53d8925022682f0fd6a50366fe4842369fcfbf9ae0d0c762f21480fe4cad
6
+ metadata.gz: ff2ff91b47790616b9dea5e2c2af1731ce7a146055bba6c44330583b0fb0c5b61136dae8ec454ec492f870d2a8217b486fb54609a24bcc1b3cc7b805756d509c
7
+ data.tar.gz: cb911c257a974dbcf383e1f68542a280b70ff7467739354035e2d1b6c5713a54d09d4183197a3ce7f946191d94caf49e6924fc9869c34a4e1c5fd2cc045349ad
data/README.md CHANGED
@@ -1,28 +1,27 @@
1
- # PdfLinksChecker
1
+ # PDF Links Checker
2
2
 
3
3
  [![Build Status](https://travis-ci.org/AndyWendt/pdf_links_checker.svg?branch=master)](https://travis-ci.org/AndyWendt/pdf_links_checker)
4
4
 
5
- TODO: describe
5
+ A utility to ensure that links in PDFs are reachable
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ $ gem install pdf_links_checker
10
10
 
11
- ```ruby
12
- gem 'pdf_links_checker'
13
- ```
11
+ ## Usage
14
12
 
15
- And then execute:
13
+ Commandline:
16
14
 
17
- $ bundle install
15
+ $ pdf_links_checker path/to/file.pdf`
16
+ Working links: 1 of 2
17
+ https://not-a-chance-that-this-is-a-working-link.com/
18
18
 
19
- Or install it yourself as:
19
+ Code:
20
20
 
21
- $ gem install pdf_links_checker
22
-
23
- ## Usage
21
+ file_name = "foo.pdf"
22
+ file_path = "#{Dir.pwd}/#{file_name}"
23
+ links = PdfLinksChecker::PdfDocument.from(file_path).links
24
24
 
25
- TODO: Write usage instructions here
26
25
 
27
26
  ## Development
28
27
 
@@ -32,7 +31,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
31
 
33
32
  ## Contributing
34
33
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pdf_links_checker.
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/andywendt/pdf_links_checker.
36
35
 
37
36
 
38
37
  ## License
data/Rakefile CHANGED
@@ -9,8 +9,4 @@ Rake::TestTask.new(:test) do |t|
9
9
  t.test_files = FileList["test/**/*_test.rb"]
10
10
  end
11
11
 
12
- require "rubocop/rake_task"
13
-
14
- RuboCop::RakeTask.new
15
-
16
- task default: %i[test rubocop]
12
+ task default: %i[test]
@@ -3,16 +3,9 @@
3
3
 
4
4
  require "pdf_links_checker"
5
5
  require "pdf_links_checker/pdf_document"
6
- require "pdf-reader"
7
- require "net/http"
8
6
 
9
7
  file_name = ARGV[0]
10
8
  file_path = "#{Dir.pwd}/#{file_name}"
11
-
12
- path = File.expand_path(file_path)
13
- doc = PDF::Reader.new(path)
14
-
15
- links = PdfLinksChecker::PdfDocument.new(doc).links
16
-
9
+ links = PdfLinksChecker::PdfDocument.from(file_path).links
17
10
  puts "Working links: #{links.valid_count} of #{links.total_count}"
18
11
  links.invalid.each { |invalid_link| puts invalid_link }
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pdf_links_checker/version"
4
+ require "pdf_links_checker/pdf_document"
4
5
 
5
6
  module PdfLinksChecker
6
7
  class Error < StandardError; end
@@ -1,9 +1,17 @@
1
1
  require "pdf_links_checker/annotations"
2
2
  require "pdf_links_checker/links"
3
3
  require "pdf_links_checker/page"
4
+ require "pdf-reader"
4
5
 
5
6
  module PdfLinksChecker
6
7
  class PdfDocument
8
+ def self.from(file_path)
9
+ path = File.expand_path(file_path)
10
+ doc = PDF::Reader.new(path)
11
+
12
+ self.new(doc)
13
+ end
14
+
7
15
  def initialize(pdf_doc)
8
16
  @pdf_doc = pdf_doc
9
17
  end
@@ -1,5 +1,6 @@
1
1
  require "pdf_links_checker/invalid_link"
2
2
  require "uri"
3
+ require "net/http"
3
4
 
4
5
  module PdfLinksChecker
5
6
  class URL
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PdfLinksChecker
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_links_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Wendt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ensures links in PDFs are accessible
14
14
  email: