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.
Files changed (3) hide show
  1. data/golia.gemspec +1 -1
  2. data/lib/golia.rb +8 -4
  3. 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.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(host)
9
- @host = host
10
- @host = "http://#{@host}" unless @host =~ /^http/
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!(@host)
25
+ parse!(link)
22
26
  end
23
27
 
24
28
  def parse!(url)
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golia
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
- version: "1.1"
8
+ - 2
9
+ version: "1.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - DAddYE