golia 1.1 → 1.2
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.
- data/golia.gemspec +1 -1
- data/lib/golia.rb +8 -4
- metadata +3 -3
data/golia.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.description = "Golia is an website performance analyzer. Check speed and dead links."
|
9
9
|
s.default_executable = "golia"
|
10
10
|
s.executables = ["golia"]
|
11
|
-
s.version = "1.
|
11
|
+
s.version = "1.2"
|
12
12
|
s.date = Time.now.strftime("%Y-%m-%d")
|
13
13
|
s.extra_rdoc_files = Dir["*.rdoc"]
|
14
14
|
s.files = %w(README.rdoc Rakefile golia.gemspec) + Dir["lib/**/*"]
|
data/lib/golia.rb
CHANGED
@@ -5,9 +5,13 @@ require 'benchmark'
|
|
5
5
|
require 'tmpdir'
|
6
6
|
|
7
7
|
class Golia
|
8
|
-
def initialize(
|
9
|
-
@host =
|
10
|
-
|
8
|
+
def initialize(link)
|
9
|
+
@host = begin
|
10
|
+
link = "http://#{link}" unless link =~ /^http/
|
11
|
+
"http://" + URI.parse(link).host
|
12
|
+
rescue
|
13
|
+
puts "<= Invalid url #{link}"
|
14
|
+
end
|
11
15
|
@pid = "#{Dir.tmpdir}/golia-#{@host.gsub(/^http:\/\//, '')}"
|
12
16
|
@checked, @links, @invalid, @valid, @long, @ms = [], [], [], [], [], []
|
13
17
|
|
@@ -18,7 +22,7 @@ class Golia
|
|
18
22
|
|
19
23
|
trap("INT") { puts "<= Golia has ended his set (crowd applauds)"; kill; Process.kill(9, Process.pid) }
|
20
24
|
|
21
|
-
parse!(
|
25
|
+
parse!(link)
|
22
26
|
end
|
23
27
|
|
24
28
|
def parse!(url)
|