linkey 0.3.2 → 0.3.3
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/lib/linkey.rb +21 -15
- data/lib/linkey/version.rb +1 -1
- data/linkey.gemspec +2 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 306512d00f55ed9b6c74b858c087621c420ad225
|
4
|
+
data.tar.gz: c3e26fd44a31553ae0be10d6cdaacc6de53943d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5483ae20a70fb78194753c4ccb6fcbb28c4e2d1cfe753761ea2813b3828343b24200a8f5a7ac218bd3c0a5eb4efc9411cd88a3d0bc9f4cf05a28b3d9490bc797
|
7
|
+
data.tar.gz: 10935afa6b84e205a1fcf9158f7fda8cc845560827c605b9d45ebeb50456dc3c2e4539f7152e1045f458f1d6a031ca0f188b0d3c0382f9f889c1395e4795d3b1
|
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.theguardian.com/technology/2014/feb/15/year-of-code-needs-reboot-teachers http://www.theguardian.com /technology news.md"
|
6
6
|
|
7
7
|
notifications:
|
8
8
|
email:
|
data/lib/linkey.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'linkey/version'
|
2
|
-
require 'open-uri'
|
3
2
|
require 'yaml'
|
4
3
|
require 'parallel'
|
4
|
+
require 'typhoeus'
|
5
5
|
|
6
6
|
module Linkey
|
7
7
|
autoload :CLI, 'linkey/cli'
|
@@ -31,28 +31,32 @@ module Linkey
|
|
31
31
|
|
32
32
|
def scan(page_links)
|
33
33
|
urls = page_links.scan(/^#{Regexp.quote(reg)}(?:|.+)?$/)
|
34
|
-
status(urls)
|
34
|
+
Getter.status(urls, base)
|
35
35
|
end
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
+
class Getter
|
39
|
+
def self.status(urls, base, headers = {})
|
38
40
|
@output = []
|
39
41
|
puts 'Checking...'
|
40
42
|
Parallel.each(urls, in_threads: 7) do |page_path|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
puts "Status is #{status} for #{base}#{page_path}"
|
45
|
-
rescue OpenURI::HTTPError
|
46
|
-
if status != 200
|
47
|
-
puts "Status is NOT GOOD for #{base}#{page_path}"
|
48
|
-
@output << page_path
|
49
|
-
end
|
50
|
-
end
|
43
|
+
request = Typhoeus.get(base + page_path.chomp('/'), headers)
|
44
|
+
status = request.code
|
45
|
+
make_request(page_path, base, status)
|
51
46
|
end
|
52
47
|
check_for_broken
|
53
48
|
end
|
54
49
|
|
55
|
-
def
|
50
|
+
def self.make_request(page_path, base, status)
|
51
|
+
if status != 200
|
52
|
+
puts "Status is NOT GOOD for #{base}#{page_path}, response is #{status}"
|
53
|
+
@output << page_path
|
54
|
+
else
|
55
|
+
puts "Status is #{status} for #{base}#{page_path}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.check_for_broken
|
56
60
|
puts 'Checking'
|
57
61
|
if @output.empty?
|
58
62
|
puts 'URL\'s are good, All Done!'
|
@@ -93,7 +97,9 @@ module Linkey
|
|
93
97
|
|
94
98
|
def smoke
|
95
99
|
urls = @smoke_urls['paths']
|
96
|
-
|
100
|
+
options = @smoke_urls['headers']
|
101
|
+
headers = Hash[*options]
|
102
|
+
Getter.status(urls, base, headers: headers)
|
97
103
|
end
|
98
104
|
end
|
99
105
|
end
|
data/lib/linkey/version.rb
CHANGED
data/linkey.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['david.blooman@gmail.com']
|
11
11
|
spec.summary = 'Linkey'
|
12
12
|
spec.description = 'Linkey'
|
13
|
-
spec.homepage = '
|
13
|
+
spec.homepage = 'https://github.com/DaveBlooman/linkey'
|
14
14
|
spec.license = 'Apache 2'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_runtime_dependency 'thor'
|
21
21
|
spec.add_runtime_dependency 'parallel'
|
22
|
+
spec.add_runtime_dependency 'typhoeus'
|
22
23
|
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
|
+
version: 0.3.3
|
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-07-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: typhoeus
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Linkey
|
42
56
|
email:
|
43
57
|
- david.blooman@gmail.com
|
@@ -58,7 +72,7 @@ files:
|
|
58
72
|
- lib/linkey/javascript/snap.js
|
59
73
|
- lib/linkey/version.rb
|
60
74
|
- linkey.gemspec
|
61
|
-
homepage:
|
75
|
+
homepage: https://github.com/DaveBlooman/linkey
|
62
76
|
licenses:
|
63
77
|
- Apache 2
|
64
78
|
metadata: {}
|