Skip to content

Commit 91276cc

Browse files
committed
Removed the old unused validation methods.
1 parent 52d7e43 commit 91276cc

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ source "https://rubygems.org"
33
gem "rake"
44
gem "json"
55
gem "json-schema"
6-
gem "httparty"
7-
gem "work_queue"

Rakefile

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require "json"
22
require "json-schema"
3-
require "httparty"
4-
require "work_queue"
53

64
task default: "validate:json"
75

@@ -10,46 +8,4 @@ namespace :validate do
108
task :json do
119
JSON::Validator.validate!("schema_blogs.json", "blogs.json")
1210
end
13-
14-
desc "Ping each site and feed URLs and report any failures"
15-
task :ping do
16-
wq = WorkQueue.new 30
17-
# The top level of the JSON file contains an array of languages
18-
urls = Array.new
19-
languages = JSON.parse(File.read("blogs.json"))
20-
languages.each do |language|
21-
# Inside each language is an array of categories
22-
language["categories"].each do |category|
23-
# Inside each category is a list of sites
24-
category["sites"].each do |site|
25-
urls.push(URI(site["site_url"]))
26-
urls.push(URI(site["feed_url"]))
27-
end
28-
end
29-
end
30-
31-
urls.each do |url|
32-
wq.enqueue_b do
33-
ping_url(url)
34-
end
35-
end
36-
37-
wq.join
38-
end
39-
end
40-
41-
def ping_url(url)
42-
begin
43-
response = HTTParty.head(url, follow_redirects: true, timeout: 10)
44-
# Anything other than a 200 is classed as a faulure
45-
puts "#{response.code} for #{url}" unless response.code == 200
46-
rescue Net::OpenTimeout
47-
puts "Timeout for #{url}"
48-
rescue OpenSSL::SSL::SSLError
49-
puts "SSL Error for #{url}"
50-
rescue SocketError
51-
puts "Socket Error for #{url}"
52-
rescue => exception
53-
puts "#{exception.class} #{exception} for #{url}"
54-
end
5511
end

0 commit comments

Comments
 (0)