bcms_seo_sitemap 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,3 @@
1
- # Filters added to this controller apply to all controllers in the application.
2
- # Likewise, all the methods added will be available for all controllers.
3
-
4
1
  class ApplicationController < ActionController::Base
5
- helper :all # include all helpers, all the time
6
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
-
8
- # Scrub sensitive parameters from your log
9
- # filter_parameter_logging :password
2
+ protect_from_forgery
10
3
  end
@@ -6,11 +6,11 @@ class Cms::SitemapsController < Cms::BaseController
6
6
  before_filter :set_menu_section
7
7
 
8
8
  def edit
9
- @depth = Cms::SitemapGenerator.depth
9
+ @depth = BcmsSeoSitemap::Generator.depth
10
10
  end
11
11
 
12
12
  def update
13
- Cms::SitemapGenerator.depth = params[:depth]
13
+ BcmsSeoSitemap::Generator.depth = params[:depth]
14
14
  flash[:notice] = "Sitemap depth updated"
15
15
  redirect_to :action => :edit
16
16
  end
@@ -1,9 +1,9 @@
1
1
  class SitemapsController < ApplicationController
2
2
 
3
+ respond_to :xml
4
+
3
5
  def google
4
- @items = Cms::SitemapGenerator.items
5
- respond_to do |format|
6
- format.xml
7
- end
6
+ @items = BcmsSeoSitemap::Generator.items
7
+ respond_with @items
8
8
  end
9
9
  end
@@ -1,3 +1,2 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
1
  module ApplicationHelper
3
2
  end
@@ -1,4 +1,4 @@
1
- <% unless sitemap_item[:url] == "#" || sitemap_item[:url].first != '/' %>
1
+ <% unless sitemap_item[:url] == "#" %>
2
2
  <url>
3
3
  <loc><%= CGI.escapeHTML("http://#{request.host}#{sitemap_item[:url]}") %></loc>
4
4
  </url>
@@ -1,2 +1,2 @@
1
+ require 'bcms_seo_sitemap/engine'
1
2
  require 'bcms_seo_sitemap/routes'
2
- require 'bcms_seo_sitemap/cms/sitemap_generator'
@@ -0,0 +1,12 @@
1
+ require 'browsercms'
2
+
3
+ module BcmsSeoSitemap
4
+ class Engine < Rails::Engine
5
+ include Cms::Module
6
+
7
+ initializer "bcms_seo_sitemap.require_classes"do
8
+ # Need to have loaded all BrowserCMS app directories first before we can reference classes there.
9
+ require 'bcms_seo_sitemap/generator'
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,7 @@
1
- module Cms
2
- module SitemapGenerator
1
+ require 'bcms_settings/cms/settings'
2
+
3
+ module BcmsSeoSitemap
4
+ module Generator
3
5
  extend self
4
6
  extend Cms::MenuHelper
5
7
 
@@ -8,7 +10,9 @@ module Cms
8
10
  if configuration.depth && configuration.depth.nonzero?
9
11
  options.merge!({:depth => configuration.depth})
10
12
  end
11
- menu_items(options)
13
+ items = menu_items(options)
14
+ return [] unless items
15
+ items
12
16
  end
13
17
 
14
18
  # These setter and getter methods are probably not needed anymore.
@@ -1,9 +1,9 @@
1
1
  module Cms::Routes
2
2
  def routes_for_bcms_seo_sitemap
3
- google_sitemap '/sitemaps/google.xml', :controller => 'sitemaps', :action => 'google'
4
- namespace :cms do |cms|
5
- cms.xml_sitemaps 'xml_sitemaps', :controller => 'sitemaps', :action => 'edit', :conditions => {:method => :get}
6
- cms.connect '/xml_sitemaps', :controller => 'sitemaps', :action => 'update' , :conditions => {:method => :put}
3
+ match '/sitemaps/google.xml'=>'sitemaps#google', :as =>:google_sitemap
4
+ namespace :cms do
5
+ get '/xml_sitemaps'=>'sitemaps#edit', :as =>:xml_sitemaps
6
+ put '/xml_sitemaps'=>'sitemaps#update', :as =>:xml_sitemaps
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,3 @@
1
+ module BcmsSeoSitemap
2
+ VERSION = "1.1.0"
3
+ end
@@ -0,0 +1,10 @@
1
+ Description:
2
+ Installs the bcms_seo_sitemap module.
3
+
4
+ Example:
5
+ rails generate bcms_seo_sitemap:install
6
+
7
+ This will:
8
+ 1. Copy any migrations from the gem into the project.
9
+ 2. Add the routes to the config/routes.rb
10
+
@@ -0,0 +1,10 @@
1
+ require 'cms/module_installation'
2
+
3
+ class BcmsSeoSitemap::InstallGenerator < Cms::ModuleInstallation
4
+ add_migrations_directory_to_source_root __FILE__
5
+
6
+ # Add migrations to be copied, by uncommenting the following file and editing as needed.
7
+ # copy_migration_file 'name_of_migration'
8
+
9
+
10
+ end
metadata CHANGED
@@ -1,65 +1,44 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bcms_seo_sitemap
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- version: 1.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - BrowserMedia
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-12-09 00:00:00 -06:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-06 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: browsercms
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70341872264300 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 1
33
- - 2
34
- version: 3.1.2
20
+ - !ruby/object:Gem::Version
21
+ version: 3.3.0
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: bcms_settings
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70341872264300
25
+ - !ruby/object:Gem::Dependency
26
+ name: bcms_settings
27
+ requirement: &70341872263300 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
29
+ requirements:
43
30
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 29
46
- segments:
47
- - 0
48
- - 0
49
- - 1
50
- version: 0.0.1
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.0
51
33
  type: :runtime
