webrobots 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,6 +10,6 @@ group :development do
10
10
  gem "racc", ">= 0"
11
11
  gem "shoulda", ">= 0"
12
12
  gem "bundler", "~> 1.0.0"
13
- gem "jeweler", "~> 1.5.1"
13
+ gem "jeweler", "~> 1.6.2"
14
14
  gem "rcov", ">= 0"
15
15
  end
data/Gemfile.lock CHANGED
@@ -2,13 +2,13 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  git (1.2.5)
5
- jeweler (1.5.2)
6
- bundler (~> 1.0.0)
5
+ jeweler (1.6.2)
6
+ bundler (~> 1.0)
7
7
  git (>= 1.2.5)
8
8
  rake
9
- nokogiri (1.4.4)
9
+ nokogiri (1.4.6)
10
10
  racc (1.4.6)
11
- rake (0.8.7)
11
+ rake (0.9.2)
12
12
  rcov (0.9.9)
13
13
  shoulda (2.11.3)
14
14
 
@@ -17,7 +17,7 @@ PLATFORMS
17
17
 
18
18
  DEPENDENCIES
19
19
  bundler (~> 1.0.0)
20
- jeweler (~> 1.5.1)
20
+ jeweler (~> 1.6.2)
21
21
  nokogiri (>= 1.4.4)
22
22
  racc
23
23
  rcov
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler'
3
5
  begin
@@ -21,9 +23,7 @@ This library helps write robots.txt compliant web robots in Ruby.
21
23
  EOS
22
24
  gem.email = "knu@idaemons.org"
23
25
  gem.authors = ["Akinori MUSHA"]
24
- # Include your dependencies below. Runtime dependencies are required when using your gem,
25
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
26
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
26
+ # dependencies defined in Gemfile
27
27
  end
28
28
  Jeweler::RubygemsDotOrgTasks.new
29
29
 
@@ -39,6 +39,7 @@ Rcov::RcovTask.new do |test|
39
39
  test.libs << 'test'
40
40
  test.pattern = 'test/**/test_*.rb'
41
41
  test.verbose = true
42
+ test.rcov_opts << '--exclude "gems/*"'
42
43
  end
43
44
 
44
45
  task :default => :test
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -46,7 +46,7 @@ module_eval(<<'...end robotstxt.ry/module_eval...', 'robotstxt.ry', 163)
46
46
  value_expected = false
47
47
 
48
48
  until s.eos?
49
- if t = s.scan(/[ \t]*\r?\n/)
49
+ if t = s.scan(/[ \t]*(?:\r?\n|\z)/)
50
50
  if value_expected
51
51
  @q << [:VALUE, '']
52
52
  end
@@ -186,7 +186,7 @@ class WebRobots
186
186
  value_expected = false
187
187
 
188
188
  until s.eos?
189
- if t = s.scan(/[ \t]*\r?\n/)
189
+ if t = s.scan(/[ \t]*(?:\r?\n|\z)/)
190
190
  if value_expected
191
191
  @q << [:VALUE, '']
192
192
  end
@@ -545,4 +545,41 @@ Disallow: /
545
545
  assert_equal 'content', body
546
546
  end
547
547
  end
548
+
549
+ context "robots.txt with a space at the end of the last line" do
550
+ setup do
551
+ @robots = WebRobots.new('RandomBot', :http_get => lambda { |uri|
552
+ res = case uri.to_s
553
+ when 'http://site1.example.com/robots.txt'
554
+ <<-'TXT'
555
+ User-agent: *
556
+ Request-rate: 1/30
557
+ Disallow: /util/
558
+
559
+ Sitemap: http://site1.example.com/text/sitemap.xml
560
+
561
+ TXT
562
+ when 'http://site2.example.com/robots.txt'
563
+ <<-'TXT'
564
+ User-agent: *
565
+ Request-rate: 1/30
566
+ Disallow: /util/
567
+
568
+ Sitemap: http://site2.example.com/text/sitemap.xml
569
+ TXT
570
+ else
571
+ raise "#{uri} is not supposed to be fetched"
572
+ end
573
+ # This chomp is actually key to the test. Remove the final EOL.
574
+ # The final line should be the one ending with the space.
575
+ res.chomp
576
+ })
577
+ end
578
+
579
+ should "be properly parsed" do
580
+ assert_equal(["http://site1.example.com/text/sitemap.xml"], @robots.sitemaps("http://site1.example.com/"))
581
+ assert_equal(["http://site2.example.com/text/sitemap.xml"], @robots.sitemaps("http://site2.example.com/"))
582
+ end
583
+ end
584
+
548
585
  end
data/webrobots.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{webrobots}
8
- s.version = "0.0.9"
8
+ s.version = "0.0.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Akinori MUSHA"]
12
- s.date = %q{2011-04-11}
11
+ s.authors = [%q{Akinori MUSHA}]
12
+ s.date = %q{2011-07-01}
13
13
  s.description = %q{This library helps write robots.txt compliant web robots in Ruby.
14
14
  }
15
15
  s.email = %q{knu@idaemons.org}
@@ -33,14 +33,10 @@ Gem::Specification.new do |s|
33
33
  "test/test_webrobots.rb",
34
34
  "webrobots.gemspec"
35
35
  ]
36
- s.licenses = ["2-clause BSDL"]
37
- s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.6.2}
36
+ s.licenses = [%q{2-clause BSDL}]
37
+ s.require_paths = [%q{lib}]
38
+ s.rubygems_version = %q{1.8.5}
39
39
  s.summary = %q{A Ruby library to help write robots.txt compliant web robots}
40
- s.test_files = [
41
- "test/helper.rb",
42
- "test/test_webrobots.rb"
43
- ]
44
40
 
