validate-website 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require "rspec/core/rake_task" # RSpec 2.0
7
7
  # Globals
8
8
 
9
9
  PKG_NAME = 'validate-website'
10
- PKG_VERSION = '0.5.0'
10
+ PKG_VERSION = '0.5.1'
11
11
 
12
12
  PKG_FILES = ['README.rdoc', 'Rakefile', 'LICENSE']
13
13
  Find.find('bin/', 'lib/', 'man/', 'spec/') do |f|
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ # encoding: utf-8
3
+
4
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
5
+ $:.unshift(File.expand_path(lib_dir))
3
6
 
4
7
  developer_mode = false
5
8
  developer_mode = true if __FILE__ == $0
@@ -92,17 +92,6 @@ class ValidateWebsite
92
92
  opts.parse!(args)
93
93
  end
94
94
 
95
- def get_url(page, elem, attrname)
96
- u = elem.attributes[attrname] if elem.attributes[attrname]
97
- return if u.nil?
98
- begin
99
- abs = page.to_absolute(URI(u))
100
- rescue
101
- abs = nil
102
- end
103
- return abs if abs && page.in_domain?(abs)
104
- end
105
-
106
95
  def crawl(site, opts={})
107
96
  @anemone = Anemone.crawl(site, opts) do |anemone|
108
97
  anemone.skip_links_like Regexp.new(opts[:exclude]) if opts[:exclude]
@@ -121,7 +110,7 @@ class ValidateWebsite
121
110
  end
122
111
  if p.content_type == 'text/css'
123
112
  p.body.scan(/url\((['".\/\w-]+)\)/).each do |url|
124
- url = url.to_s.gsub("'", "").gsub('"', '')
113
+ url = url.first.gsub("'", "").gsub('"', '')
125
114
  abs = p.to_absolute(URI(url))
126
115
  links << abs
127
116
  end
@@ -175,4 +164,15 @@ class ValidateWebsite
175
164
  def to_file(msg)
176
165
  open(options[:file], 'a').write("#{msg}\n") if options[:file]
177
166
  end
167
+
168
+ def get_url(page, elem, attrname)
169
+ u = elem.attributes[attrname] if elem.attributes[attrname]
170
+ return if u.nil?
171
+ begin
172
+ abs = page.to_absolute(URI(u))
173
+ rescue
174
+ abs = nil
175
+ end
176
+ return abs if abs && page.in_domain?(abs)
177
+ end
178
178
  end
@@ -1,8 +1,9 @@
1
- require 'rubygems'
2
- require File.dirname(__FILE__) + '/fakeweb_helper'
3
-
4
- $:.unshift(File.dirname(__FILE__) + '/../lib/')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'fakeweb_helper'))
5
2
  require 'anemone'
3
+
4
+ lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
5
+ $:.unshift(File.expand_path(lib_dir))
6
+
6
7
  require 'validate_website'
7
8
 
8
9
  SPEC_DOMAIN = 'http://www.example.com/'
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
 
3
3
  describe ValidateWebsite do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
 
3
3
  describe Validator do
4
4
  before(:each) do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-website
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Laurent Arnoud
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-01 00:00:00 +01:00
18
+ date: 2010-11-04 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency