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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +4 -2
- data/lib/linkey.rb +6 -5
- data/lib/linkey/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251d4b64fdfa0073b93a0822c79d2acc02017f3e
|
4
|
+
data.tar.gz: d837acf5af49cedcc9d3570b2dd19f1f4308f76c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
[](https://travis-ci.org/DaveBlooman/linkey)
|
1
|
+
[](https://travis-ci.org/DaveBlooman/linkey) [](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 !=
|
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
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2014-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|