linkey 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +112 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/bin/linkey +1 -1
- data/lib/linkey.rb +19 -20
- data/lib/linkey/cli.rb +6 -6
- data/lib/linkey/version.rb +1 -1
- data/linkey.gemspec +14 -14
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb69eeb3e77bf457c4fac9616cdd613ce402dc8
|
4
|
+
data.tar.gz: faabe2797103f0f6dd7f83bfe53216a27a3b4589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 086f2186ff128357e49c7de71d22e15d65abb74862a85a889a717d9ac4d947721cb12bd9911f42493f413ea6d2165c429c3cb2f5c096cdce6f5a8648f55cb7ae
|
7
|
+
data.tar.gz: 41c035970b4b595e9e11b68352b0878a0dddfd94985b71373fda41b11fcfbb92de53ff93a6d1759ad73e9f1533964b87dcf46f5c521287eecb64a3dbeb2be482
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
Lint/SpaceBeforeFirstArg:
|
2
|
+
Severity: fatal
|
3
|
+
Enabled: true
|
4
|
+
|
5
|
+
Lint/RescueException:
|
6
|
+
Severity: fatal
|
7
|
+
Enabled: true
|
8
|
+
|
9
|
+
Lint/UnusedBlockArgument:
|
10
|
+
Severity: fatal
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
Metrics/LineLength:
|
14
|
+
Severity: fatal
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Severity: convention
|
19
|
+
Enabled: true
|
20
|
+
Max: 5
|
21
|
+
|
22
|
+
Style/AlignHash:
|
23
|
+
Severity: fatal
|
24
|
+
Enabled: true
|
25
|
+
EnforcedHashRocketStyle: table
|
26
|
+
|
27
|
+
Style/AlignParameters:
|
28
|
+
Severity: fatal
|
29
|
+
Enabled: true
|
30
|
+
EnforcedStyle: with_fixed_indentation
|
31
|
+
|
32
|
+
Style/BracesAroundHashParameters:
|
33
|
+
Severity: fatal
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Style/ConstantName:
|
37
|
+
Severity: fatal
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Style/Documentation:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/EmptyLinesAroundClassBody:
|
44
|
+
Severity: fatal
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Style/ExtraSpacing:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/FileName:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/HashSyntax:
|
54
|
+
Severity: fatal
|
55
|
+
Enabled: true
|
56
|
+
EnforcedStyle: hash_rockets
|
57
|
+
|
58
|
+
Style/IndentationConsistency:
|
59
|
+
Severity: fatal
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Style/IndentationWidth:
|
63
|
+
Severity: fatal
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Style/IndentHash:
|
67
|
+
Severity: fatal
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Style/InlineComment:
|
71
|
+
Severity: fatal
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Style/LineEndConcatenation:
|
75
|
+
Severity: fatal
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Style/MethodName:
|
79
|
+
Severity: fatal
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Style/MultilineTernaryOperator:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Style/NegatedIf:
|
86
|
+
Severity: fatal
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
Style/Not:
|
90
|
+
Severity: fatal
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Style/SpaceInsideHashLiteralBraces:
|
94
|
+
Severity: fatal
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
Style/StringLiterals:
|
98
|
+
Severity: fatal
|
99
|
+
Enabled: true
|
100
|
+
EnforcedStyle: double_quotes
|
101
|
+
|
102
|
+
Style/TrailingBlankLines:
|
103
|
+
Severity: fatal
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
Style/TrailingWhitespace:
|
107
|
+
Severity: fatal
|
108
|
+
Enabled: true
|
109
|
+
|
110
|
+
Style/VariableName:
|
111
|
+
Severity: fatal
|
112
|
+
Enabled: true
|
data/Gemfile
CHANGED
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) [![Code Climate](https://codeclimate.com/github/DaveBlooman/linkey/badges/gpa.svg)](https://codeclimate.com/github/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) [![Gem Version](https://badge.fury.io/rb/linkey.svg)](http://badge.fury.io/rb/linkey)
|
2
2
|
Linkey
|
3
3
|
=====
|
4
4
|
|
data/bin/linkey
CHANGED
data/lib/linkey.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
require "linkey/version"
|
2
|
+
require "yaml"
|
3
|
+
require "parallel"
|
4
|
+
require "typhoeus"
|
5
|
+
require "faraday"
|
6
|
+
require "typhoeus/adapters/faraday"
|
7
7
|
|
8
8
|
module Linkey
|
9
|
-
autoload :CLI,
|
9
|
+
autoload :CLI, "linkey/cli"
|
10
10
|
|
11
11
|
class CheckResponse
|
12
12
|
attr_accessor :url, :base, :reg, :file_name
|
@@ -19,7 +19,7 @@ module Linkey
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def check_links
|
22
|
-
links_list = File.read(file_name).split(
|
22
|
+
links_list = File.read(file_name).split(",")
|
23
23
|
links(links_list)
|
24
24
|
end
|
25
25
|
|
@@ -44,7 +44,7 @@ module Linkey
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def js_file
|
47
|
-
File.expand_path(
|
47
|
+
File.expand_path("linkey/javascript/snap.js", File.dirname(__FILE__))
|
48
48
|
end
|
49
49
|
|
50
50
|
def capture_links
|
@@ -58,26 +58,25 @@ module Linkey
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def base
|
61
|
-
@smoke_urls[
|
61
|
+
@smoke_urls["base"]
|
62
62
|
end
|
63
63
|
|
64
64
|
def smoke
|
65
|
-
urls = @smoke_urls[
|
66
|
-
options = @smoke_urls[
|
65
|
+
urls = @smoke_urls["paths"]
|
66
|
+
options = @smoke_urls["headers"]
|
67
67
|
headers = Hash[*options]
|
68
|
-
@smoke_urls[
|
69
|
-
Getter.status(urls, base, { headers
|
68
|
+
@smoke_urls["status_code"] ? status_code = @smoke_urls["status_code"] : status_code = 200
|
69
|
+
Getter.status(urls, base, { :headers => headers }, status_code)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
class Getter
|
74
74
|
def self.status(urls, base, _headers = {}, status_code = 200)
|
75
75
|
@output = []
|
76
|
-
puts
|
76
|
+
puts "Checking..."
|
77
77
|
|
78
|
-
Parallel.each(urls, in_threads
|
79
|
-
|
80
|
-
request = Faraday.new(url: base, ssl: { verify: false }) do |faraday|
|
78
|
+
Parallel.each(urls, :in_threads => 4) do |page_path|
|
79
|
+
request = Faraday.new(:url => base, :ssl => { :verify => false }) do |faraday|
|
81
80
|
faraday.adapter :typhoeus
|
82
81
|
end
|
83
82
|
status = request.get(page_path).status
|
@@ -96,12 +95,12 @@ module Linkey
|
|
96
95
|
end
|
97
96
|
|
98
97
|
def self.check_for_broken
|
99
|
-
puts
|
98
|
+
puts "Checking"
|
100
99
|
if @output.empty?
|
101
100
|
puts 'URL\'s are good, All Done!'
|
102
101
|
exit 0
|
103
102
|
else
|
104
|
-
puts
|
103
|
+
puts "Buddy, you got a broken link"
|
105
104
|
puts @output
|
106
105
|
exit 1
|
107
106
|
end
|
data/lib/linkey/cli.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "thor"
|
2
|
+
require "linkey"
|
3
3
|
|
4
4
|
class Linkey::CLI < Thor
|
5
5
|
include Thor::Actions
|
6
6
|
|
7
|
-
desc
|
7
|
+
desc "scan", "Save some URL's"
|
8
8
|
def scan(url, filename)
|
9
9
|
html = Linkey::SaveLinks.new(url, filename)
|
10
10
|
html.capture_links
|
11
11
|
end
|
12
12
|
|
13
|
-
desc
|
13
|
+
desc "status", "checks links for errors"
|
14
14
|
def status(url, base, reg, filename)
|
15
15
|
status = Linkey::CheckResponse.new(url, base, reg, filename)
|
16
16
|
status.check_links
|
17
17
|
end
|
18
18
|
|
19
|
-
desc
|
19
|
+
desc "check URL Base_URL Regex File", "A full linkey job"
|
20
20
|
def check(url, base, reg, filename)
|
21
21
|
scan(url, filename)
|
22
22
|
status(url, base, reg, filename)
|
23
23
|
end
|
24
24
|
|
25
|
-
desc
|
25
|
+
desc "smoke [path/to/file]", "A linkey job using predetermined URL's"
|
26
26
|
def smoke(file)
|
27
27
|
check = Linkey::Checker.new(file)
|
28
28
|
check.smoke
|
data/lib/linkey/version.rb
CHANGED
data/linkey.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "linkey/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = "linkey"
|
8
8
|
spec.version = Linkey::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ["Dave Blooman"]
|
10
|
+
spec.email = ["david.blooman@gmail.com"]
|
11
|
+
spec.summary = "Linkey"
|
12
|
+
spec.description = "Linkey"
|
13
|
+
spec.homepage = "http://dblooman.com"
|
14
|
+
spec.license = "Apache 2"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.require_paths = [
|
18
|
+
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_runtime_dependency
|
21
|
-
spec.add_runtime_dependency
|
22
|
-
spec.add_runtime_dependency
|
23
|
-
spec.add_runtime_dependency
|
20
|
+
spec.add_runtime_dependency "thor"
|
21
|
+
spec.add_runtime_dependency "parallel"
|
22
|
+
spec.add_runtime_dependency "typhoeus"
|
23
|
+
spec.add_runtime_dependency "faraday"
|
24
24
|
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: 1.1.
|
4
|
+
version: 1.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:
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -75,6 +75,7 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- .gitignore
|
78
|
+
- .rubocop.yml
|
78
79
|
- .ruby-version
|
79
80
|
- .travis.yml
|
80
81
|
- Gemfile
|
@@ -86,7 +87,7 @@ files:
|
|
86
87
|
- lib/linkey/javascript/snap.js
|
87
88
|
- lib/linkey/version.rb
|
88
89
|
- linkey.gemspec
|
89
|
-
homepage: http://
|
90
|
+
homepage: http://dblooman.com
|
90
91
|
licenses:
|
91
92
|
- Apache 2
|
92
93
|
metadata: {}
|