linkey 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 968870da0a318f9d9136453879f4711336f281c5
4
- data.tar.gz: 6a65ad66c24f6277ad62a3508069a90e29d49170
3
+ metadata.gz: 5e96ab8c59be65fdcffbbfe438034e1be3b1a0cd
4
+ data.tar.gz: 1cbad9d0f4e0e5c52ff744a0dad9ddc9a0a6142f
5
5
  SHA512:
6
- metadata.gz: 650ca4da7bbbd3814f97b8d4147f47fc17e1771dfab224a1a234b3f5ea56f63e1939039fce2a1b29f0fbe7846e579249f24e176149f23ee06084d2885b6c2622
7
- data.tar.gz: 268556e7fc4227e2b06dbaef445c62ee23a93c9ed713fae38cad7ab5c45343d828492c7532b3ffc055fa24dd38e737e014bbb1580aa46b597569ed6dfd4e0a12
6
+ metadata.gz: 83963de13343fe98bd2325436d1fe57e8ad392199dea6023da4869e8abc43fc6f5576eb2bec4fb1f5e43fbaa8d2e4cdc3b261e79a2567be5639301eec04c2338
7
+ data.tar.gz: 661d450cd63434c01a64ad259fb327e6af67f0d2e60448af29f35a95692bfb483401df2d8093615af6ccdee6dbe2ca6be62aa4f629c4be6e49abce969962f270
data/README.md CHANGED
@@ -4,20 +4,22 @@ Linkey
4
4
 
5
5
  Link checker for BBC News/WS Sites
6
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
+ 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.
8
8
 
9
9
  There are 4 parts to this tool, the URL, the base URL, the regex and the filename.
10
10
 
11
- The URL is the page that you want to check for broken links, e.g www.bbc.co.uk/news/uk-29928282
11
+ The URL is the page that you want to check for broken links, e.g www.bbc.co.uk/news/uk-29928282
12
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
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.
14
14
  The filename is .md file where all the page links are stored, this can be useful for manual checks, e.g file.md
15
15
 
16
- Install
16
+ Install
17
17
 
18
18
  `gem install linkey`
19
19
 
20
- To use run
20
+ ## Command line usage
21
+
22
+ To use run
21
23
 
22
24
  ```
23
25
  linkey check URL BASEURL /regex Filename
@@ -29,16 +31,33 @@ linkey check http://www.live.bbc.co.uk/arabic http://www.live.bbc.co.uk /arabic
29
31
  ```
30
32
  Another
31
33
 
32
- ```ruby
34
+ ```
33
35
  linkey check http://www.theguardian.com/technology/2014/feb/15/year-of-code-needs-reboot-teachers http://theguardian.com /technology news.md
34
36
  ```
35
37
  Output
36
38
 
37
- Once running, you'll see either a 200 with
39
+ Once running, you'll see either a 200 with
38
40
  `Status is 200 for URL`
39
- or
41
+ or
40
42
  `Status is NOT GOOD for URL`
41
43
 
44
+ ## From a file
45
+
46
+ If you have a lot of URLs that you want to check all the time using from a file is an alternative option. This will utilise the smoke option, then point to a YAML file with the extension.
47
+
48
+ ```
49
+ linkey smoke test.yaml
50
+ ```
51
+
52
+ Example yaml file
53
+ ```yaml
54
+ base: 'http://www.bbc.co.uk'
55
+
56
+ paths:
57
+ - /news
58
+ - /news/uk
59
+ ```
60
+
42
61
  Script it
43
62
  ```ruby
44
63
 
data/bin/linkey CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require 'bundler/setup'
3
2
 
4
3
  begin
5
4
  require 'linkey/cli'
@@ -0,0 +1,19 @@
1
+ require 'linkey'
2
+ require 'open-uri'
3
+ require 'yaml'
4
+
5
+ class Linkey::Checker < Linkey::CheckResponse
6
+
7
+ def initialize(config)
8
+ @smoke_urls = YAML::load(File.open("#{config}"))
9
+ end
10
+
11
+ def base
12
+ @smoke_urls['base']
13
+ end
14
+
15
+ def smoke
16
+ urls = @smoke_urls['paths']
17
+ status(urls)
18
+ end
19
+ end
data/lib/linkey/cli.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'thor'
2
2
  require 'linkey/html'
3
3
  require 'linkey/ping'
4
+ require 'linkey/checker'
4
5
 
5
6
  class Linkey::CLI < Thor
6
7
  include Thor::Actions
@@ -22,4 +23,10 @@ class Linkey::CLI < Thor
22
23
  scan(url, filename)
23
24
  status(url, base, reg, filename)
24
25
  end
26
+
27
+ desc "smoke [path/to/file]", "A linkey job using predetermined URL's"
28
+ def smoke(file)
29
+ check = Linkey::Checker.new(file)
30
+ check.smoke
31
+ end
25
32
  end
@@ -1,3 +1,3 @@
1
1
  module Linkey
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
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.1
4
+ version: 0.2.0
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-21 00:00:00.000000000 Z
11
+ date: 2014-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -40,6 +40,7 @@ files:
40
40
  - README.md
41
41
  - bin/linkey
42
42
  - lib/linkey.rb
43
+ - lib/linkey/checker.rb
43
44
  - lib/linkey/cli.rb
44
45
  - lib/linkey/html.rb
45
46
  - lib/linkey/javascript/snap.js