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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24c584ed39c86e327994d6ec7d8d7ce7bfdf89f9
4
- data.tar.gz: 733a082d58fd5de3c8bd6588f9ed0a52562ca8a3
3
+ metadata.gz: 968870da0a318f9d9136453879f4711336f281c5
4
+ data.tar.gz: 6a65ad66c24f6277ad62a3508069a90e29d49170
5
5
  SHA512:
6
- metadata.gz: b0dad21a6b2a51435d59a190fd95204df043e755a061c83efb6a353d789f4a239d60b762f06a4eae5bac845dc134f718a6c232224c4897edb352f8c425e5a525
7
- data.tar.gz: e4b8a8512585bd56f3add88b9887e3fe77f803651fd3743a31228d35be96dffa7038bc1108164908a7b8b200277567f7b1b4cfed68b067811d12b41930730b24
6
+ metadata.gz: 650ca4da7bbbd3814f97b8d4147f47fc17e1771dfab224a1a234b3f5ea56f63e1939039fce2a1b29f0fbe7846e579249f24e176149f23ee06084d2885b6c2622
7
+ data.tar.gz: 268556e7fc4227e2b06dbaef445c62ee23a93c9ed713fae38cad7ab5c45343d828492c7532b3ffc055fa24dd38e737e014bbb1580aa46b597569ed6dfd4e0a12
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.0.0"
4
+
5
+ script: "./bin/linkey check http://www.live.bbc.co.uk/news http://www.live.bbc.co.uk /news news.md"
6
+
7
+ notifications:
8
+ email:
9
+ recipients:
10
+ - david.blooman@bbc.co.uk
11
+ on_failure: change
12
+ on_success: never
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Build Status](https://travis-ci.org/DaveBlooman/linkey.png?branch=master)](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
- The URL is the page that you want to check for broken links, e.g www.bbc.co.uk/news/uk-29928282
10
- The Base URL is used with the relative URL from the regex to create a full URL, e.g www.bbc.co.uk
11
- 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.
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
@@ -1,13 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rubygems'
3
2
  require 'bundler/setup'
4
3
 
5
4
  begin
6
5
  require 'linkey/cli'
7
6
  Linkey::CLI.start
8
- rescue Interrupt => e
7
+ rescue Interrupt
9
8
  puts "\nQuitting..."
10
9
  exit 1
11
- rescue SystemExit => e
12
- exit e.status
13
10
  end
@@ -10,10 +10,10 @@ var currentRequests = 0;
10
10
  // You can place custom headers here, example below.
11
11
  // page.customHeaders = {
12
12
 
13
- // 'X-Candy-OVERRIDE': 'https://api.test.bbc.co.uk/'
14
- // 'X-Country': 'cn'
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 => ex
40
- puts "Status is NOT GOOD for #{base}#{page_path}"
41
- end
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
@@ -1,3 +1,3 @@
1
1
  module Linkey
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
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.0
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-17 00:00:00.000000000 Z
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