52
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *70341872263300
53
36
  description: This module generates XML Sitemaps for BrowserCMS Projects
54
37
  email: github@browsermedia.com
55
38
  executables: []
56
-
57
39
  extensions: []
58
-
59
- extra_rdoc_files:
60
- - LICENSE.txt
61
- - README.markdown
62
- files:
40
+ extra_rdoc_files: []
41
+ files:
63
42
  - app/controllers/application_controller.rb
64
43
  - app/controllers/cms/sitemaps_controller.rb
65
44
  - app/controllers/sitemaps_controller.rb
@@ -71,58 +50,42 @@ files:
71
50
  - app/views/layouts/templates/default.html.erb
72
51
  - app/views/sitemaps/_sitemap_item.xml.erb
73
52
  - app/views/sitemaps/google.xml.erb
74
- - db/migrate/20101129011429_create_cms_modules.rb
75
53
  - doc/README_FOR_APP
76
- - lib/bcms_seo_sitemap.rb
77
- - lib/bcms_seo_sitemap/cms/sitemap_generator.rb
54
+ - lib/bcms_seo_sitemap/engine.rb
55
+ - lib/bcms_seo_sitemap/generator.rb
78
56
  - lib/bcms_seo_sitemap/routes.rb
79
- - rails/init.rb
80
- - LICENSE.txt
81
- - README.markdown
82
- - test/functional/cms/sitemaps_controller_test.rb
83
- - test/functional/sitemaps_controller_test.rb
84
- - test/performance/browsing_test.rb
85
- - test/test_helper.rb
86
- - test/unit/helpers/cms/sitemaps_helper_test.rb
87
- - test/unit/helpers/sitemaps_helper_test.rb
88
- has_rdoc: true
57
+ - lib/bcms_seo_sitemap/version.rb
58
+ - lib/bcms_seo_sitemap.rb
59
+ - lib/generators/bcms_seo_sitemap/install/install_generator.rb
60
+ - lib/generators/bcms_seo_sitemap/install/USAGE
89
61
  homepage: https://github.com/browsermedia/bcms_seo_sitemap
90
62
  licenses: []
91
-
92
63
  post_install_message:
93
- rdoc_options:
94
- - --charset=UTF-8
95
- require_paths:
64
+ rdoc_options: []
65
+ require_paths:
96
66
  - lib
97
- required_ruby_version: !ruby/object:Gem::Requirement
67
+ required_ruby_version: !ruby/object:Gem::Requirement
98
68
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ segments:
104
74
  - 0
105
- version: "0"
106
- required_rubygems_version: !ruby/object:Gem::Requirement
75
+ hash: -2786865705532350108
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
77
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- hash: 3
112
- segments:
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ segments:
113
83
  - 0
114
- version: "0"
84
+ hash: -2786865705532350108
115
85
  requirements: []
116
-
117
- rubyforge_project:
118
- rubygems_version: 1.3.7
86
+ rubyforge_project: bcms_seo_sitemap
87
+ rubygems_version: 1.8.10
119
88
  signing_key:
120
89
  specification_version: 3
121
90
  summary: A Sitemap Module for BrowserCMS
