rails_sitemap 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +13 -1
- data/app/controllers/rails_sitemap/sitemap_controller.rb +8 -0
- data/app/views/rails_sitemap/sitemap/index.xml.erb +2 -2
- data/lib/rails_sitemap/version.rb +1 -1
- data/test/dummy/log/test.log +120 -0
- data/test/integration/sitemap_controller_test.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ebccee49882668c55488c5cd0c51966e6b968c1
|
4
|
+
data.tar.gz: 7c2055fd0d4f5ae0e46f58f42ec40363905e9804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe401256d3676970734155a3efd0a661d08c3bf54533b3edefd1bcb540da43797f318837323e6f99ff82f9273c93a0a70a201640f9ca8d7309f1da3b3cee9bb
|
7
|
+
data.tar.gz: aaa73549f582e60d041d22ff29c72371fe4bf8672b27f73679b074580c6147f06984387ae8cb6eb8557b7cf5469af1a333e5b4412be2a81224b21e78af9dcd2b
|
data/README.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
1
|
= RailsSitemap
|
2
2
|
|
3
|
-
|
3
|
+
## Instalation
|
4
|
+
|
5
|
+
Add the gem in your Gemfile
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'rails_sitemap'
|
9
|
+
```
|
10
|
+
|
11
|
+
Mount the engine on your rails application
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
mount RailsSitemap::Engine => "/"
|
15
|
+
```
|
@@ -3,6 +3,7 @@ module RailsSitemap
|
|
3
3
|
BANNED_CONTROLLERS = ['rails/info', nil, 'errors', 'rails/mailers']
|
4
4
|
BANNED_ACTIONS = %w(show destroy update edit new create)
|
5
5
|
before_action :set_routes, only: :index
|
6
|
+
before_action :set_current_domain, only: :index
|
6
7
|
|
7
8
|
def index
|
8
9
|
respond_to do |format|
|
@@ -32,5 +33,12 @@ module RailsSitemap
|
|
32
33
|
route[:path][0..-11]
|
33
34
|
end
|
34
35
|
end
|
36
|
+
|
37
|
+
def set_current_domain
|
38
|
+
uri = URI.parse(request.original_url)
|
39
|
+
pre_html = uri.html_safe? ? 'https://' : 'http://'
|
40
|
+
|
41
|
+
@current_domain = pre_html + uri.hostname
|
42
|
+
end
|
35
43
|
end
|
36
44
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:pagemap="http://www.google.com/schemas/sitemap-pagemap/1.0" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
|
3
3
|
<url>
|
4
|
-
<loc
|
4
|
+
<loc><%= @current_domain %></loc>
|
5
5
|
<lastmod>2016-09-22T18:11:05-03:00</lastmod>
|
6
6
|
<changefreq>always</changefreq>
|
7
7
|
<priority>1.0</priority>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
<% @routes.each do |route| %>
|
11
11
|
<url>
|
12
|
-
<loc><%=
|
12
|
+
<loc><%= @current_domain + route %></loc>
|
13
13
|
<lastmod>2016-09-22T18:11:05-03:00</lastmod>
|
14
14
|
<changefreq>weekly</changefreq>
|
15
15
|
<priority>0.5</priority>
|
data/test/dummy/log/test.log
CHANGED
@@ -741,3 +741,123 @@ Processing by RailsSitemap::SitemapController#index as XML
|
|
741
741
|
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (0.0ms)
|
742
742
|
Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)
|
743
743
|
[1m[35m (0.0ms)[0m rollback transaction
|
744
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
745
|
+
[1m[36m (2.8ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
746
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
747
|
+
[1m[36m (3.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
748
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
749
|
+
[1m[36m (3.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
750
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
751
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
752
|
+
----------------------------
|
753
|
+
RailsSitemapTest: test_truth
|
754
|
+
----------------------------
|
755
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
756
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
757
|
+
--------------------------------------------------------
|
758
|
+
SitemapControllerTest: test_should_return_a_success_code
|
759
|
+
--------------------------------------------------------
|
760
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:07:35 -0300
|
761
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
762
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (35.8ms)
|
763
|
+
Completed 500 Internal Server Error in 562078ms (ActiveRecord: 0.0ms)
|
764
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
765
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
766
|
+
-------------------------------------------------------
|
767
|
+
SitemapControllerTest: test_should_return_the_right_xml
|
768
|
+
-------------------------------------------------------
|
769
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:16:57 -0300
|
770
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
771
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (37.4ms)
|
772
|
+
Completed 500 Internal Server Error in 1158ms (ActiveRecord: 0.0ms)
|
773
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
774
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
775
|
+
[1m[36m (2.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
776
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
777
|
+
[1m[36m (3.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
778
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
779
|
+
[1m[36m (3.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
780
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
781
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
782
|
+
----------------------------
|
783
|
+
RailsSitemapTest: test_truth
|
784
|
+
----------------------------
|
785
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
786
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
787
|
+
--------------------------------------------------------
|
788
|
+
SitemapControllerTest: test_should_return_a_success_code
|
789
|
+
--------------------------------------------------------
|
790
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:17:28 -0300
|
791
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
792
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (35.4ms)
|
793
|
+
Completed 500 Internal Server Error in 46ms (ActiveRecord: 0.0ms)
|
794
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
795
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
796
|
+
-------------------------------------------------------
|
797
|
+
SitemapControllerTest: test_should_return_the_right_xml
|
798
|
+
-------------------------------------------------------
|
799
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:17:29 -0300
|
800
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
801
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (27.6ms)
|
802
|
+
Completed 500 Internal Server Error in 28ms (ActiveRecord: 0.0ms)
|
803
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
804
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
805
|
+
[1m[36m (2.7ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
806
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
807
|
+
[1m[36m (3.3ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
808
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
809
|
+
[1m[36m (3.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
810
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
811
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
812
|
+
--------------------------------------------------------
|
813
|
+
SitemapControllerTest: test_should_return_a_success_code
|
814
|
+
--------------------------------------------------------
|
815
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:17:58 -0300
|
816
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
817
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (1.0ms)
|
818
|
+
Completed 200 OK in 10ms (Views: 9.4ms | ActiveRecord: 0.0ms)
|
819
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
820
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
821
|
+
-------------------------------------------------------
|
822
|
+
SitemapControllerTest: test_should_return_the_right_xml
|
823
|
+
-------------------------------------------------------
|
824
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:17:58 -0300
|
825
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
826
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (0.1ms)
|
827
|
+
Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
|
828
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
829
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
830
|
+
----------------------------
|
831
|
+
RailsSitemapTest: test_truth
|
832
|
+
----------------------------
|
833
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
834
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
835
|
+
[1m[36m (2.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
836
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
837
|
+
[1m[36m (3.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
838
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
839
|
+
[1m[36m (3.5ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
840
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
841
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
842
|
+
--------------------------------------------------------
|
843
|
+
SitemapControllerTest: test_should_return_a_success_code
|
844
|
+
--------------------------------------------------------
|
845
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:19:36 -0300
|
846
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
847
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (1.0ms)
|
848
|
+
Completed 200 OK in 12ms (Views: 11.6ms | ActiveRecord: 0.0ms)
|
849
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
850
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
851
|
+
-------------------------------------------------------
|
852
|
+
SitemapControllerTest: test_should_return_the_right_xml
|
853
|
+
-------------------------------------------------------
|
854
|
+
Started GET "/sitemap.xml" for 127.0.0.1 at 2016-09-23 15:19:36 -0300
|
855
|
+
Processing by RailsSitemap::SitemapController#index as XML
|
856
|
+
Rendered /Users/pgonzaga/repositories/rails_sitemap/app/views/rails_sitemap/sitemap/index.xml.erb (0.1ms)
|
857
|
+
Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
|
858
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
859
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
860
|
+
----------------------------
|
861
|
+
RailsSitemapTest: test_truth
|
862
|
+
----------------------------
|
863
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -8,6 +8,6 @@ class SitemapControllerTest < ActionDispatch::IntegrationTest
|
|
8
8
|
|
9
9
|
test 'should return the right xml' do
|
10
10
|
get '/sitemap.xml'
|
11
|
-
assert_equal response.body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:geo=\"http://www.google.com/geo/schemas/sitemap/1.0\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xmlns:mobile=\"http://www.google.com/schemas/sitemap-mobile/1.0\" xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\" xmlns:pagemap=\"http://www.google.com/schemas/sitemap-pagemap/1.0\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n <url>\n <loc>
|
11
|
+
assert_equal response.body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:geo=\"http://www.google.com/geo/schemas/sitemap/1.0\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xmlns:mobile=\"http://www.google.com/schemas/sitemap-mobile/1.0\" xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\" xmlns:pagemap=\"http://www.google.com/schemas/sitemap-pagemap/1.0\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n <url>\n <loc>http://www.example.com</loc>\n <lastmod>2016-09-22T18:11:05-03:00</lastmod>\n <changefreq>always</changefreq>\n <priority>1.0</priority>\n </url>\n\n <url>\n <loc>http://www.example.com/articles</loc>\n <lastmod>2016-09-22T18:11:05-03:00</lastmod>\n <changefreq>weekly</changefreq>\n <priority>0.5</priority>\n </url>\n</urlset>\n"
|
12
12
|
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_sitemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Gonzaga
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|