golia 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/golia.gemspec +13 -12
- data/lib/golia.rb +16 -11
- metadata +6 -11
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubygems' unless defined?(Gem)
|
1
2
|
require 'rubygems/specification'
|
2
3
|
require 'rake/gempackagetask'
|
3
4
|
require 'rake'
|
@@ -23,7 +24,7 @@ desc "Release the gem"
|
|
23
24
|
task :release => :package do
|
24
25
|
sh "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
25
26
|
sh "rm -rf pkg"
|
26
|
-
sh "git add .; git commit -m \"Bump to version #{gemspec.version}\"; git push"
|
27
|
+
sh "git add .; git commit -m \"Bump to version #{gemspec.version}\"; git push origin master"
|
27
28
|
end
|
28
29
|
|
29
30
|
desc "Installs the gem locally"
|
data/golia.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
|
-
s.name
|
3
|
-
s.rubyforge_project
|
4
|
-
s.authors
|
5
|
-
s.email
|
6
|
-
s.summary
|
7
|
-
s.homepage
|
8
|
-
s.description
|
2
|
+
s.name = "golia"
|
3
|
+
s.rubyforge_project = "golia"
|
4
|
+
s.authors = ["DAddYE"]
|
5
|
+
s.email = "d.dagostino@lipsiasoft.com"
|
6
|
+
s.summary = "Dead Links Checker and Speed Analyzer"
|
7
|
+
s.homepage = "http://www.padrinorb.com"
|
8
|
+
s.description = "Golia is an website performance analyzer. Check speed and dead links."
|
9
9
|
s.default_executable = "golia"
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.files
|
10
|
+
s.version = "1.3.2"
|
11
|
+
s.date = Time.now.strftime("%Y-%m-%d")
|
12
|
+
s.extra_rdoc_files = Dir["*.rdoc"]
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = %w(lib)
|
15
16
|
end
|
data/lib/golia.rb
CHANGED
@@ -16,7 +16,7 @@ class Golia
|
|
16
16
|
@checked, @links, @ko, @ok, @long, @invalid, @sec = [], [], [], [], [], [], []
|
17
17
|
|
18
18
|
if File.exist?(@pid)
|
19
|
-
puts "<= Founded
|
19
|
+
puts "<= Founded stale pid"
|
20
20
|
Process.kill(9, File.read(@pid).to_i) rescue nil
|
21
21
|
end
|
22
22
|
|
@@ -34,16 +34,22 @@ class Golia
|
|
34
34
|
begun_at = Time.now
|
35
35
|
response = open(url)
|
36
36
|
@sec << Time.now-begun_at
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
case File.extname(url)
|
38
|
+
when ""
|
39
|
+
body = response.read
|
40
|
+
links = body.scan(/href=["'](.+?)["']/m).flatten
|
41
|
+
links += body.scan(/<script.+?src=["'](.+?)["']/m).flatten
|
42
|
+
links.reject! do |link|
|
43
|
+
link =~ /^\/$|^https?|^mailto|^javascript|#|"|'/ ||
|
44
|
+
File.extname(link) !~ /\.css|\.js|^$/
|
45
|
+
end
|
46
|
+
links.map! { |link| link = "/"+link if link !~ /^\//; @host+link }
|
47
|
+
@links.concat(links-@checked)
|
48
|
+
when /xml/i # maybe a sitemap
|
49
|
+
body = response.read
|
50
|
+
links = body.scan(/<loc>(http:\/\/.+)<\/loc>/).flatten
|
51
|
+
@links.concat(links-@checked)
|
44
52
|
end
|
45
|
-
links.map! { |link| link = "/"+link if link !~ /^\//; @host+link }
|
46
|
-
@links.concat(links-@checked)
|
47
53
|
end
|
48
54
|
|
49
55
|
def validate!(url)
|
@@ -98,6 +104,5 @@ class Golia
|
|
98
104
|
end
|
99
105
|
puts "Average load time %0.2fsec" % [@sec.inject(0) { |memo, sec| memo+=sec; memo }/@sec.size]
|
100
106
|
puts
|
101
|
-
kill
|
102
107
|
end
|
103
108
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: golia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
8
|
+
- 2
|
9
|
+
version: 1.3.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- DAddYE
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-
|
17
|
+
date: 2011-07-09 00:00:00 +02:00
|
19
18
|
default_executable: golia
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -30,9 +29,9 @@ extra_rdoc_files:
|
|
30
29
|
files:
|
31
30
|
- README.rdoc
|
32
31
|
- Rakefile
|
32
|
+
- bin/golia
|
33
33
|
- golia.gemspec
|
34
34
|
- lib/golia.rb
|
35
|
-
- bin/golia
|
36
35
|
has_rdoc: true
|
37
36
|
homepage: http://www.padrinorb.com
|
38
37
|
licenses: []
|
@@ -43,27 +42,23 @@ rdoc_options: []
|
|
43
42
|
require_paths:
|
44
43
|
- lib
|
45
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
45
|
requirements:
|
48
46
|
- - ">="
|
49
47
|
- !ruby/object:Gem::Version
|
50
|
-
hash: 3
|
51
48
|
segments:
|
52
49
|
- 0
|
53
50
|
version: "0"
|
54
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
52
|
requirements:
|
57
53
|
- - ">="
|
58
54
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
55
|
segments:
|
61
56
|
- 0
|
62
57
|
version: "0"
|
63
58
|
requirements: []
|
64
59
|
|
65
60
|
rubyforge_project: golia
|
66
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.3.6
|
67
62
|
signing_key:
|
68
63
|
specification_version: 3
|
69
64
|
summary: Dead Links Checker and Speed Analyzer
|