45
41
  if s.respond_to? :specification_version then
46
42
  s.specification_version = 3
@@ -50,14 +46,14 @@ Gem::Specification.new do |s|
50
46
  s.add_development_dependency(%q<racc>, [">= 0"])
51
47
  s.add_development_dependency(%q<shoulda>, [">= 0"])
52
48
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
53
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
49
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
54
50
  s.add_development_dependency(%q<rcov>, [">= 0"])
55
51
  else
56
52
  s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
57
53
  s.add_dependency(%q<racc>, [">= 0"])
58
54
  s.add_dependency(%q<shoulda>, [">= 0"])
59
55
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
61
57
  s.add_dependency(%q<rcov>, [">= 0"])
62
58
  end
63
59
  else
@@ -65,7 +61,7 @@ Gem::Specification.new do |s|
65
61
  s.add_dependency(%q<racc>, [">= 0"])
66
62
  s.add_dependency(%q<shoulda>, [">= 0"])
67
63
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
68
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
69
65
  s.add_dependency(%q<rcov>, [">= 0"])
70
66
  end
71
67
  end
metadata CHANGED
@@ -1,125 +1,92 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: webrobots
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.10
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 9
10
- version: 0.0.9
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Akinori MUSHA
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-04-11 00:00:00 +09:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-07-01 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: nokogiri
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &17196464340 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 15
29
- segments:
30
- - 1
31
- - 4
32
- - 4
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 1.4.4
34
- prerelease: false
35
22
  type: :runtime
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: *17196464340
25
+ - !ruby/object:Gem::Dependency
38
26
  name: racc
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &17196463180 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
48
- prerelease: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
49
33
  type: :development
50
- requirement: *id002
51
- - !ruby/object:Gem::Dependency
34
+ prerelease: false
35
+ version_requirements: *17196463180
36
+ - !ruby/object:Gem::Dependency
52
37
  name: shoulda
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &17196462340 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
62
- prerelease: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
63
44
  type: :development
64
- requirement: *id003
65
- - !ruby/object:Gem::Dependency
45
+ prerelease: false
46
+ version_requirements: *17196462340
47
+ - !ruby/object:Gem::Dependency
66
48
  name: bundler
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &17196461320 !ruby/object:Gem::Requirement
68
50
  none: false
69
- requirements:
51
+ requirements:
70
52
  - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 23
73
- segments:
74
- - 1
75
- - 0
76
- - 0
53
+ - !ruby/object:Gem::Version
77
54
  version: 1.0.0
78
- prerelease: false
79
55
  type: :development
80
- requirement: *id004
81
- - !ruby/object:Gem::Dependency
56
+ prerelease: false
57
+ version_requirements: *17196461320
58
+ - !ruby/object:Gem::Dependency
82
59
  name: jeweler
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
60
+ requirement: &17196460320 !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
62
+ requirements:
86
63
  - - ~>
87
- - !ruby/object:Gem::Version
88
- hash: 1
89
- segments:
90
- - 1
91
- - 5
92
- - 1
93
- version: 1.5.1
94
- prerelease: false
64
+ - !ruby/object:Gem::Version
65
+ version: 1.6.2
95
66
  type: :development
96
- requirement: *id005
97
- - !ruby/object:Gem::Dependency
67
+ prerelease: false
68
+ version_requirements: *17196460320
69
+ - !ruby/object:Gem::Dependency
98
70
  name: rcov
99
- version_requirements: &id006 !ruby/object:Gem::Requirement
71
+ requirement: &17196459400 !ruby/object:Gem::Requirement
100
72
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
108
- prerelease: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
109
77
  type: :development
110
- requirement: *id006
111
- description: |
112
- This library helps write robots.txt compliant web robots in Ruby.
78
+ prerelease: false
79
+ version_requirements: *17196459400
80
+ description: ! 'This library helps write robots.txt compliant web robots in Ruby.
113
81
 
82
+ '
114
83
  email: knu@idaemons.org
115
84
  executables: []
116
-
117
85
  extensions: []
118
-
119
- extra_rdoc_files:
86
+ extra_rdoc_files:
120
87
  - LICENSE.txt
121
88
  - README.rdoc
122
- files:
89
+ files:
123
90
  - .document
124
91
  - Gemfile
125
92
  - Gemfile.lock
@@ -134,40 +101,32 @@ files:
134
101
  - test/helper.rb
135
102
  - test/test_webrobots.rb
136
103
  - webrobots.gemspec
137
- has_rdoc: true
138
104
  homepage:
139
- licenses:
105
+ licenses:
140
106
  - 2-clause BSDL
141
107
  post_install_message:
142
108
  rdoc_options: []
143
-
144
- require_paths:
109
+ require_paths:
145
110
  - lib
146
- required_ruby_version: !ruby/object:Gem::Requirement
111
+ required_ruby_version: !ruby/object:Gem::Requirement
147
112
  none: false
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- hash: 3
152
- segments:
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ segments:
153
118
  - 0
154
- version: "0"
155
- required_rubygems_version: !ruby/object:Gem::Requirement
119
+ hash: 1141598142888730213
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
121
  none: false
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- hash: 3
161
- segments:
162
- - 0
163
- version: "0"
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
164
126
  requirements: []
165
-
166
127
  rubyforge_project:
167
- rubygems_version: 1.6.2
128
+ rubygems_version: 1.8.5
168
129
  signing_key:
169
130
  specification_version: 3
170
131
  summary: A Ruby library to help write robots.txt compliant web robots
171
- test_files:
172
- - test/helper.rb
173
- - test/test_webrobots.rb
132
+ test_files: []