Skip to content

Commit

Permalink
Remove caching support in HighVoltage
Browse files Browse the repository at this point in the history
Page caching was deprecated in fac899f. In preparation to move towards a
3.0 release with Rails 5.0 support, we are removing built in caching support.
  • Loading branch information
Damian Galarza committed Dec 28, 2015
1 parent c2a35f4 commit e565885
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 229 deletions.
2 changes: 0 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ rails_versions = ['~> 4.0.0', '~> 4.1.0', '~> 4.2.0']
rails_versions.each do |rails_version|
appraise "rails#{rails_version.slice(/\d+\.\d+/)}" do
gem 'rails', rails_version
gem 'actionpack-action_caching'
gem 'actionpack-page_caching'
end
end
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ end

#### Caching

Caching has been deprecated and will be removed in the next release.
Built in caching support has been removed in HighVoltage. See [PR 221](https://github.com/thoughtbot/high_voltage/pull/221).

Page caching and action caching can be done via Rails. Visit the [Caching with
Rails: An overview](http://guides.rubyonrails.org/caching_with_rails.html) guide
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/concerns/high_voltage/static_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ module HighVoltage::StaticPage

rescue_from HighVoltage::InvalidPageIdError, with: :invalid_page

if respond_to?(:caches_action)
caches_action :show, layout: HighVoltage.action_caching_layout,
if: -> { HighVoltage.action_caching }
end

if respond_to?(:caches_page)
caches_page :show, if: -> { HighVoltage.page_caching }
end

hide_action :current_page, :page_finder, :page_finder_factory
end

Expand Down
2 changes: 0 additions & 2 deletions gemfiles/rails4.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ source "http://rubygems.org"

gem "appraisal"
gem "rails", "~> 4.0.0"
gem "actionpack-action_caching"
gem "actionpack-page_caching"

gemspec :path => "../"
2 changes: 0 additions & 2 deletions gemfiles/rails4.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ source "http://rubygems.org"

gem "appraisal"
gem "rails", "~> 4.1.0"
gem "actionpack-action_caching"
gem "actionpack-page_caching"

gemspec :path => "../"
2 changes: 0 additions & 2 deletions gemfiles/rails4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ source "http://rubygems.org"

gem "appraisal"
gem "rails", "~> 4.2.0"
gem "actionpack-action_caching"
gem "actionpack-page_caching"

gemspec :path => "../"
32 changes: 0 additions & 32 deletions lib/high_voltage/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
module HighVoltage
module Configuration
CACHING_DEPRECATION_WARNING = <<-WARNING.strip_heredoc.squish
Caching support has been deprecated and will be removed
in the next release.
WARNING

attr_accessor(
:content_path,
:home_page,
Expand All @@ -14,8 +9,6 @@ module Configuration
:routes,
)

attr_reader :action_caching, :action_caching_layout, :page_caching

def configure
yield self
end
Expand All @@ -24,27 +17,6 @@ def self.extended(base)
base.set_default_configuration
end

def action_caching=(value)
unless value == false
ActiveSupport::Deprecation.warn(CACHING_DEPRECATION_WARNING)
end
@action_caching = value
end

def action_caching_layout=(value)
unless value == false
ActiveSupport::Deprecation.warn(CACHING_DEPRECATION_WARNING)
end
@action_caching_layout = value
end

def page_caching=(value)
unless value == false
ActiveSupport::Deprecation.warn(CACHING_DEPRECATION_WARNING)
end
@page_caching = value
end

def page_ids
HighVoltage::PageCollector.new(HighVoltage.full_path).page_ids
end
Expand All @@ -54,10 +26,6 @@ def full_path
end

def set_default_configuration
@action_caching = false
@action_caching_layout = true
@page_caching = false

self.content_path = 'pages/'
self.home_page = nil
self.layout = 'application'
Expand Down
38 changes: 0 additions & 38 deletions spec/controllers/action_caching_controller_spec.rb

This file was deleted.

37 changes: 0 additions & 37 deletions spec/controllers/page_caching_controller_spec.rb

This file was deleted.

102 changes: 0 additions & 102 deletions spec/high_voltage/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
before(:each) do
HighVoltage.configure do |config|
ActiveSupport::Deprecation.silence do
config.action_caching = config_value
config.action_caching_layout = config_value
config.content_path = config_value
config.layout = config_value
config.page_caching = config_value
config.parent_engine = config_value
config.route_drawer = config_value
config.routes = config_value
Expand All @@ -25,109 +22,10 @@
end
end

it { expect(HighVoltage.action_caching).to eq config_value }
it { expect(HighVoltage.action_caching_layout).to eq config_value }
it { expect(HighVoltage.content_path).to eq config_value }
it { expect(HighVoltage.layout).to eq config_value }
it { expect(HighVoltage.page_caching).to eq config_value }
it { expect(HighVoltage.parent_engine).to eq config_value }
it { expect(HighVoltage.route_drawer).to eq config_value }
it { expect(HighVoltage.routes).to eq config_value }
end

describe "#action_caching" do
context "action caching is enabled" do
it 'displays a deprecation warning' do
allow(ActiveSupport::Deprecation).to receive(:warn)

HighVoltage.configure do |config|
config.action_caching = true
end

expect(ActiveSupport::Deprecation).to have_received(:warn)
.with(HighVoltage::Configuration::CACHING_DEPRECATION_WARNING)
end
end

context "action caching is disabled" do
it 'does not display a deprecation warning' do
allow(ActiveSupport::Deprecation).to receive(:warn)

HighVoltage.configure do |config|
config.action_caching = false
end

expect(ActiveSupport::Deprecation).not_to have_received(:warn)
.with(HighVoltage::Configuration::CACHING_DEPRECATION_WARNING)
end
end
end

describe "#action_caching_layout" do
context "action caching layout is enabled" do
it 'displays a deprecation warning' do
allow(ActiveSupport::Deprecation).to receive(:warn)

HighVoltage.configure do |config|
config.action_caching_layout = true
end

expect(ActiveSupport::Deprecation).to have_received(:warn)
.with(HighVoltage::Configuration::CACHING_DEPRECATION_WARNING)
end
end

context "action caching layout is disabled" do
it "does not display a deprecation warning" do
allow(ActiveSupport::Deprecation).to receive(:warn)

HighVoltage.configure do |config|
config.action_caching_layout = false
end

expect(ActiveSupport::Deprecation).not_to have_received(:warn)
.with(HighVoltage::Configuration::CACHING_DEPRECATION_WARNING)
end
end
end

describe "#page_caching" do
context "page caching is enabled" do
it "displays a deprecation warning" do
allow(ActiveSupport::Deprecation).to receive(:warn)

HighVoltage.configure do |config|
config.page_caching = true
end

expect(ActiveSupport::Deprecation).to have_received(:warn)
.with(HighVoltage::Configuration::CACHING_DEPRECATION_WARNING)
end
end

context "page caching is disbled" do
it "does not display a deprecation warning" do
allow(ActiveSupport::Deprecation).to receive(:warn)

HighVoltage.configure do |config|
config.page_caching = false
end

expect(ActiveSupport::Deprecation).not_to have_received(:warn)
.with(HighVoltage::Configuration::CACHING_DEPRECATION_WARNING)
end
end
end

describe '#set_default_configuration' do
it 'defaults caching without a deprecation warning' do
allow(ActiveSupport::Deprecation).to receive(:warn)

Class.new do
extend HighVoltage::Configuration
end

expect(ActiveSupport::Deprecation).not_to have_received(:warn)
end
end
end
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
require "active_model/railtie"
require "action_controller/railtie"
require "action_view/railtie"
require "actionpack/action_caching/railtie"
require "actionpack/page_caching/railtie"
require "rspec/rails"

require "high_voltage"
Expand Down

0 comments on commit e565885

Please sign in to comment.