golia 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +2 -1
  2. data/golia.gemspec +13 -12
  3. data/lib/golia.rb +16 -11
  4. 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 = "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."
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.executables = ["golia"]
11
- s.version = "1.3.1"
12
- s.date = Time.now.strftime("%Y-%m-%d")
13
- s.extra_rdoc_files = Dir["*.rdoc"]
14
- s.files = %w(README.rdoc Rakefile golia.gemspec) + Dir["lib/**/*"]
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 staled pid"
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
- return if File.extname(url) != ""
38
- body = response.read
39
- links = body.scan(/href=["'](.+?)["']/m).flatten
40
- links += body.scan(/<script.+?src=["'](.+?)["']/m).flatten
41
- links.reject! do |link|
42
- link =~ /^\/$|^https?|^mailto|^javascript|#|"|'/ ||
43
- File.extname(link) !~ /\.css|\.js|^$/
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
- hash: 25
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 3
9
- - 1
10
- version: 1.3.1
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-05-05 00:00:00 +02:00
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.5.2
61
+ rubygems_version: 1.3.6
67
62
  signing_key:
68
63
  specification_version: 3
69
64
  summary: Dead Links Checker and Speed Analyzer