sla 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/sla.rb +2 -3
- data/lib/sla/cache.rb +2 -0
- data/lib/sla/checker.rb +2 -3
- data/lib/sla/command_line.rb +13 -8
- data/lib/sla/docopt.txt +6 -0
- data/lib/sla/page.rb +1 -1
- data/lib/sla/version.rb +1 -1
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c4f0612c8ccebbc1c29a22eee3ad61cd7610563
|
4
|
+
data.tar.gz: 1e6ed70e361c653b2c780e4be344ecd624529efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2c1eb8bc98e1c0139e7e7155744cba9266364c6edc1f5bd254af233643f4eee50693171fc247f3555b31e1d1a6191df90bcb763dac825935253274805bee1ba
|
7
|
+
data.tar.gz: 216a0aa3ca464ad342826f60c1f1e73dbde5b5f0d17aadafe24551d658f52e665d7ae3513b5b086039e66b5f9800d27f447caa54c5ffd9cec58e341bbb9205d0
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@ Site Link Analyzer
|
|
2
2
|
==================================================
|
3
3
|
|
4
4
|
[![Gem](https://img.shields.io/gem/v/sla.svg?style=flat-square)](https://rubygems.org/gems/sla)
|
5
|
+
[![Travis](https://img.shields.io/travis/DannyBen/sla.svg?style=flat-square)](https://travis-ci.org/DannyBen/sla)
|
5
6
|
[![Code Climate](https://img.shields.io/codeclimate/github/DannyBen/sla.svg?style=flat-square)](https://codeclimate.com/github/DannyBen/sla)
|
6
7
|
[![Gemnasium](https://img.shields.io/gemnasium/DannyBen/sla.svg?style=flat-square)](https://gemnasium.com/DannyBen/sla)
|
7
8
|
|
@@ -46,7 +47,13 @@ Options:
|
|
46
47
|
--cache, -c LIFE
|
47
48
|
Set cache life in seconds [default: 86400]
|
48
49
|
|
50
|
+
--cache-dir DIR
|
51
|
+
Set the cache directory [default: cache]
|
52
|
+
|
53
|
+
--color
|
54
|
+
Disable colors in output
|
55
|
+
|
49
56
|
Examples:
|
50
57
|
sla check example.com
|
51
58
|
sla check example.com -c360 -d10
|
52
|
-
```
|
59
|
+
```
|
data/lib/sla.rb
CHANGED
data/lib/sla/cache.rb
CHANGED
data/lib/sla/checker.rb
CHANGED
@@ -30,14 +30,13 @@ module SLA
|
|
30
30
|
def check_url(url, depth, &_block)
|
31
31
|
page = Page.new url, depth: depth, base_url: base_url
|
32
32
|
page.validate
|
33
|
+
checked_links.push url
|
33
34
|
|
34
|
-
yield page
|
35
|
+
yield page if block_given?
|
35
36
|
return if depth >= max_depth
|
36
37
|
|
37
38
|
page.links.each do |link|
|
38
39
|
next if checked_links.include? link.url
|
39
|
-
|
40
|
-
checked_links.push link.url
|
41
40
|
next_check.push link.url
|
42
41
|
end
|
43
42
|
end
|
data/lib/sla/command_line.rb
CHANGED
@@ -13,20 +13,21 @@ module SLA
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
private
|
17
|
+
|
16
18
|
def handle(args)
|
17
19
|
if args['check']
|
18
|
-
@
|
19
|
-
|
20
|
-
@cache_life = args['--cache'].to_i
|
21
|
-
check_domain
|
20
|
+
@no_color = args['--color']
|
21
|
+
check_domain args
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def check_domain
|
25
|
+
def check_domain(args)
|
26
26
|
checker = Checker.new
|
27
|
-
checker.max_depth =
|
28
|
-
checker.cache.life =
|
29
|
-
|
27
|
+
checker.max_depth = args['--depth'].to_i
|
28
|
+
checker.cache.life = args['--cache'].to_i
|
29
|
+
checker.cache.dir = args['--cache-dir'] if args['--cache-dir']
|
30
|
+
url_manager.base_url = args['DOMAIN']
|
30
31
|
|
31
32
|
File.unlink 'log.log' if File.exist? 'log.log'
|
32
33
|
|
@@ -47,6 +48,7 @@ module SLA
|
|
47
48
|
end
|
48
49
|
|
49
50
|
color = failed > 0 ? '!txtred!' : '!txtgrn!'
|
51
|
+
color = "" if @no_color
|
50
52
|
say "#{color}Done with #{failed} failures"
|
51
53
|
f.puts "Done with #{failed} failures"
|
52
54
|
end
|
@@ -54,6 +56,8 @@ module SLA
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def color_status(status)
|
59
|
+
return status if @no_color
|
60
|
+
# :nocov:
|
57
61
|
case status
|
58
62
|
when '200'
|
59
63
|
'!txtgrn!200!txtrst!'
|
@@ -62,6 +66,7 @@ module SLA
|
|
62
66
|
else
|
63
67
|
status
|
64
68
|
end
|
69
|
+
# :nocov:
|
65
70
|
end
|
66
71
|
|
67
72
|
end
|
data/lib/sla/docopt.txt
CHANGED
data/lib/sla/page.rb
CHANGED
data/lib/sla/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: runfile
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.8'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.8'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: colsole
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,19 +123,33 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '9.0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.4'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.4'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '0.11'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '0.11'
|
153
153
|
description: Check for broken links on a website
|
154
154
|
email: db@dannyben.com
|
155
155
|
executables:
|
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
requirements:
|
182
182
|
- - ">="
|
183
183
|
- !ruby/object:Gem::Version
|
184
|
-
version: 2.
|
184
|
+
version: 2.2.2
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - ">="
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
191
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
192
|
+
rubygems_version: 2.6.6
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Site Link Analyzer
|