linkey 0.3.4 → 1.0.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
  SHA1:
3
- metadata.gz: 6414b83ff05a1569addce0199177b7f29dd215f7
4
- data.tar.gz: bb8537fd7107f2e21c89fc8a86986ff8109dd272
3
+ metadata.gz: 251d4b64fdfa0073b93a0822c79d2acc02017f3e
4
+ data.tar.gz: d837acf5af49cedcc9d3570b2dd19f1f4308f76c
5
5
  SHA512:
6
- metadata.gz: 376fa1a1af7ac1d671227ac3962bd3a6c191b4ceb0cef9e2c4c34451d95d5fa49eac85ada9a2a507f69accd01741b7b2f2d84761f588f5e7c6619da69fd8abf4
7
- data.tar.gz: 014d8b30f54ffd795961d6f1006cbaa410147d60c58db115449ae501eff966d3955fa4b11dd1fb1f6a012cdab15e9fa02318c1ea780c5faf86ee3cd29916e289
6
+ metadata.gz: 6a25044c8cc5972172218fcbe00edda7cd149f4a7ad56beeb48b03158bda8e5cfd870f6db4900c16a34b8c528f0bee0190419f1fa58845249ef1bee4312055b2
7
+ data.tar.gz: e65604b41ace17284258a2b274c850598d3f9796a92464e7b3fda3f5f1b847a3c2090846a441cec17051e711e8618aec3f1564a63f3ce975255d5f17b4d93e39
data/.travis.yml CHANGED
@@ -2,7 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - "2.0.0"
4
4
 
5
- script: "bundle exec bin/linkey check http://www.theguardian.com/technology/2014/feb/15/year-of-code-needs-reboot-teachers http://www.theguardian.com /technology news.md"
5
+ script: "bundle exec bin/linkey check http://www.bbc.co.uk/arabic http://www.bbc.co.uk /arabic arabic.md"
6
6
 
7
7
  notifications:
8
8
  email:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/DaveBlooman/linkey.png?branch=master)](https://travis-ci.org/DaveBlooman/linkey)
1
+ [![Build Status](https://travis-ci.org/DaveBlooman/linkey.png?branch=master)](https://travis-ci.org/DaveBlooman/linkey) [![Code Climate](https://codeclimate.com/github/DaveBlooman/linkey/badges/gpa.svg)](https://codeclimate.com/github/DaveBlooman/linkey)
2
2
  Linkey
3
3
  =====
4
4
 
@@ -60,7 +60,7 @@ status.check_links
60
60
  ```
61
61
  ## From a file
62
62
 
63
- 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.
63
+ 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. In some situations, we are deploying applications that we don't want public facing, so ensuring they 404 is essential. There is a status code option to allow a specific status code to be set against a group of URL's, ensuring builds fail if the right code conditions are met.
64
64
 
65
65
  ```
66
66
  linkey smoke test.yaml
@@ -70,6 +70,8 @@ Example yaml file
70
70
  ```yaml
71
71
  base: 'http://www.bbc.co.uk'
72
72
 
73
+ status_code: 200
74
+
73
75
  paths:
74
76
  - /news
75
77
  - /news/uk
data/lib/linkey.rb CHANGED
@@ -36,19 +36,19 @@ module Linkey
36
36
  end
37
37
 
38
38
  class Getter
39
- def self.status(urls, base, headers = {})
39
+ def self.status(urls, base, headers = {}, status_code = 200)
40
40
  @output = []
41
41
  puts 'Checking...'
42
42
  Parallel.each(urls, in_threads: 4) do |page_path|
43
43
  request = Typhoeus.get(base + page_path.chomp('/'), headers)
44
44
  status = request.code
45
- make_request(page_path, base, status)
45
+ make_request(page_path, base, status, status_code)
46
46
  end
47
47
  check_for_broken
48
48
  end
49
49
 
50
- def self.make_request(page_path, base, status)
51
- if status != 200
50
+ def self.make_request(page_path, base, status, status_code)
51
+ if status != status_code
52
52
  puts "Status is NOT GOOD for #{base}#{page_path}, response is #{status}"
53
53
  @output << page_path
54
54
  else
@@ -99,7 +99,8 @@ module Linkey
99
99
  urls = @smoke_urls['paths']
100
100
  options = @smoke_urls['headers']
101
101
  headers = Hash[*options]
102
- Getter.status(urls, base, headers: headers)
102
+ @smoke_urls['status_code'] ? status_code = @smoke_urls['status_code'] : status_code = 200
103
+ Getter.status(urls, base, headers, status_code)
103
104
  end
104
105
  end
105
106
  end
@@ -1,3 +1,3 @@
1
1
  module Linkey
2
- VERSION = '0.3.4'
2
+ VERSION = '1.0.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.3.4
4
+ version: 1.0.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-08-11 00:00:00.000000000 Z
11
+ date: 2014-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor