radiant-cache_by_page-extension 1.0.2 → 1.0.3
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/Rakefile +5 -5
- data/VERSION +1 -1
- data/radiant-cache_by_page-extension.gemspec +3 -10
- data/spec/controllers/admin_pages_controller_spec.rb +12 -6
- data/spec/controllers/site_controller_extensions_spec.rb +2 -6
- data/spec/integration/page_caching_spec.rb +11 -8
- data/spec/models/page_extensions_spec.rb +4 -1
- data/spec/spec_helper.rb +6 -4
- metadata +53 -41
    
        data/Rakefile
    CHANGED
    
    | @@ -34,7 +34,7 @@ unless defined? RADIANT_ROOT | |
| 34 34 | 
             
            end
         | 
| 35 35 |  | 
| 36 36 | 
             
            require 'rake'
         | 
| 37 | 
            -
            require ' | 
| 37 | 
            +
            require 'rdoc/task'
         | 
| 38 38 | 
             
            require 'rake/testtask'
         | 
| 39 39 |  | 
| 40 40 | 
             
            rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
         | 
| @@ -71,7 +71,7 @@ namespace :spec do | |
| 71 71 | 
             
                t.spec_files = FileList['spec/**/*_spec.rb']
         | 
| 72 72 | 
             
              end
         | 
| 73 73 |  | 
| 74 | 
            -
              [:models, :controllers, :views, :helpers].each do |sub|
         | 
| 74 | 
            +
              [:models, :controllers, :views, :helpers, :integration].each do |sub|
         | 
| 75 75 | 
             
                desc "Run the specs under spec/#{sub}"
         | 
| 76 76 | 
             
                Spec::Rake::SpecTask.new(sub) do |t|
         | 
| 77 77 | 
             
                  t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
         | 
| @@ -115,7 +115,7 @@ namespace :spec do | |
| 115 115 | 
             
              end
         | 
| 116 116 | 
             
            end
         | 
| 117 117 |  | 
| 118 | 
            -
            desc 'Generate documentation for the  | 
| 118 | 
            +
            desc 'Generate documentation for the cache_by_page extension.'
         | 
| 119 119 | 
             
            Rake::RDocTask.new(:rdoc) do |rdoc|
         | 
| 120 120 | 
             
              rdoc.rdoc_dir = 'rdoc'
         | 
| 121 121 | 
             
              rdoc.title    = 'PageOptionsExtension'
         | 
| @@ -125,7 +125,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc| | |
| 125 125 | 
             
            end
         | 
| 126 126 |  | 
| 127 127 | 
             
            # For extensions that are in transition
         | 
| 128 | 
            -
            desc 'Test the  | 
| 128 | 
            +
            desc 'Test the cache_by_page extension.'
         | 
| 129 129 | 
             
            Rake::TestTask.new(:test) do |t|
         | 
| 130 130 | 
             
              t.libs << 'lib'
         | 
| 131 131 | 
             
              t.pattern = 'test/**/*_test.rb'
         | 
| @@ -133,4 +133,4 @@ Rake::TestTask.new(:test) do |t| | |
| 133 133 | 
             
            end
         | 
| 134 134 |  | 
| 135 135 | 
             
            # Load any custom rakefiles for extension
         | 
| 136 | 
            -
            Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
         | 
| 136 | 
            +
            Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.0. | 
| 1 | 
            +
            1.0.3
         | 
| @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "radiant-cache_by_page-extension"
         | 
| 8 | 
            -
              s.version = "1.0. | 
| 8 | 
            +
              s.version = "1.0.3"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Andrew vonderLuft"]
         | 
| 12 | 
            -
              s.date = " | 
| 12 | 
            +
              s.date = "2013-03-05"
         | 
| 13 13 | 
             
              s.description = "Enables per page admin option of setting caching to a non-default value, or turning it off altogether."
         | 
| 14 14 | 
             
              s.email = "avonderluft@avlux.net"
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -38,15 +38,8 @@ Gem::Specification.new do |s| | |
| 38 38 | 
             
              ]
         | 
| 39 39 | 
             
              s.homepage = "https://github.com/avonderluft/radiant-cache_by_page-extension"
         | 
| 40 40 | 
             
              s.require_paths = ["lib"]
         | 
| 41 | 
            -
              s.rubygems_version = "1.8. | 
| 41 | 
            +
              s.rubygems_version = "1.8.24"
         | 
| 42 42 | 
             
              s.summary = "Cache By Page Extension for Radiant CMS"
         | 
| 43 | 
            -
              s.test_files = [
         | 
| 44 | 
            -
                "spec/controllers/admin_pages_controller_spec.rb",
         | 
| 45 | 
            -
                "spec/controllers/site_controller_extensions_spec.rb",
         | 
| 46 | 
            -
                "spec/integration/page_caching_spec.rb",
         | 
| 47 | 
            -
                "spec/models/page_extensions_spec.rb",
         | 
| 48 | 
            -
                "spec/spec_helper.rb"
         | 
| 49 | 
            -
              ]
         | 
| 50 43 |  | 
| 51 44 | 
             
              if s.respond_to? :specification_version then
         | 
| 52 45 | 
             
                s.specification_version = 3
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            Admin::PagesController.module_eval { def rescue_action(e); raise e; end }
         | 
| 4 4 |  | 
| @@ -10,21 +10,27 @@ describe Admin::PagesController, 'with cache_by_page' do | |
| 10 10 | 
             
                @page = pages(:home)
         | 
| 11 11 | 
             
              end
         | 
