seotoolbox 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT-Lizenz
2
+ ==========
3
+
4
+ DE:
5
+ Copyright (c) 2009 Philipp Petersen
6
+
7
+ Hiermit wird unentgeltlich, jeder Person, die eine Kopie der Software und der zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt, uneingeschränkt zu benutzen, inklusive und ohne Ausnahme, dem Recht, sie zu verwenden, kopieren, ändern, fusionieren, verlegen, verbreiten, unterlizenzieren und/oder zu verkaufen, und Personen, die diese Software erhalten, diese Rechte zu geben, unter den folgenden Bedingungen:
8
+
9
+ Der obige Urheberrechtsvermerk und dieser Erlaubnisvermerk sind in alle Kopien oder Teilkopien der Software beizulegen.
10
+
11
+ DIE SOFTWARE WIRD OHNE JEDE AUSDRÜCKLICHE ODER IMPLIZIERTE GARANTIE BEREITGESTELLT, EINSCHLIESSLICH DER GARANTIE ZUR BENUTZUNG FÜR DEN VORGESEHENEN ODER EINEM BESTIMMTEN ZWECK SOWIE JEGLICHER RECHTSVERLETZUNG, JEDOCH NICHT DARAUF BESCHRÄNKT. IN KEINEM FALL SIND DIE AUTOREN ODER COPYRIGHTINHABER FÜR JEGLICHEN SCHADEN ODER SONSTIGE ANSPRÜCHE HAFTBAR ZU MACHEN, OB INFOLGE DER ERFÜLLUNG EINES VERTRAGES, EINES DELIKTES ODER ANDERS IM ZUSAMMENHANG MIT DER SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN.
12
+
13
+ ===================================
14
+ EN:
15
+ Copyright (c) 2009 Philipp Petersen
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,10 @@
1
+ lib/seo_toolbox.rb
2
+ LICENSE
3
+ rakefile
4
+ README
5
+ test/seo_toolbox_test.rb
6
+ test/temp/robots.txt
7
+ test/temp/sitemap.xml
8
+ test/temp/sitemap_data.dat
9
+ Rakefile
10
+ Manifest
data/README ADDED
@@ -0,0 +1,29 @@
1
+ == seo_toolbox
2
+
3
+ DE: seo_toolbox ist ein Projekt von Philipp Petersen. Es erlaubt, Google-valide XML-Sitemaps dynamisch zu erstellen.
4
+ Weiterhin kann die robots.txt erstellt und wichtige bzw. relevante Metatags generiert werden.
5
+
6
+ Die folgenden Methoden Existieren:
7
+ - include_metatags: Retuniert einen String mit Metatags, der direkt auf einer HTML-Seite eingebunden werden kann.
8
+ - save_new_url_to_sitemap?: Speichert eine neue URL in einer temporären Datei. Diese Methode erstellt noch keine Sitemap!
9
+ - create_xml_sitemap?: Erstellt aus den Daten innerhalb der temporären Datei die Sitemap.
10
+ - create_robots_txt?: Erstellt eine rorbots.txt Datei.
11
+
12
+ Für mehr Informationen bitte die Dokumentation unter http://blog.media-scientific.com/seo_toolbox einsehen.
13
+
14
+ Dieses Projekt steht unter der MIT-Lizenz.
15
+
16
+ ====================================================================================================================
17
+
18
+ EN: seo_toolbox is a project from Philipp Petersen. It permits, valid Google XML sitemaps create dynamically.
19
+ Furthermore, robots.txt and relevant or important meta tags can be generated.
20
+
21
+ Methods:
22
+ - include_metatags: Retuniert a string with meta tags, which points directly to an HTML page can be incorporated.
23
+ - save_new_url_to_sitemap?: Save a new URL into a temporary file. This method creates no sitemap!
24
+ - create_xml_sitemap?: Created from the data within the temporary file the Sitemap.
25
+ - create_robots_txt?: Creates a robot.txt file.
26
+
27
+ For more information, please vistsit http://blog.media-scientific.com/seo_toolbox.
28
+
29
+ This project is under the MIT license.
@@ -0,0 +1,72 @@
1
+ =begin
2
+ @author: Philipp Petersen
3
+ =end
4
+
5
+
6
+ require 'rubygems'
7
+ require 'rake'
8
+ require 'rake/clean'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/rdoctask'
11
+ require 'rake/testtask'
12
+ require 'spec/rake/spectask'
13
+ require 'echoe'
14
+
15
+
16
+
17
+ spec = Gem::Specification.new do |s|
18
+ s.name = 'seotoolbox'
19
+ s.homepage = "http://blog.media-scientific.com/seo_toolbox/"
20
+ s.platform = Gem::Platform::RUBY
21
+ s.rubyforge_project = 'seotoolbox'
22
+ s.version = '0.9.1'
23
+ s.has_rdoc = true
24
+ s.extra_rdoc_files = ['README', 'LICENSE']
25
+ s.summary = 'SeoToolbox create XML Sitemaps, Google Sitemaps and generates meta-tags and the robots.txt file.'
26
+ s.description = "SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps."
27
+ s.author = 'Philipp Petersen'
28
+ s.email = 'philipp.petersen@gmail.com'
29
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
30
+ s.require_path = "lib"
31
+ s.test_files = Dir.glob('test/*.rb')
32
+ end
33
+
34
+ Rake::GemPackageTask.new(spec) do |p|
35
+ p.gem_spec = spec
36
+ p.need_tar = true
37
+ p.need_zip = true
38
+ end
39
+
40
+ Rake::RDocTask.new do |rdoc|
41
+ files =['README', 'LICENSE', 'lib/**/*.rb', 'test/*.rb']
42
+ rdoc.rdoc_files.add(files)
43
+ rdoc.main = "README" # page to start on
44
+ rdoc.title = "rails_toolbox Docs"
45
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
46
+ rdoc.options << '--line-numbers'
47
+ rdoc.options << '--all'
48
+ rdoc.options << '--charset=UTF-8'
49
+ end
50
+
51
+ Rake::TestTask.new do |t|
52
+ FileUtils.mkdir_p 'test/temp'
53
+ t.test_files = FileList['test/**/*.rb']
54
+ end
55
+
56
+ Spec::Rake::SpecTask.new do |t|
57
+ t.spec_files = FileList['spec/**/*.rb']
58
+ end
59
+
60
+
61
+ Echoe.new('seotoolbox', '0.9.1') do |p|
62
+ p.description = "SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps."
63
+ p.url = "cvs.seotoolbox.rubyforge.org"
64
+ p.author = "Philipp Petersen"
65
+ p.email = "philipp.petersen@gmail.com"
66
+ p.ignore_pattern = ["svn_user.yml", "svn_project.rake"]
67
+ p.project = "seotoolbox"
68
+ end
69
+
70
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
71
+
72
+
@@ -0,0 +1,189 @@
1
+ #=@author: Philipp Petersen
2
+ #=@date: 04.06.2009
3
+ #=@license: MIT
4
+ #Klasse mit Tools für die Suchmaschinenoptimierung.
5
+ #
6
+ #*NOTE*:: Die Datei sitemap_data.dat ist nach dem folgenden Schema aufgebaut:
7
+ #* URL:::lastmod:::changefreq:::priority
8
+ #*INFO*:: Achten Sie darauf, dass zumindest die sitemap_data.dat in einem Verzeichnis liegt, dass bei dem deployment nicht überschrieben wird.</b>
9
+ class SeoToolbox
10
+ require 'date'
11
+ attr_reader :path_to_sitemap, :url, :changefreq, :priority, :path_to_data
12
+
13
+ VERSION="0.9.1"
14
+
15
+ #Mögliche Werte für changefreq:
16
+ #* always
17
+ #* hourly
18
+ #* daily
19
+ #* weekly
20
+ #* monthly
21
+ #* yearly
22
+ #* never
23
+ #Der Typische Wert der priority ist 0.5 und kann zwischen 0.0 und 1.0 liegen.
24
+ def initialize path_to_sitemap, path_to_data, url, changefreq='weekly', priority='1.0'
25
+ @url = url
26
+ @path_to_sitemap = path_to_sitemap
27
+ @changefreq = changefreq
28
+ @priority = priority
29
+ @path_to_data = path_to_data
30
+
31
+ #Prüfe ob das Temp-File bereits existiert:
32
+ if not File.exists?("#{path_to_data}/sitemap_data.dat")
33
+ save_new_url_to_sitemap?(@url, DateTime.now.strftime("%Y-%m-%d"), changefreq, priority)
34
+ else
35
+ #prüfe ob die Sitemap existiert. Existiert diese nicht, lege sie neu an:
36
+ if not File.exists?("#{path_to_sitemap}/sitemap.xml")
37
+ create_xml_sitemap?
38
+ end
39
+ end
40
+ end
41
+
42
+ #Retuniert alle für die OnPage-Optimierung relevanten Metatags. So können diese leicht in eine Rails-App eingefügt werden.
43
+ #options = {:keywords => 'String', :description => 'String', :author => 'String', :language => 'String', :robots => 'String'}
44
+ def self.include_metatags options={}
45
+ meta_str = ""
46
+ options.each_pair { |key, value|
47
+ meta_str << "<meta name=\"#{key}\" content=\"#{value}\" />\n"
48
+ }
49
+ meta_str << "<!--This site use the seo_toolbox gem from Philipp Petersen-->"
50
+ end
51
+
52
+ #Speichert eine neue URL in der Sitemap.lastmod="2009-01-31"
53
+ def save_new_url_to_sitemap? url, lastmod, changefreq=@changefreq, priority=@priority
54
+ begin
55
+ #Encoding:
56
+ url = url.gsub("&", "&amp;").gsub("'", "&apos;").gsub("\"", "&quot;").gsub(">", "&gt;").gsub("<", "&lt;")
57
+
58
+ #Prüfe ab, ob der Eintrag schon vorhanden ist:
59
+ if File.exists?("#{@path_to_data}/sitemap_data.dat")
60
+ #Speichere die Datei in einem Array
61
+ file_content = []
62
+ file = File.open("#{@path_to_data}/sitemap_data.dat")
63
+
64
+ file.each_line{ |line|
65
+ file_content.push(line)
66
+ }
67
+ file.close
68
+
69
+ file_content.each_index do |i|
70
+ if file_content[i].match(/^#{url}/)
71
+ file_content.delete_at(i)
72
+ end
73
+ end
74
+ file_content.push "#{url}:::#{lastmod}:::#{changefreq}:::#{priority}\n"
75
+
76
+ #schreibe wieder in das file zurück
77
+ file = File.open("#{@path_to_data}/sitemap_data.dat", "w")
78
+ file_content.each { |item| file << item }
79
+ file.close
80
+ else
81
+ file = File.open("#{@path_to_data}/sitemap_data.dat", "w")
82
+ file << "#{url}:::#{lastmod}:::#{changefreq}:::#{priority}\n"
83
+ file.close
84
+ end
85
+ return true
86
+ rescue
87
+ return false
88
+ end
89
+ end
90
+
91
+ #Löscht eine bestehende URL aus der Sitemap
92
+ def remove_url_from_sitemap? url
93
+ begin
94
+ url = url.gsub("&", "&amp;").gsub("'", "&apos;").gsub("\"", "&quot;").gsub(">", "&gt;").gsub("<", "&lt;")
95
+
96
+ file_content = []
97
+ file = File.open("#{@path_to_data}/sitemap_data.dat")
98
+ file.each_line{ |line|
99
+ file_content.push(line)
100
+ }
101
+ file.close
102
+
103
+ file_content.each_index do |i|
104
+ if file_content[i].match(/^#{url}/)
105
+ file_content.delete_at(i)
106
+ end
107
+ end
108
+
109
+ #schreibe wieder in das file zurück
110
+ file = File.open("#{@path_to_data}/sitemap_data.dat", "w")
111
+ file_content.each { |item| file << item }
112
+ file.close
113
+
114
+ return true
115
+ rescue
116
+ return false
117
+ end
118
+ end
119
+
120
+ def create_xml_sitemap?
121
+ if @url.empty? || @path_to_sitemap.empty?
122
+ return false
123
+ else
124
+ file = File.open("#{@path_to_sitemap}/sitemap.xml", "w")
125
+ file << get_xml_head
126
+
127
+ #Lese Daten ein:
128
+ data_file = File.new("#{@path_to_data}/sitemap_data.dat")
129
+ data_file.each_line{|line|
130
+ file << get_xml_url_element(line)
131
+ }
132
+ file << get_xml_url_bottom
133
+ data_file.close
134
+ file.close
135
+ return true
136
+ end
137
+ end
138
+
139
+ #Erstellt die Datei robots.txt in gewählten Verzeichnis
140
+ #
141
+ #Die URL zur sitemap wird automatisch eingefügt. Wird kein Inhalt für content angegeben, werden die Default-Werte eingesetzt:
142
+ #* User-Agent: *
143
+ #* Allow: /
144
+ def create_robots_txt? content, path_to_robots_txt=@path_to_sitemap
145
+ begin
146
+ file = File.open("#{path_to_robots_txt}/robots.txt", "w")
147
+ if content.nil?
148
+ file << "User-Agent: *\nAllow: /\n"
149
+ else
150
+ file << content
151
+ end
152
+ file << "Sitemap:#{@url}/sitemap.xml"
153
+ file.close
154
+ return true
155
+ rescue
156
+ return false
157
+ end
158
+ end
159
+
160
+ private
161
+ def get_xml_head
162
+ date = DateTime.now.strftime("%Y-%m-%d %H:%M")
163
+ str =<<EOL
164
+ <?xml version="1.0" encoding="UTF-8"?>
165
+ <!-- generator="seo_toolbox/#{VERSION}" -->
166
+ <!-- sitemap-generator-url="http://blog.media-scientific.com/seo_toolbox" sitemap-generator-version="#{VERSION}" -->
167
+ <!-- generated-on="#{date}" --><
168
+ <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9" url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
169
+ EOL
170
+ end
171
+
172
+ #Erstellt die URL-Elemente.
173
+ #* line = "URL:::lastmod:::changefreq:::priority"
174
+ def get_xml_url_element line
175
+ elements = line.split(":::")
176
+ str =<<EOL
177
+ <url>
178
+ <loc>#{elements[0]}</loc>
179
+ <lastmod>#{elements[1]}</lastmod>
180
+ <changefreq>#{elements[2]}</changefreq>
181
+ <priority>#{elements[3].strip}</priority>
182
+ </url>
183
+ EOL
184
+ end
185
+
186
+ def get_xml_url_bottom
187
+ "</urlset>"
188
+ end
189
+ end
@@ -0,0 +1,72 @@
1
+ =begin
2
+ @author: Philipp Petersen
3
+ =end
4
+
5
+
6
+ require 'rubygems'
7
+ require 'rake'
8
+ require 'rake/clean'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/rdoctask'
11
+ require 'rake/testtask'
12
+ require 'spec/rake/spectask'
13
+ require 'echoe'
14
+
15
+
16
+
17
+ spec = Gem::Specification.new do |s|
18
+ s.name = 'seotoolbox'
19
+ s.homepage = "http://blog.media-scientific.com/seo_toolbox/"
20
+ s.platform = Gem::Platform::RUBY
21
+ s.rubyforge_project = 'seotoolbox'
22
+ s.version = '0.9.1'
23
+ s.has_rdoc = true
24
+ s.extra_rdoc_files = ['README', 'LICENSE']
25
+ s.summary = 'SeoToolbox create XML Sitemaps, Google Sitemaps and generates meta-tags and the robots.txt file.'
26
+ s.description = "SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps."
27
+ s.author = 'Philipp Petersen'
28
+ s.email = 'philipp.petersen@gmail.com'
29
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
30
+ s.require_path = "lib"
31
+ s.test_files = Dir.glob('test/*.rb')
32
+ end
33
+
34
+ Rake::GemPackageTask.new(spec) do |p|
35
+ p.gem_spec = spec
36
+ p.need_tar = true
37
+ p.need_zip = true
38
+ end
39
+
40
+ Rake::RDocTask.new do |rdoc|
41
+ files =['README', 'LICENSE', 'lib/**/*.rb', 'test/*.rb']
42
+ rdoc.rdoc_files.add(files)
43
+ rdoc.main = "README" # page to start on
44
+ rdoc.title = "rails_toolbox Docs"
45
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
46
+ rdoc.options << '--line-numbers'
47
+ rdoc.options << '--all'
48
+ rdoc.options << '--charset=UTF-8'
49
+ end
50
+
51
+ Rake::TestTask.new do |t|
52
+ FileUtils.mkdir_p 'test/temp'
53
+ t.test_files = FileList['test/**/*.rb']
54
+ end
55
+
56
+ Spec::Rake::SpecTask.new do |t|
57
+ t.spec_files = FileList['spec/**/*.rb']
58
+ end
59
+
60
+
61
+ Echoe.new('seotoolbox', '0.9.1') do |p|
62
+ p.description = "SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps."
63
+ p.url = "cvs.seotoolbox.rubyforge.org"
64
+ p.author = "Philipp Petersen"
65
+ p.email = "philipp.petersen@gmail.com"
66
+ p.ignore_pattern = ["svn_user.yml", "svn_project.rake"]
67
+ p.project = "seotoolbox"
68
+ end
69
+
70
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
71
+
72
+
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{seotoolbox}
5
+ s.version = "0.9.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Philipp Petersen"]
9
+ s.date = %q{2009-06-08}
10
+ s.description = %q{SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps.}
11
+ s.email = %q{philipp.petersen@gmail.com}
12
+ s.extra_rdoc_files = ["lib/seo_toolbox.rb", "LICENSE", "README"]
13
+ s.files = ["lib/seo_toolbox.rb", "LICENSE", "rakefile", "README", "test/seo_toolbox_test.rb", "test/temp/robots.txt", "test/temp/sitemap.xml", "test/temp/sitemap_data.dat", "Rakefile", "Manifest", "seotoolbox.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{cvs.seotoolbox.rubyforge.org}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Seotoolbox", "--main", "README"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{seotoolbox}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps.}
21
+ s.test_files = ["test/seo_toolbox_test.rb"]
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 2
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
@@ -0,0 +1,65 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
+
6
+ require 'test/unit'
7
+ require 'seo_toolbox'
8
+
9
+ class SeoToolboxTest < Test::Unit::TestCase
10
+ def setup
11
+ @working_path = (`pwd`).strip+"/test/temp"
12
+ @seo_toolbox = SeoToolbox.new("#{@working_path}", "#{@working_path}", "http://blog.media-scientific.com", "weekly", "1.0")
13
+ end
14
+
15
+ def test_initializing
16
+ assert @seo_toolbox.class == SeoToolbox
17
+ assert_equal "#{@working_path}", @seo_toolbox.path_to_data
18
+ assert_equal "#{@working_path}", @seo_toolbox.path_to_sitemap
19
+ assert_equal "http://blog.media-scientific.com", @seo_toolbox.url
20
+ assert File.exists?("#{@working_path}/sitemap_data.dat")
21
+ end
22
+
23
+ def test_create_xml_sitemap_after_deploy
24
+ File.delete("#{@working_path}/sitemap.xml") if File.exists?("#{@working_path}/sitemap.xml")
25
+ setup
26
+ assert File.exists?("#{@working_path}/sitemap.xml")
27
+ end
28
+
29
+ def test_save_new_url_to_sitemap
30
+ assert @seo_toolbox.save_new_url_to_sitemap?("http://blog.media-scientific.com/erster_test.html", DateTime.now.strftime("%Y-%m-%d %H:%M"), "daily", "0.5")
31
+ f = File.open("#{@working_path}/sitemap_data.dat", "r")
32
+ assert f.grep(/erster_test.html/)
33
+ end
34
+
35
+ def test_include_metatags
36
+ ret_str = SeoToolbox.include_metatags({:keywords => 'test1', :description => 'das ist ein test', :author => 'Philipp', :language => 'DE', :robots => 'allow'})
37
+ assert_match /<meta/, ret_str
38
+ assert_match /content="Philipp"/, ret_str
39
+ assert_equal "<meta name=\"robots\" content=\"allow\" />\n<meta name=\"keywords\" content=\"test1\" />\n<meta name=\"description\" content=\"das ist ein test\" />\n<meta name=\"author\" content=\"Philipp\" />\n<meta name=\"language\" content=\"DE\" />\n<!--This site use the seo_toolbox gem from Philipp Petersen-->", ret_str
40
+ end
41
+
42
+ def test_create_xml_sitemap
43
+ assert @seo_toolbox.save_new_url_to_sitemap?("http://blog.media-scientific.com/noch_ein_test.html", DateTime.now.strftime("%Y-%m-%d %H:%M"), "daily", "0.5")
44
+ assert @seo_toolbox.create_xml_sitemap?
45
+ assert File.exists?("#{@working_path}/sitemap.xml")
46
+ f = File.open("#{@working_path}/sitemap_data.dat", "r")
47
+ assert f.grep(/noch_ein_test.html/)
48
+ end
49
+
50
+ def test_create_robots_txt
51
+ assert @seo_toolbox.create_robots_txt?(nil, @working_path)
52
+ assert File.exists?("#{@working_path}/robots.txt")
53
+ f = File.open("#{@working_path}/robots.txt", "r")
54
+ assert f.grep(/User-Agent/)
55
+ assert f.grep(/Allow/)
56
+ assert f.grep(/blog.media-scientific.com/)
57
+ end
58
+
59
+ def test_delete_file_form_sitemap
60
+ assert @seo_toolbox.save_new_url_to_sitemap?("http://blog.media-scientific.com/erster_test.html", DateTime.now.strftime("%Y-%m-%d %H:%M"), "daily", "0.5")
61
+ assert @seo_toolbox.remove_url_from_sitemap? "http://blog.media-scientific.com/erster_test.html"
62
+ f = File.open("#{@working_path}/sitemap_data.dat", "r")
63
+ assert f.grep(/erster_test.html/)
64
+ end
65
+ end
@@ -0,0 +1,3 @@
1
+ User-Agent: *
2
+ Allow: /
3
+ Sitemap:http://blog.media-scientific.com/sitemap.xml
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- generator="seo_toolbox/0.9.1" -->
3
+ <!-- sitemap-generator-url="http://blog.media-scientific.com/seo_toolbox" sitemap-generator-version="0.9.1" -->
4
+ <!-- generated-on="2009-06-08 10:18" --><
5
+ <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9" url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
6
+ <url>
7
+ <loc>http://blog.media-scientific.com</loc>
8
+ <lastmod>2009-06-05</lastmod>
9
+ <changefreq>weekly</changefreq>
10
+ <priority>1.0</priority>
11
+ </url>
12
+ <url>
13
+ <loc>http://blog.media-scientific.com/erster_test.html</loc>
14
+ <lastmod>2009-06-08 10:18</lastmod>
15
+ <changefreq>daily</changefreq>
16
+ <priority>0.5</priority>
17
+ </url>
18
+ <url>
19
+ <loc>http://blog.media-scientific.com/noch_ein_test.html</loc>
20
+ <lastmod>2009-06-08 10:18</lastmod>
21
+ <changefreq>daily</changefreq>
22
+ <priority>0.5</priority>
23
+ </url>
24
+ </urlset>
@@ -0,0 +1,3 @@
1
+ http://blog.media-scientific.com:::2009-06-05:::weekly:::1.0
2
+ http://blog.media-scientific.com/noch_ein_test.html:::2009-06-08 10:18:::daily:::0.5
3
+ http://blog.media-scientific.com/erster_test.html:::2009-06-08 10:18:::daily:::0.5
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: seotoolbox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.1
5
+ platform: ruby
6
+ authors:
7
+ - Philipp Petersen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-08 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps.
17
+ email: philipp.petersen@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/seo_toolbox.rb
24
+ - LICENSE
25
+ - README
26
+ files:
27
+ - lib/seo_toolbox.rb
28
+ - LICENSE
29
+ - rakefile
30
+ - README
31
+ - test/seo_toolbox_test.rb
32
+ - test/temp/robots.txt
33
+ - test/temp/sitemap.xml
34
+ - test/temp/sitemap_data.dat
35
+ - Rakefile
36
+ - Manifest
37
+ - seotoolbox.gemspec
38
+ has_rdoc: true
39
+ homepage: cvs.seotoolbox.rubyforge.org
40
+ post_install_message:
41
+ rdoc_options:
42
+ - --line-numbers
43
+ - --inline-source
44
+ - --title
45
+ - Seotoolbox
46
+ - --main
47
+ - README
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "1.2"
61
+ version:
62
+ requirements: []
63
+
64
+ rubyforge_project: seotoolbox
65
+ rubygems_version: 1.3.1
66
+ signing_key:
67
+ specification_version: 2
68
+ summary: SeoToolbox can be used in combination with Rails. It helps in the creation of meta tags, robots.txt and the Google Sitemaps, XML Sitemaps.
69
+ test_files:
70
+ - test/seo_toolbox_test.rb