sitemap_ping 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +4 -0
- data/README.md +31 -0
- data/Rakefile +14 -0
- data/lib/sitemap_ping.rb +53 -0
- data/sitemap_ping.gemspec +30 -0
- metadata +73 -0
data/Manifest
ADDED
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Sitemap Ping
|
2
|
+
====
|
3
|
+
|
4
|
+
Ruby module for ping xml sitemaps to search engines.
|
5
|
+
|
6
|
+
###Installation:
|
7
|
+
<pre>
|
8
|
+
gem install sitemap_ping
|
9
|
+
</pre>
|
10
|
+
|
11
|
+
###Usage:
|
12
|
+
<pre>
|
13
|
+
require 'sitemap_ping'
|
14
|
+
|
15
|
+
# Yahoo! require an application id for the request.
|
16
|
+
# Get one here: https://developer.apps.yahoo.com/wsregapp/
|
17
|
+
SitemapPing::PingEngines.yahoo_app_id=(YAHOO_APP_ID)
|
18
|
+
|
19
|
+
# Send sitemap to search engines.
|
20
|
+
SitemapPing::PingEngines.ping("http://mycoolsite.com/sitemap.xml")
|
21
|
+
|
22
|
+
# Get errors log. Return an array with all catched errors during sending sitemap process.
|
23
|
+
SitemapPing::Errors.all
|
24
|
+
</pre>
|
25
|
+
|
26
|
+
###Supported search engines:
|
27
|
+
|
28
|
+
- Google
|
29
|
+
- Bing
|
30
|
+
- Yahoo!
|
31
|
+
- Ask
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "rake"
|
3
|
+
require "echoe"
|
4
|
+
|
5
|
+
Echoe.new("sitemap_ping", "0.0.1") do |p|
|
6
|
+
p.description = "Ruby module for ping xml sitemaps to search engines."
|
7
|
+
p.url = "http://www.freshco.it"
|
8
|
+
p.author = "Dumitru Ceban"
|
9
|
+
p.email = "awstin.at@gmail.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/lib/sitemap_ping.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
module SitemapPing
|
2
|
+
class PingEngines
|
3
|
+
|
4
|
+
# Set yahoo application id.
|
5
|
+
def self.yahoo_app_id=(yahoo_app_id)
|
6
|
+
@yahoo_app_id = yahoo_app_id
|
7
|
+
end
|
8
|
+
|
9
|
+
# List of raw search engines ping urls.
|
10
|
+
def self.engines
|
11
|
+
{
|
12
|
+
:google => "http://www.google.com/webmasters/tools/ping?sitemap=",
|
13
|
+
:bing => "http://www.bing.com/webmaster/ping.aspx?siteMap=",
|
14
|
+
:yahoo => "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=#{@yahoo_app_id}&url=",
|
15
|
+
:ask => "http://submissions.ask.com/ping?sitemap="
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Make a ping request.
|
20
|
+
def self.ping(sitemap)
|
21
|
+
self.engines.each do |engine, url|
|
22
|
+
next if engine == :yahoo and !@yahoo_app_id
|
23
|
+
|
24
|
+
begin
|
25
|
+
ping_url = url + CGI::escape(sitemap)
|
26
|
+
trans = open(ping_url)
|
27
|
+
rescue Exception => error
|
28
|
+
SitemapPing::Errors.add(error)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
class Errors
|
38
|
+
# Add an error to the list.
|
39
|
+
def self.add(error)
|
40
|
+
self.all << error
|
41
|
+
end
|
42
|
+
|
43
|
+
# Clear errors list.
|
44
|
+
def self.delete_all
|
45
|
+
@errors = []
|
46
|
+
end
|
47
|
+
|
48
|
+
# List all errors.
|
49
|
+
def self.all
|
50
|
+
@errors ||= []
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{sitemap_ping}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Dumitru Ceban"]
|
9
|
+
s.date = %q{2010-04-23}
|
10
|
+
s.description = %q{Ruby module for ping xml sitemaps to search engines.}
|
11
|
+
s.email = %q{awstin.at@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["README.md", "lib/sitemap_ping.rb"]
|
13
|
+
s.files = ["Manifest", "README.md", "Rakefile", "lib/sitemap_ping.rb", "sitemap_ping.gemspec"]
|
14
|
+
s.homepage = %q{http://www.freshco.it}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sitemap_ping", "--main", "README.md"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{sitemap_ping}
|
18
|
+
s.rubygems_version = %q{1.3.6}
|
19
|
+
s.summary = %q{Ruby module for ping xml sitemaps to search engines.}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sitemap_ping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dumitru Ceban
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-23 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Ruby module for ping xml sitemaps to search engines.
|
22
|
+
email: awstin.at@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.md
|
29
|
+
- lib/sitemap_ping.rb
|
30
|
+
files:
|
31
|
+
- Manifest
|
32
|
+
- README.md
|
33
|
+
- Rakefile
|
34
|
+
- lib/sitemap_ping.rb
|
35
|
+
- sitemap_ping.gemspec
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://www.freshco.it
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --line-numbers
|
43
|
+
- --inline-source
|
44
|
+
- --title
|
45
|
+
- Sitemap_ping
|
46
|
+
- --main
|
47
|
+
- README.md
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 2
|
64
|
+
version: "1.2"
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project: sitemap_ping
|
68
|
+
rubygems_version: 1.3.6
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Ruby module for ping xml sitemaps to search engines.
|
72
|
+
test_files: []
|
73
|
+
|