linkey 0.1.0 → 0.1.1
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/.travis.yml +12 -0
- data/README.md +12 -4
- data/bin/linkey +1 -4
- data/lib/linkey/javascript/snap.js +3 -3
- data/lib/linkey/ping.rb +19 -4
- data/lib/linkey/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 968870da0a318f9d9136453879f4711336f281c5
|
4
|
+
data.tar.gz: 6a65ad66c24f6277ad62a3508069a90e29d49170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 650ca4da7bbbd3814f97b8d4147f47fc17e1771dfab224a1a234b3f5ea56f63e1939039fce2a1b29f0fbe7846e579249f24e176149f23ee06084d2885b6c2622
|
7
|
+
data.tar.gz: 268556e7fc4227e2b06dbaef445c62ee23a93c9ed713fae38cad7ab5c45343d828492c7532b3ffc055fa24dd38e737e014bbb1580aa46b597569ed6dfd4e0a12
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[](https://travis-ci.org/DaveBlooman/linkey)
|
1
2
|
Linkey
|
2
3
|
=====
|
3
4
|
|
@@ -6,9 +7,10 @@ Link checker for BBC News/WS Sites
|
|
6
7
|
The idea is to quickly check a page for broken links by doing a status check on all the relative URL's on the page.
|
7
8
|
|
8
9
|
There are 4 parts to this tool, the URL, the base URL, the regex and the filename.
|
9
|
-
|
10
|
-
The
|
11
|
-
|
10
|
+
|
11
|
+
The URL is the page that you want to check for broken links, e.g www.bbc.co.uk/news/uk-29928282
|
12
|
+
The Base URL is used with the relative URL from the regex to create a full URL, e.g www.bbc.co.uk
|
13
|
+
The regex is the point of the URL that you want to keep from the regex, e.g bbc.co.uk/news/uk, specifying /news would create /news/uk.
|
12
14
|
The filename is .md file where all the page links are stored, this can be useful for manual checks, e.g file.md
|
13
15
|
|
14
16
|
Install
|
@@ -30,6 +32,12 @@ Another
|
|
30
32
|
```ruby
|
31
33
|
linkey check http://www.theguardian.com/technology/2014/feb/15/year-of-code-needs-reboot-teachers http://theguardian.com /technology news.md
|
32
34
|
```
|
35
|
+
Output
|
36
|
+
|
37
|
+
Once running, you'll see either a 200 with
|
38
|
+
`Status is 200 for URL`
|
39
|
+
or
|
40
|
+
`Status is NOT GOOD for URL`
|
33
41
|
|
34
42
|
Script it
|
35
43
|
```ruby
|
@@ -47,4 +55,4 @@ status = Linkey::CheckResponse.new(url, base, reg, filename)
|
|
47
55
|
|
48
56
|
page.capture_links
|
49
57
|
status.check_links
|
50
|
-
```
|
58
|
+
```
|
data/bin/linkey
CHANGED
@@ -10,10 +10,10 @@ var currentRequests = 0;
|
|
10
10
|
// You can place custom headers here, example below.
|
11
11
|
// page.customHeaders = {
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
// 'X-Candy-OVERRIDE': 'https://api.live.bbc.co.uk/',
|
14
|
+
// 'X-Country': 'cn'
|
15
15
|
|
16
|
-
|
16
|
+
// };
|
17
17
|
|
18
18
|
// If you want to set a cookie, just add your details below in the following way.
|
19
19
|
|
data/lib/linkey/ping.rb
CHANGED
@@ -30,16 +30,31 @@ class Linkey::CheckResponse
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def status(urls)
|
33
|
+
@output = []
|
33
34
|
puts "Checking..."
|
34
35
|
urls.each do |page_path|
|
35
36
|
begin
|
36
37
|
gets = open(base + page_path)
|
37
38
|
status = gets.status.first
|
38
39
|
puts "Status is #{status} for #{base}#{page_path}"
|
39
|
-
rescue OpenURI::HTTPError
|
40
|
-
|
41
|
-
|
40
|
+
rescue OpenURI::HTTPError
|
41
|
+
if status != 200
|
42
|
+
puts "Status is NOT GOOD for #{base}#{page_path}"
|
43
|
+
@output << page_path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
check_for_broken
|
48
|
+
end
|
49
|
+
|
50
|
+
def check_for_broken
|
51
|
+
puts "Checking"
|
52
|
+
if @output.empty?
|
53
|
+
puts 'URL\'s are good, All Done!'
|
54
|
+
exit 0
|
55
|
+
else
|
56
|
+
puts 'Buddy, you got a broken link'
|
57
|
+
exit 1
|
42
58
|
end
|
43
|
-
puts "All Done!"
|
44
59
|
end
|
45
60
|
end
|
data/lib/linkey/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Blooman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -34,6 +34,7 @@ extra_rdoc_files: []
|
|
34
34
|
files:
|
35
35
|
- .gitignore
|
36
36
|
- .ruby-version
|
37
|
+
- .travis.yml
|
37
38
|
- Gemfile
|
38
39
|
- LICENSE
|
39
40
|
- README.md
|