broken_link_finder 0.9.2 → 0.9.3
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/CHANGELOG.md +9 -0
- data/Gemfile.lock +3 -3
- data/README.md +5 -2
- data/broken_link_finder.gemspec +1 -1
- data/lib/broken_link_finder/finder.rb +4 -4
- data/lib/broken_link_finder/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e03d27fce04a04ff97aa40ea895b01272926915367712a865787cda0efc3a0a
|
4
|
+
data.tar.gz: 487abab06c5664fb4024e58c7e1ba43209d076100d5d7da275db2f534aee4c4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b90b76061107fcde9b79e6b737710ee067be255182bdd7726ba2343aa64f0357b9901217f78cd0e3928244610cb9ad37007db8d316bbbef2a50355213d5764b
|
7
|
+
data.tar.gz: 5d727113d883f94e263933c726ea0eb0a41da343844c044d8220e042b877ac84b5c806e2f2d5570dd0dd9eb09a56f4603676b9194bc62201a01cb9fba7b14e23
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
broken_link_finder (0.9.
|
4
|
+
broken_link_finder (0.9.3)
|
5
5
|
thor (~> 0.20.3)
|
6
6
|
thread (~> 0.2.0)
|
7
|
-
wgit (~> 0.4.
|
7
|
+
wgit (~> 0.4.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
addressable (>= 2.3.6)
|
44
44
|
crack (>= 0.3.2)
|
45
45
|
hashdiff (>= 0.4.0, < 2.0.0)
|
46
|
-
wgit (0.4.
|
46
|
+
wgit (0.4.1)
|
47
47
|
addressable (~> 2.6.0)
|
48
48
|
mongo (~> 2.9.0)
|
49
49
|
nokogiri (~> 1.10.3)
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ Simply point it at a website and it will crawl all of its webpages searching for
|
|
8
8
|
|
9
9
|
Any HTML page element with a `href` or `src` attribute is considered a link. For each link on a given page, any of the following conditions constitutes that the link is broken:
|
10
10
|
|
11
|
-
- A response status code of `404 Not Found` is returned.
|
12
11
|
- An empty HTML response body is returned.
|
12
|
+
- A response status code of `404 Not Found` is returned.
|
13
13
|
- The HTML response body doesn't contain an element ID matching that of the link's anchor e.g. `http://server.com#about` must contain an element with `id="about"` or the link is considered broken.
|
14
14
|
- The link redirects more than 5 times consecutively.
|
15
15
|
|
@@ -123,9 +123,12 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
123
123
|
|
124
124
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
125
125
|
|
126
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
126
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
127
|
+
|
128
|
+
To release a new gem version:
|
127
129
|
- Update the version number in `version.rb` and add the new version to the `CHANGELOG`
|
128
130
|
- Run `bundle install`
|
129
131
|
- Run `bundle exec rake test` ensuring all tests pass
|
130
132
|
- Run `bundle exec rake compile` ensuring no warnings
|
133
|
+
- Run `bundle exec rake install && rbenv rehash` and manually test the executable
|
131
134
|
- Run `bundle exec rake release[origin]`
|
data/broken_link_finder.gemspec
CHANGED
@@ -44,7 +44,7 @@ module BrokenLinkFinder
|
|
44
44
|
clear_links
|
45
45
|
|
46
46
|
url = url.to_url
|
47
|
-
doc = @crawler.
|
47
|
+
doc = @crawler.crawl(url)
|
48
48
|
|
49
49
|
# Ensure the given page url is valid.
|
50
50
|
raise "Invalid or broken URL: #{url}" unless doc
|
@@ -129,8 +129,8 @@ module BrokenLinkFinder
|
|
129
129
|
link_doc = crawl_link(doc, link)
|
130
130
|
|
131
131
|
# Determine if the crawled link is broken or not.
|
132
|
-
if
|
133
|
-
|
132
|
+
if link_doc.nil? ||
|
133
|
+
@crawler.last_response.code == 404 ||
|
134
134
|
has_broken_anchor(link_doc)
|
135
135
|
append_broken_link(doc.url, link)
|
136
136
|
else
|
@@ -156,7 +156,7 @@ module BrokenLinkFinder
|
|
156
156
|
# Makes the link absolute and crawls it, returning its Wgit::Document.
|
157
157
|
def crawl_link(doc, link)
|
158
158
|
link = get_absolute_link(doc, link)
|
159
|
-
@crawler.
|
159
|
+
@crawler.crawl(link)
|
160
160
|
end
|
161
161
|
|
162
162
|
# Returns the link in absolute form so it can be crawled.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: broken_link_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Telford
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.4.
|
131
|
+
version: 0.4.1
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.4.
|
138
|
+
version: 0.4.1
|
139
139
|
description: Finds a website's broken links using the 'wgit' gem and reports back
|
140
140
|
to you with a summary.
|
141
141
|
email: michael.telford@live.com
|