122
- test_files:
123
- - test/functional/cms/sitemaps_controller_test.rb
124
- - test/functional/sitemaps_controller_test.rb
125
- - test/performance/browsing_test.rb
126
- - test/test_helper.rb
127
- - test/unit/helpers/cms/sitemaps_helper_test.rb
128
- - test/unit/helpers/sitemaps_helper_test.rb
91
+ test_files: []
data/LICENSE.txt DELETED
@@ -1,165 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
data/README.markdown DELETED
@@ -1,63 +0,0 @@
1
- #Sitemaps Module for BrowserCMS
2
-
3
- This is a simple module that generates a basic xml Sitemap for BrowserCMS
4
- projects. For each published page, it generates the `loc` tag according to the [Sitemap
5
- protocol](http://www.sitemaps.org/protocol.php), but no metadata.
6
-
7
- To determine which pages should be included in the Sitemap, it leverages
8
- BrowserCMS' menu_items helper. This means that hidden or unpublished pages will
9
- not be included. Empty sections are also ignored.
10
-
11
- The xml document is exposed at /sitemaps/google.xml
12
-
13
- ## Installation
14
-
15
- The Seo Sitemap module installs like most other BrowserCMS modules.
16
- You'll also need to install the [Settings module](https://github.com/browsermedia/bcms_settings)
17
- which Seo Sitemap uses to write configuration values. Setting up both modules at
18
- once is easy though:
19
-
20
- gem install bcms_seo_sitemap # This will install the settings gem as well.
21
-
22
- ## Set up your application to use the module
23
-
24
- ### 1. Edit config/environment.rb
25
-
26
- config.gem "browsercms"
27
- config.gem "bcms_settings"
28
- config.gem "bcms_seo_sitemap"
29
-
30
- ### 2. Run the following commands
31
-
32
- script/generate browser_cms
33
- rake db:migrate
34
-
35
- ### 3. Edit config/routes.rb
36
-
37
- Make sure the routes.rb loads the sitemap routes.
38
-
39
- map.routes_for_bcms_seo_sitemap
40
- map.routes_for_browser_cms
41
-
42
- ### 4. Add the following line to the browsercms.rb initializer
43
-
44
- Cms::Settings.synchronize
45
-
46
- ##Configuration
47
-
48
- The module adds a new entry under Administration > Tools labeled "Google
49
- Sitemap" where the module can be configured.
50
-
51
- At the moment, only the "depth" option is available, which is passed to the
52
- menu_items helper method. Setting a depth of 2 will result in a call to menu_items
53
- like this:
54
-
55
- menu_items(:depth => 2, :show_all_siblings => true, :page => Page.find_by_path('/')
56
-
57
- The module's configuration (currently just one value) is written to a global key
58
- value store provided by the Settings module.
59
-
60
- A depth value of 0 (the default) will include all published pages.
61
-
62
-
63
-
@@ -1,14 +0,0 @@
1
- class CreateCmsModules < ActiveRecord::Migration
2
- def self.up
3
- create_table :cms_modules do |t|
4
- t.string :name, :limit => 50
5
- t.text :settings
6
- t.boolean :cms_managed, :default => true
7
- end
8
- end
9
-
10
- def self.down
11
- drop_table :cms_modules
12
- end
13
- end
14
-
data/rails/init.rb DELETED
@@ -1,5 +0,0 @@
1
- gem_root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
2
- Cms.add_to_rails_paths gem_root
3
- Cms.add_generator_paths gem_root, "db/migrate/[0-9]*_*.rb"
4
- Cms.add_generator_paths gem_root, "app/views/cms/shared/_admin_sidebar.html.erb"
5
- Cms.add_generator_paths gem_root, "public/bcms/sitemap/**/*"
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Cms::SitemapsControllerTest < ActionController::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SitemapsControllerTest < ActionController::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
7
- end
8
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionController::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
data/test/test_helper.rb DELETED
@@ -1,38 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
- require 'test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Transactional fixtures accelerate your tests by wrapping each test method
7
- # in a transaction that's rolled back on completion. This ensures that the
8
- # test database remains unchanged so your fixtures don't have to be reloaded
9
- # between every test method. Fewer database queries means faster tests.
10
- #
11
- # Read Mike Clark's excellent walkthrough at
12
- # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
- #
14
- # Every Active Record database supports transactions except MyISAM tables
15
- # in MySQL. Turn off transactional fixtures in this case; however, if you
16
- # don't care one way or the other, switching from MyISAM to InnoDB tables
17
- # is recommended.
18
- #
19
- # The only drawback to using transactional fixtures is when you actually
20
- # need to test transactions. Since your test is bracketed by a transaction,
21
- # any transactions started in your code will be automatically rolled back.
22
- self.use_transactional_fixtures = true
23
-
24
- # Instantiated fixtures are slow, but give you @david where otherwise you
25
- # would need people(:david). If you don't want to migrate your existing
26
- # test cases which use the @david style and don't mind the speed hit (each
27
- # instantiated fixtures translates to a database query per test method),
28
- # then set this back to true.
29
- self.use_instantiated_fixtures = false
30
-
31
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
- #
33
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
- # -- they do not yet inherit this setting
35
- fixtures :all
36
-
37
- # Add more helper methods to be used by all tests here...
38
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Cms::SitemapsHelperTest < ActionView::TestCase
4
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SitemapsHelperTest < ActionView::TestCase
4
- end