broken_link_finder 0.3.0 → 0.4.0

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: 0f89fd142f329ee9b5df8de5a01abd2976cab0b16a690e50d98a0775a94eb937
4
- data.tar.gz: 81e1db2b0a7f2e76e0113b4086fea5a41a6bca6b8f51d79d849007fe73fb3c34
3
+ metadata.gz: 00dd2be1d5bc9a2fe1d6c94a66a27dc29844aa986b9742328135b70ed490e289
4
+ data.tar.gz: 72669b20d0a080254b1e6481cb08887126aed78f37c138f6d3658c696c719fae
5
5
  SHA512:
6
- metadata.gz: d8d9d745fdd025ce30a6c082730b878deb409bd7342d82f63dfbffbbecb5fa75f4ddadea2acace87904255199cb32b53277662d573534079d7d6575d2e80e03b
7
- data.tar.gz: 813926476b8fed62c28a46decbff72018134f547f1618dd28418d6ea31f55bbc55bd43d0cd47bfc36fd8a476e0d65f4dd21d31d6bd79aeb3317d5282bbe9c46b
6
+ metadata.gz: c21b88afb280842f4fc72723a1dbfca6cd80cd8a3d821bff53b385bc793c009fe02c5e58c3feeb836b86f867014ca468037a3d863b6b50cf1833af29327c15f9
7
+ data.tar.gz: b471806008dafff72fd66994cc95c5622314115faaf939c739bd2f09c1d8055b6abcdc3507530821f93787678d0c52b91f25c727e6f4061d1e281afc4a27c31d
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- broken_link_finder (0.3.0)
4
+ broken_link_finder (0.4.0)
5
+ thor (= 0.20.3)
5
6
  thread (= 0.2)
6
7
  wgit (= 0.0.9)
7
8
 
@@ -29,6 +30,7 @@ GEM
29
30
  public_suffix (3.1.0)
30
31
  rake (10.5.0)
31
32
  safe_yaml (1.0.5)
33
+ thor (0.20.3)
32
34
  thread (0.2.0)
33
35
  webmock (3.5.1)
34
36
  addressable (>= 2.3.6)
data/README.md CHANGED
@@ -26,7 +26,19 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
- Below is a simple script which crawls a website and outputs its broken links to STDOUT.
29
+ ### Executable
30
+
31
+ Installing this gem installs the `broken_link_finder` executable into your `$PATH`. The executable allows you to find broken links from your command line. For example:
32
+
33
+ $ broken_link_finder crawl http://txti.es
34
+
35
+ Adding the `-r` switch would crawl the entire txti.es site, not just it's index page.
36
+
37
+ See the [output](##Output) section below for an example of a site with broken links.
38
+
39
+ ### Library
40
+
41
+ Below is a simple script which crawls a website and outputs it's broken links to `STDOUT`.
30
42
 
31
43
  > main.rb
32
44
 
@@ -42,7 +54,9 @@ Then execute the script with:
42
54
 
43
55
  $ ruby main.rb
44
56
 
45
- If broken links are found then the output should look something like:
57
+ ## Output
58
+
59
+ If broken links are found then the output will look something like:
46
60
 
47
61
  ```text
48
62
  Below is a breakdown of the different pages and their broken links...
@@ -60,7 +74,6 @@ http://imgur.com
60
74
 
61
75
  ## TODO
62
76
 
63
- - Create a `broken_link_finder` executable.
64
77
  - Add logger functionality (especially useful in the console during development).
65
78
 
66
79
  ## Development
@@ -29,9 +29,10 @@ Gem::Specification.new do |spec|
29
29
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
30
30
  f.match(%r{^(test|spec|features)/})
31
31
  end
32
- spec.bindir = "bin"
33
- # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
32
+ spec.bindir = "exe"
33
+ spec.executables = ["broken_link_finder"]
34
34
  spec.require_paths = ["lib"]
35
+ spec.post_install_message = "Added the executable 'broken_link_finder' to $PATH"
35
36
 
36
37
  spec.required_ruby_version = '~> 2.5' # Only works with ruby 2.5.x
37
38
 
@@ -44,4 +45,5 @@ Gem::Specification.new do |spec|
44
45
 
45
46
  spec.add_runtime_dependency "wgit", "0.0.9"
46
47
  spec.add_runtime_dependency "thread", "0.2"
48
+ spec.add_runtime_dependency "thor", "0.20.3"
47
49
  end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
4
+ require 'broken_link_finder'
5
+ require 'thor'
6
+
7
+ class BrokenLinkFinderCLI < Thor
8
+ desc 'crawl [URL]', 'Find broken links at the URL'
9
+ option :recursive, type: :boolean, aliases: [:r], desc: 'Crawl the entire site'
10
+ def crawl(url)
11
+ url = "http://#{url}" unless url.start_with?('http')
12
+ finder = BrokenLinkFinder::Finder.new
13
+ options[:recursive] ? finder.crawl_site(url) : finder.crawl_page(url)
14
+ finder.pretty_print_broken_links
15
+ end
16
+ end
17
+
18
+ BrokenLinkFinderCLI.start(ARGV)
@@ -1,3 +1,3 @@
1
1
  module BrokenLinkFinder
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Telford
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,10 +122,25 @@ dependencies:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: thor
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.20.3
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.20.3
125
139
  description: Finds a website's broken links using the 'wgit' gem and reports back
126
140
  to you with a summary.
127
141
  email: michael.telford@live.com
128
- executables: []
142
+ executables:
143
+ - broken_link_finder
129
144
  extensions: []
130
145
  extra_rdoc_files: []
131
146
  files:
@@ -140,6 +155,7 @@ files:
140
155
  - bin/console
141
156
  - bin/setup
142
157
  - broken_link_finder.gemspec
158
+ - exe/broken_link_finder
143
159
  - lib/broken_link_finder.rb
144
160
  - lib/broken_link_finder/finder.rb
145
161
  - lib/broken_link_finder/version.rb
@@ -150,7 +166,7 @@ licenses:
150
166
  metadata:
151
167
  source_code_uri: https://github.com/michaeltelford/broken-link-finder
152
168
  allowed_push_host: https://rubygems.org
153
- post_install_message:
169
+ post_install_message: Added the executable 'broken_link_finder' to $PATH
154
170
  rdoc_options: []
155
171
  require_paths:
156
172
  - lib