vidibus-validate_uri 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,4 +1,4 @@
1
- require "net/http"
1
+ require "net/https"
2
2
  require "uri"
3
3
 
4
4
  module Vidibus
@@ -41,9 +41,17 @@ module Vidibus
41
41
  _uri = URI.parse(uri)
42
42
  path = _uri.path.blank? ? "/" : _uri.path
43
43
  begin
44
- Net::HTTP.start(_uri.host, _uri.port) { |http| http.head(path) }
44
+ http = Net::HTTP.new(_uri.host, _uri.port)
45
+ if _uri.scheme == "https"
46
+ http.use_ssl = true
47
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
48
+ end
49
+ http.start { |http| http.head(path) }
45
50
  true
46
- rescue
51
+ rescue => e
52
+ if Rails.logger
53
+ Rails.logger.error "Accessing #{_uri.host} on port #{_uri.port} failed: #{e.inspect}"
54
+ end
47
55
  false
48
56
  end
49
57
  end
@@ -192,11 +192,23 @@ describe "Vidibus::ValidateUri::Core" do
192
192
  test.accessible_uri?(uri).should be_true
193
193
  end
194
194
 
195
+ it "should validate https://encrypted.google.com" do
196
+ uri = "https://encrypted.google.com"
197
+ test.accessible_uri?(uri).should be_true
198
+ end
199
+
195
200
  it "should fail for http://www.vidibus.zzz" do
196
201
  uri = "http://www.vidibus.zzz"
197
202
  test.accessible_uri?(uri).should be_false
198
203
  end
199
204
 
205
+ it "should log error with Rails.logger, if available" do
206
+ uri = "http://www.vidibus.zzz"
207
+ mock(Rails).logger.any_number_of_times {true}
208
+ mock(Rails.logger).error.with_any_args
209
+ test.accessible_uri?(uri)
210
+ end
211
+
200
212
  it "should not perform accessibility check of syntactically invalid URIs" do
201
213
  uri = "http://invalid"
202
214
  dont_allow(URI).parse
@@ -1,54 +1,52 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vidibus-validate_uri}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andre Pankratz"]
12
- s.date = %q{2010-09-23}
12
+ s.date = %q{2010-12-01}
13
13
  s.description = %q{It provides validation of URIs (URLs) to ActiveModel records and ActionControllers in Rails 3.}
14
14
  s.email = %q{andre@vidibus.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- ".rspec",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE",
26
- "README.rdoc",
27
- "Rakefile",
28
- "VERSION",
29
- "config/locales/en.yml",
30
- "lib/vidibus-validate_uri.rb",
31
- "lib/vidibus/validate_uri.rb",
32
- "lib/vidibus/validate_uri/core.rb",
33
- "lib/vidibus/validate_uri/extensions.rb",
34
- "lib/vidibus/validate_uri/extensions/controller.rb",
35
- "lib/vidibus/validate_uri/uri_validator.rb",
36
- "spec/spec_helper.rb",
37
- "spec/vidibus/validate_uri/action_controller_spec.rb",
38
- "spec/vidibus/validate_uri/core_spec.rb",
39
- "spec/vidibus/validate_uri/uri_validator_spec.rb",
40
- "vidibus-validate_uri.gemspec"
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "config/locales/en.yml",
29
+ "lib/vidibus-validate_uri.rb",
30
+ "lib/vidibus/validate_uri.rb",
31
+ "lib/vidibus/validate_uri/core.rb",
32
+ "lib/vidibus/validate_uri/extensions.rb",
33
+ "lib/vidibus/validate_uri/extensions/controller.rb",
34
+ "lib/vidibus/validate_uri/uri_validator.rb",
35
+ "spec/spec_helper.rb",
36
+ "spec/vidibus/validate_uri/action_controller_spec.rb",
37
+ "spec/vidibus/validate_uri/core_spec.rb",
38
+ "spec/vidibus/validate_uri/uri_validator_spec.rb",
39
+ "vidibus-validate_uri.gemspec"
41
40
  ]