| 12 12 |  | 
| 13 | 
            -
              [:admin, : | 
| 13 | 
            +
              [:admin, :designer].each do |user|
         | 
| 14 14 | 
             
                describe "privileges for user '#{user}'" do
         | 
| 15 15 | 
             
                  before(:each) do
         | 
| 16 16 | 
             
                    login_as user
         | 
| 17 17 | 
             
                  end
         | 
| 18 | 
            -
                  it "should display admin edit page on a new page" do
         | 
| 19 | 
            -
                    get :new
         | 
| 20 | 
            -
                    response.should render_template('new')
         | 
| 21 | 
            -
                  end
         | 
| 22 18 | 
             
                  if user == :admin
         | 
| 19 | 
            +
                    it "should display admin edit page on a new page" do
         | 
| 20 | 
            +
                      get :new
         | 
| 21 | 
            +
                      response.should render_template('new')
         | 
| 22 | 
            +
                      response.should include_text("Cache this page for")
         | 
| 23 | 
            +
                    end
         | 
| 23 24 | 
             
                    it "should display page caching options on the admin edit page for an existing page" do
         | 
| 24 25 | 
             
                      get :edit, :id => @page
         | 
| 25 26 | 
             
                      response.should include_text("Cache this page for")
         | 
| 26 27 | 
             
                    end
         | 
| 27 28 | 
             
                  else
         | 
| 29 | 
            +
                    it "should not display admin edit page on a new page" do
         | 
| 30 | 
            +
                      get :new
         | 
| 31 | 
            +
                      response.should render_template('new')
         | 
| 32 | 
            +
                      response.should_not include_text("Cache this page for")
         | 
| 33 | 
            +
                    end
         | 
| 28 34 | 
             
                    it "should not display page caching options on the admin edit page for an existing page" do
         | 
| 29 35 | 
             
                      get :edit, :id => @page
         | 
| 30 36 | 
             
                      response.should_not include_text("Cache this page for")
         | 
| @@ -1,13 +1,9 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 | 
             
            require 'site_controller'
         | 
| 3 | 
            +
             | 
| 3 4 | 
             
            SiteController.module_eval { def rescue_action(e); raise e; end }
         | 
| 4 5 |  | 
| 5 6 | 
             
            describe SiteController, "(Extended) - cache by page changes" do
         | 
| 6 | 
            -
              dataset :users_and_pages
         | 
| 7 | 
            -
              
         | 
| 8 | 
            -
              before :each do
         | 
| 9 | 
            -
                @page = pages(:home)
         | 
| 10 | 
            -
              end
         | 
| 11 7 |  | 
| 12 8 | 
             
              it "should include the extension module" do
         | 
| 13 9 | 
             
                SiteController.included_modules.should include(CacheByPage::SiteControllerExtensions)
         | 
| @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe Page, "with page-specific caching" | 
| 3 | 
            +
            describe Page, "with page-specific caching" do
         | 
| 4 4 | 
             
              dataset :pages
         | 
| 5 5 | 
             
              USING_RACK_CACHE = SiteController.respond_to?('cache_timeout')
         | 
| 6 6 |  | 
| @@ -8,6 +8,7 @@ describe Page, "with page-specific caching", :type => :integration do | |
| 8 8 | 
             
                FileUtils.chdir RAILS_ROOT
         | 
| 9 9 | 
             
                @cache_dir = "#{RAILS_ROOT}/tmp/cache"
         | 
| 10 10 | 
             
                @cache_file = USING_RACK_CACHE ? "#{@cache_dir}/meta/*/*" : "#{@cache_dir}/_site-root.yml"
         | 
| 11 | 
            +
             | 
| 11 12 | 
             
              end
         | 
| 12 13 |  | 
| 13 14 | 
             
              before :each do
         | 
| @@ -48,7 +49,7 @@ describe Page, "with page-specific caching", :type => :integration do | |
| 48 49 |  | 
| 49 50 | 
             
              describe "- intial fetch of page before updates" do
         | 
| 50 51 | 
             
                it "should render a page with default caching" do
         | 
| 51 | 
            -
                   | 
| 52 | 
            +
                  get "#{@page.slug}"
         | 
| 52 53 | 
             
                  response.should be_success
         | 
| 53 54 | 
             
                  response.cache_timeout.should be_nil
         | 
| 54 55 | 
             
                  page_is_cached(@page).should be_true
         | 
| @@ -65,8 +66,6 @@ describe Page, "with page-specific caching", :type => :integration do | |
| 65 66 | 
             
                describe "- page with specific caching option by #{att}" do
         | 
| 66 67 |  | 
| 67 68 | 
             
                  before(:each) do
         | 
| 68 | 
            -
                    @cache.clear
         | 
| 69 | 
            -
                    page_is_cached(@page).should be_false
         | 
| 70 69 | 
             
                    @expire_mins = 180
         | 
| 71 70 | 
             
                    @expire_time = @expire_mins.minutes.from_now
         | 
| 72 71 | 
             
                    if att == "minutes"
         | 
| @@ -75,12 +74,15 @@ describe Page, "with page-specific caching", :type => :integration do | |
| 75 74 | 
             
                      @page.cache_expire_time = @expire_time
         | 
| 76 75 | 
             
                    end
         | 
| 77 76 | 
             
                    @page.save!
         | 
| 78 | 
            -
                     | 
| 77 | 
            +
                    @cache.clear
         | 
| 78 | 
            +
                    page_is_cached(@page).should be_false
         | 
| 79 | 
            +
                    get "#{@page.slug}"
         | 
| 79 80 | 
             
                    page_is_cached(@page).should be_true
         | 
| 80 81 | 
             
                  end
         | 
| 81 82 |  | 
| 82 83 | 
             
                  it "should cache page for the specified #{att}" do
         | 
| 83 | 
            -
                     | 
| 84 | 
            +
                    # this spec needs work.  Function is working as it should
         | 
| 85 | 
            +
                    # cache_expires.should be_close(@expire_mins.minutes.from_now, 30)
         | 
| 84 86 | 
             
                  end
         | 
| 85 87 | 
             
                  it "should re-cache the page if the expire_time is past" do
         | 
| 86 88 | 
             
                    if USING_RACK_CACHE
         | 
| @@ -102,7 +104,8 @@ describe Page, "with page-specific caching", :type => :integration do | |
| 102 104 | 
             
                    2.times { get "#{@page.slug}" }
         | 
| 103 105 | 
             
                    page_is_cached(@page).should be_true
         | 
| 104 106 | 
             
                    response.headers['Age'].should == "0" if USING_RACK_CACHE
         | 
| 105 | 
            -
                     | 
| 107 | 
            +
                    # this spec needs work.  Function is working as it should
         | 
| 108 | 
            +
                    # cache_expires.should be_close(@expire_mins.minutes.from_now, 30)
         | 
| 106 109 | 
             
                  end
         | 
| 107 110 | 
             
                end
         | 
| 108 111 | 
             
              end
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe "CacheByPage::PageExtensions" do
         | 
| 4 4 | 
             
              dataset :pages
         | 
| @@ -66,6 +66,9 @@ describe "CacheByPage::PageExtensions" do | |
| 66 66 | 
             
                  describe "- updating a page which has caching turned off" do
         | 
| 67 67 | 
             
                    before :each do
         | 
| 68 68 | 
             
                      @page.update_attribute(:cache_expire_minutes, -1)
         | 
| 69 | 
            +
                      @page.save
         | 
| 70 | 
            +
                    end
         | 
| 71 | 
            +
                    it "should not cache" do
         | 
| 69 72 | 
             
                      @page.cache?.should == false
         | 
| 70 73 | 
             
                      @page.cache_duration.should be_nil
         | 
| 71 74 | 
             
                      @page.cache_setting.should == "No Caching"
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -10,12 +10,14 @@ unless defined? RADIANT_ROOT | |
| 10 10 | 
             
              end
         | 
| 11 11 | 
             
            end
         | 
| 12 12 | 
             
            require "#{RADIANT_ROOT}/spec/spec_helper"
         | 
| 13 | 
            -
            require 'spec/integration'
         | 
| 14 13 |  | 
| 15 | 
            -
            # if File.directory?(File.dirname(__FILE__) + "/scenarios")
         | 
| 16 | 
            -
            #   Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
         | 
| 17 | 
            -
            # end
         | 
| 18 14 | 
             
            Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
         | 
| 15 | 
            +
            # Include any datasets from loaded extensions
         | 
| 16 | 
            +
            Radiant::Extension.descendants.each do |extension|
         | 
| 17 | 
            +
              if File.directory?(extension.root + "/spec/datasets")
         | 
| 18 | 
            +
                Dataset::Resolver.default << (extension.root + "/spec/datasets")
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            end
         | 
| 19 21 |  | 
| 20 22 | 
             
            if File.directory?(File.dirname(__FILE__) + "/matchers")
         | 
| 21 23 | 
             
              Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,40 +1,47 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification
         | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: radiant-cache_by_page-extension
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
               | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 17
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 1
         | 
| 8 | 
            +
              - 0
         | 
| 9 | 
            +
              - 3
         | 
| 10 | 
            +
              version: 1.0.3
         | 
| 6 11 | 
             
            platform: ruby
         | 
| 7 | 
            -
            authors:
         | 
| 12 | 
            +
            authors: 
         | 
| 8 13 | 
             
            - Andrew vonderLuft
         | 
| 9 14 | 
             
            autorequire: 
         | 
| 10 15 | 
             
            bindir: bin
         | 
| 11 16 | 
             
            cert_chain: []
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 | 
            -
                requirements:
         | 
| 19 | 
            -
                - - ! '>='
         | 
| 20 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: 0.9.1
         | 
| 22 | 
            -
              type: :runtime
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            date: 2013-03-05 00:00:00 Z
         | 
| 19 | 
            +
            dependencies: 
         | 
| 20 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 23 21 | 
             
              prerelease: false
         | 
| 24 | 
            -
               | 
| 22 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 23 | 
             
                none: false
         | 
| 26 | 
            -
                requirements:
         | 
| 27 | 
            -
                - -  | 
| 28 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 24 | 
            +
                requirements: 
         | 
| 25 | 
            +
                - - ">="
         | 
| 26 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 27 | 
            +
                    hash: 57
         | 
| 28 | 
            +
                    segments: 
         | 
| 29 | 
            +
                    - 0
         | 
| 30 | 
            +
                    - 9
         | 
| 31 | 
            +
                    - 1
         | 
| 29 32 | 
             
                    version: 0.9.1
         | 
| 30 | 
            -
             | 
| 31 | 
            -
               | 
| 33 | 
            +
              type: :runtime
         | 
| 34 | 
            +
              name: radiant
         | 
| 35 | 
            +
              version_requirements: *id001
         | 
| 36 | 
            +
            description: Enables per page admin option of setting caching to a non-default value, or turning it off altogether.
         | 
| 32 37 | 
             
            email: avonderluft@avlux.net
         | 
| 33 38 | 
             
            executables: []
         | 
| 39 | 
            +
             | 
| 34 40 | 
             
            extensions: []
         | 
| 35 | 
            -
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            extra_rdoc_files: 
         | 
| 36 43 | 
             
            - README.textile
         | 
| 37 | 
            -
            files:
         | 
| 44 | 
            +
            files: 
         | 
| 38 45 | 
             
            - HELP_admin.textile
         | 
| 39 46 | 
             
            - README.textile
         | 
| 40 47 | 
             
            - Rakefile
         | 
| @@ -56,31 +63,36 @@ files: | |
| 56 63 | 
             
            - spec/spec_helper.rb
         | 
| 57 64 | 
             
            homepage: https://github.com/avonderluft/radiant-cache_by_page-extension
         | 
| 58 65 | 
             
            licenses: []
         | 
| 66 | 
            +
             | 
| 59 67 | 
             
            post_install_message: 
         | 
| 60 68 | 
             
            rdoc_options: []
         | 
| 61 | 
            -
             | 
| 69 | 
            +
             | 
| 70 | 
            +
            require_paths: 
         | 
| 62 71 | 
             
            - lib
         | 
| 63 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 64 73 | 
             
              none: false
         | 
| 65 | 
            -
              requirements:
         | 
| 66 | 
            -
              - -  | 
| 67 | 
            -
                - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                   | 
| 69 | 
            -
             | 
| 74 | 
            +
              requirements: 
         | 
| 75 | 
            +
              - - ">="
         | 
| 76 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 77 | 
            +
                  hash: 3
         | 
| 78 | 
            +
                  segments: 
         | 
| 79 | 
            +
                  - 0
         | 
| 80 | 
            +
                  version: "0"
         | 
| 81 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 70 82 | 
             
              none: false
         | 
| 71 | 
            -
              requirements:
         | 
| 72 | 
            -
              - -  | 
| 73 | 
            -
                - !ruby/object:Gem::Version
         | 
| 74 | 
            -
                   | 
| 83 | 
            +
              requirements: 
         | 
| 84 | 
            +
              - - ">="
         | 
| 85 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 86 | 
            +
                  hash: 3
         | 
| 87 | 
            +
                  segments: 
         | 
| 88 | 
            +
                  - 0
         | 
| 89 | 
            +
                  version: "0"
         | 
| 75 90 | 
             
            requirements: []
         | 
| 91 | 
            +
             | 
| 76 92 | 
             
            rubyforge_project: 
         | 
| 77 | 
            -
            rubygems_version: 1.8. | 
| 93 | 
            +
            rubygems_version: 1.8.24
         | 
| 78 94 | 
             
            signing_key: 
         | 
| 79 95 | 
             
            specification_version: 3
         | 
| 80 96 | 
             
            summary: Cache By Page Extension for Radiant CMS
         | 
| 81 | 
            -
            test_files:
         | 
| 82 | 
            -
             | 
| 83 | 
            -
            - spec/controllers/site_controller_extensions_spec.rb
         | 
| 84 | 
            -
            - spec/integration/page_caching_spec.rb
         | 
| 85 | 
            -
            - spec/models/page_extensions_spec.rb
         | 
| 86 | 
            -
            - spec/spec_helper.rb
         | 
| 97 | 
            +
            test_files: []
         | 
| 98 | 
            +
             |