site_checker 0.2.0.pre → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## [v0.2.0](https://github.com/ZsoltFabok/site_checker/compare/v0.1.1...v0.2.0)
2
+
3
+ ### Notes
4
+ * the API has changed, please check the [README.md](https://github.com/ZsoltFabok/site_checker/blob/1d616b8a446ed7af98b9ac3785e6b7f92e717f72/README.md) for more details
5
+
6
+ ### Fixes
7
+ * performance improvements (Zsolt Fabok)
8
+ * the referenced URIs appear in the problem report exactly as they are specified in the sites (Zsolt Fabok)
9
+ * recognize an anchor which refers to another site (Zsolt Fabok)
10
+ * a not found reference is reported at each occurrence (Zsolt Fabok)
11
+
12
+ ### Other Changes
13
+ * [code climate](https://codeclimate.com/github/ZsoltFabok/site_checker) improvements: D -> A (Zsolt Fabok)
14
+ * better gem structure (Zsolt Fabok)
15
+ * a local URI with an absolute path is also visited (Zsolt Fabok)
16
+ * travis, gemnasium integration (Zsolt Fabok)
17
+ * ruby-docs (Zsolt Fabok)
18
+
1
19
  ## [v0.1.1](https://github.com/ZsoltFabok/site_checker/compare/v0.1.0...v0.1.1)
2
20
 
3
21
  ### Fixes
@@ -1,13 +1,14 @@
1
1
  module SiteChecker
2
2
  class Link
3
3
  attr_accessor :url
4
+ attr_accessor :modified_url
4
5
  attr_accessor :parent_url
5
6
  attr_accessor :kind
6
7
  attr_accessor :location
7
8
  attr_accessor :problem
8
9
 
9
10
  def eql?(other)
10
- ignore_trailing_slash(@url).eql? ignore_trailing_slash(other.url)
11
+ @modified_url.eql? other.modified_url
11
12
  end
12
13
 
13
14
  def ==(other)
@@ -15,7 +16,7 @@ module SiteChecker
15
16
  end
16
17
 
17
18
  def hash
18
- ignore_trailing_slash(@url).hash
19
+ @modified_url.hash
19
20
  end
20
21
 
21
22
  def self.create(attrs)
@@ -28,6 +29,16 @@ module SiteChecker
28
29
  link
29
30
  end
30
31
 
32
+ def parent_url=(parent_url)
33
+ @modified_url = "#{parent_url}##{@url}" if anchor?
34
+ @parent_url = parent_url
35
+ end
36
+
37
+ def url=(url)
38
+ @modified_url = ignore_trailing_slash(url)
39
+ @url = url
40
+ end
41
+
31
42
  def has_problem?
32
43
  @problem != nil
33
44
  end
@@ -10,7 +10,7 @@ module SiteChecker
10
10
  end
11
11
 
12
12
  def check(url, root)
13
- @links = []
13
+ @links = {}
14
14
  @recursion_depth = 0
15
15
  @root = root
16
16
 
@@ -40,7 +40,7 @@ module SiteChecker
40
40
 
41
41
  def problems
42
42
  problems = {}
43
- @links.each do |link|
43
+ @links.keys.each do |link|
44
44
  if link.has_problem?
45
45
  problems[link.parent_url] ||= []
46
46
  problems[link.parent_url] << "#{link.url} #{link.problem}"
@@ -59,7 +59,7 @@ module SiteChecker
59
59
  end
60
60
 
61
61
  def get_urls(location, kind)
62
- @links.find_all do |link|
62
+ @links.keys.find_all do |link|
63
63
  if link.location == location && link.kind == kind
64
64
  link
65
65
  end
@@ -76,17 +76,17 @@ module SiteChecker
76
76
  unless link.anchor_related?
77
77
  visit(link) unless visited?(link)
78
78
  else
79
- @links << link
79
+ @links[link] = nil
80
80
  end
81
81
  end
82
82
  end
83
83
 
84
84
  def register_visit(link)
85
- @links << link unless visited?(link)
85
+ @links[link] = nil unless visited?(link)
86
86
  end
87
87
 
88
88
  def visited?(link)
89
- @links.include?(link)
89
+ @links.has_key?(link)
90
90
  end
91
91
 
92
92
  def visit(link)
@@ -128,8 +128,8 @@ module SiteChecker
128
128
  end
129
129
 
130
130
  def evaluate_anchors
131
- anchors = @links.find_all {|link| link.anchor?}
132
- anchor_references = @links.find_all {|link| link.anchor_ref?}
131
+ anchors = @links.keys.find_all {|link| link.anchor?}
132
+ anchor_references = @links.keys.find_all {|link| link.anchor_ref?}
133
133
  anchor_references.each do |anchor_ref|
134
134
  if find_matching_anchor(anchors, anchor_ref).empty?
135
135
  anchor_ref.problem = "(404 Not Found)"
data/site_checker.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'site_checker'
4
- s.version = '0.2.0.pre'
5
- s.date = '2012-12-22'
4
+ s.version = '0.2.0'
5
+ s.date = '2012-12-23'
6
6
  s.summary = "site_checker-#{s.version}"
7
7
  s.description = "A simple tool for checking references on your website"
8
8
  s.authors = ["Zsolt Fabok"]
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre
5
- prerelease: 6
4
+ version: 0.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Zsolt Fabok
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-22 00:00:00.000000000 Z
12
+ date: 2012-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -135,21 +135,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
135
  - - ! '>='
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
- segments:
139
- - 0
140
- hash: 3689641992990100431
141
138
  required_rubygems_version: !ruby/object:Gem::Requirement
142
139
  none: false
143
140
  requirements:
144
- - - ! '>'
141
+ - - ! '>='
145
142
  - !ruby/object:Gem::Version
146
- version: 1.3.1
143
+ version: '0'
147
144
  requirements: []
148
145
  rubyforge_project:
149
146
  rubygems_version: 1.8.23
150
147
  signing_key:
151
148
  specification_version: 3
152
- summary: site_checker-0.2.0.pre
149
+ summary: site_checker-0.2.0
153
150
  test_files:
154
151
  - spec/dsl_spec.rb
155
152
  - spec/integration_spec.rb