42
41
  s.homepage = %q{http://github.com/vidibus/vidibus-validate_uri}
43
- s.rdoc_options = ["--charset=UTF-8"]
44
42
  s.require_paths = ["lib"]
45
43
  s.rubygems_version = %q{1.3.7}
46
44
  s.summary = %q{Provides an URI validator for Rails 3.}
47
45
  s.test_files = [
48
46
  "spec/spec_helper.rb",
49
- "spec/vidibus/validate_uri/action_controller_spec.rb",
50
- "spec/vidibus/validate_uri/core_spec.rb",
51
- "spec/vidibus/validate_uri/uri_validator_spec.rb"
47
+ "spec/vidibus/validate_uri/action_controller_spec.rb",
48
+ "spec/vidibus/validate_uri/core_spec.rb",
49
+ "spec/vidibus/validate_uri/uri_validator_spec.rb"
52
50
  ]
53
51
 
54
52
  if s.respond_to? :specification_version then
@@ -56,13 +54,28 @@ Gem::Specification.new do |s|
56
54
  s.specification_version = 3
57
55
 
58
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ s.add_runtime_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
59
+ s.add_runtime_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
60
+ s.add_runtime_dependency(%q<rr>, [">= 0"])
61
+ s.add_runtime_dependency(%q<relevance-rcov>, [">= 0"])
59
62
  s.add_development_dependency(%q<rspec>, [">= 0"])
60
63
  s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
61
64
  else
65
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
66
+ s.add_dependency(%q<rails>, ["~> 3.0.0"])
67
+ s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
68
+ s.add_dependency(%q<rr>, [">= 0"])
69
+ s.add_dependency(%q<relevance-rcov>, [">= 0"])
62
70
  s.add_dependency(%q<rspec>, [">= 0"])
63
71
  s.add_dependency(%q<rails>, ["~> 3.0.0"])
64
72
  end
65
73
  else
74
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
75
+ s.add_dependency(%q<rails>, ["~> 3.0.0"])
76
+ s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
77
+ s.add_dependency(%q<rr>, [">= 0"])
78
+ s.add_dependency(%q<relevance-rcov>, [">= 0"])
66
79
  s.add_dependency(%q<rspec>, [">= 0"])
67
80
  s.add_dependency(%q<rails>, ["~> 3.0.0"])
68
81
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-validate_uri
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Pankratz
@@ -15,13 +15,78 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-23 00:00:00 +02:00
18
+ date: 2010-12-01 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ prerelease: false
24
+ name: bundler
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ hash: 23
31
+ segments:
32
+ - 1
33
+ - 0
34
+ - 0
35
+ version: 1.0.0
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ type: :runtime
39
+ prerelease: false
40
+ name: rails
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ hash: 7
47
+ segments:
48
+ - 3
49
+ - 0
50
+ - 0
51
+ version: 3.0.0
52
+ requirement: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ type: :runtime
55
+ prerelease: false
22
56
  name: rspec
57
+ version_requirements: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ hash: 62196427
63
+ segments:
64
+ - 2
65
+ - 0
66
+ - 0
67
+ - beta
68
+ - 20
69
+ version: 2.0.0.beta.20
70
+ requirement: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ type: :runtime
73
+ prerelease: false
74
+ name: rr
75
+ version_requirements: &id004 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 3
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirement: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ type: :runtime
23
87
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
88
+ name: relevance-rcov
89
+ version_requirements: &id005 !ruby/object:Gem::Requirement
25
90
  none: false
26
91
  requirements:
27
92
  - - ">="
@@ -30,12 +95,26 @@ dependencies:
30
95
  segments:
31
96
  - 0
32
97
  version: "0"
98
+ requirement: *id005
99
+ - !ruby/object:Gem::Dependency
33
100
  type: :development
34
- version_requirements: *id001
101
+ prerelease: false
102
+ name: rspec
103
+ version_requirements: &id006 !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ requirement: *id006
35
113
  - !ruby/object:Gem::Dependency
36
- name: rails
114
+ type: :runtime
37
115
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
116
+ name: rails
117
+ version_requirements: &id007 !ruby/object:Gem::Requirement
39
118
  none: false
40
119
  requirements:
41
120
  - - ~>
@@ -46,8 +125,7 @@ dependencies:
46
125
  - 0
47
126
  - 0
48
127
  version: 3.0.0
49
- type: :runtime
50
- version_requirements: *id002
128
+ requirement: *id007
51
129
  description: It provides validation of URIs (URLs) to ActiveModel records and ActionControllers in Rails 3.
52
130
  email: andre@vidibus.com
53
131
  executables: []
@@ -59,7 +137,6 @@ extra_rdoc_files:
59
137
  - README.rdoc
60
138
  files:
61
139
  - .document
62
- - .gitignore
63
140
  - .rspec
64
141
  - Gemfile
65
142
  - Gemfile.lock
@@ -84,8 +161,8 @@ homepage: http://github.com/vidibus/vidibus-validate_uri
84
161
  licenses: []
85
162
 
86
163
  post_install_message:
87
- rdoc_options:
88
- - --charset=UTF-8
164
+ rdoc_options: []
165
+
89
166
  require_paths:
90
167
  - lib
91
168
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC