liquid_cms 0.2.0.4 → 0.2.0.5

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 CHANGED
@@ -7,23 +7,13 @@ require 'rake/testtask'
7
7
  desc 'Default: run tests.'
8
8
  task :default => :test
9
9
 
10
- test_types = %w(unit functional integration)
11
-
12
10
  desc 'Test the liquid_cms gem.'
13
- task :test => test_types.collect{|t| ["test:#{t}", "test:#{t}:no_context"]}.flatten
11
+ task :test => ['test:unit', 'test:functional', 'test:integration']
14
12
 
15
- test_types.each do |test|
16
- desc "Run the #{test} tests for the liquid_cms gem"
13
+ %w(unit functional integration).each do |test|
14
+ desc "Run the #{test} tests for the liquid_cms gem."
17
15
  Rake::TestTask.new("test:#{test}") do |t|
18
16
  t.pattern = "test/#{test}/*_test.rb"
19
17
  t.verbose = true
20
18
  end
21
19
  end
22
-
23
- test_types.each do |test|
24
- desc "Run the #{test} tests for the liquid_cms gem (no context)"
25
- Rake::TestTask.new("test:#{test}:no_context") do |t|
26
- t.pattern = "test/#{test}/*_test_no_context.rb"
27
- t.verbose = true
28
- end
29
- end
@@ -1,11 +1,6 @@
1
1
  class Cms::PagesController < Cms::MainController
2
2
  skip_before_filter :verify_authenticity_token, :only => [:load, :page_asset]
3
3
 
4
- caches_action :load, :cache_path => :cache_value
5
- #caches_action :page_asset, :cache_path => :cache_value
6
-
7
- cache_sweeper Cms::CacheSweeper, :only => %w(update destroy)
8
-
9
4
  authenticate_user :all, :except => %w(load page_asset)
10
5
 
11
6
  def new
@@ -91,23 +86,7 @@ class Cms::PagesController < Cms::MainController
91
86
  end
92
87
 
93
88
  protected
94
- # the current url with the last level of the path removed which essentially allows a page to be loaded with anything (wilcard) one level deeper
95
- # ex. normal page at /page will also accept /page/test, /page/abcd, etc.
96
89
  def wildcard_path
97
90
  '/'+params[:url].slice(0..-2).join('/')
98
91
  end
99
-
100
- def cache_value_url
101
- extra_params = params.except(:controller, :action, :url)
102
-
103
- # sort the parameters so we can have the same url if the params are given to us in a different order
104
- extra_values = extra_params.present? ? extra_params.sort{|a,b| a.first <=> b.first}.collect{|elem| "#{elem[0]}=#{elem[1]}"}.join('&') : nil
105
-
106
- [context_cache_path, params[:url], extra_values].flatten.compact.join('/')
107
- end
108
-
109
- # a unique string used to help expire the cache
110
- def context_cache_path
111
- Cms.context_class && @cms_context.present? ? "CONTEXT_PATH_#{@cms_context.id}" : 'NO_CONTEXT'
112
- end
113
92
  end
@@ -6,8 +6,8 @@ module Paperclip
6
6
  {}.tap do |h|
7
7
  all_styles = self.styles.keys + ['original']
8
8
  all_styles.each do |style|
9
- g = Paperclip::Geometry.from_file(self.path(style)) rescue nil
10
- h[style] = {'width' => g.width.to_i, 'height' => g.height.to_i, 'url' => self.url(style)} unless g.nil?
9
+ g = Paperclip::Geometry.from_file(self.path(style))
10
+ h[style] = {'width' => g.width.to_i, 'height' => g.height.to_i, 'url' => self.url(style)}
11
11
  end
12
12
  end
13
13
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../lib/insert_commands', __FILE__)
1
+ require File.join(File.dirname(File.expand_path(__FILE__)), 'lib', 'insert_commands')
2
2
 
3
3
  class LiquidCmsGenerator < Rails::Generator::Base
4
4
  def manifest
@@ -1,3 +1,2 @@
1
1
  require 'liquid_cms/role_authentication'
2
2
  require 'liquid_cms/configuration'
3
- require 'liquid_cms/cache_sweeper'
@@ -9,8 +9,6 @@ module Cms
9
9
  mattr_reader :context_class
10
10
  def self.context_class=(klass)
11
11
  @@context_class = klass
12
- return if klass.nil? || ENV['NO_CONTEXT'] == 'true'
13
-
14
12
  Dispatcher.to_prepare {
15
13
  eval(klass.to_s).extend Cms::ContextAssociation
16
14
 
@@ -21,7 +19,6 @@ module Cms
21
19
  @@context_class = nil
22
20
 
23
21
  def self.set_context(context, bind_to)
24
- return if @@context_class.nil?
25
22
  bind_to.instance_variable_set :@cms_context, context
26
23
  end
27
24
 
@@ -5,7 +5,7 @@ module Cms
5
5
  attr_reader :object
6
6
 
7
7
  def initialize(context = nil)
8
- @object = Cms.context_class ? context : nil
8
+ @object = context
9
9
  end
10
10
 
11
11
  def pages
@@ -1,3 +1,3 @@
1
1
  module Cms
2
- VERSION = "0.2.0.4"
2
+ VERSION = "0.2.0.5"
3
3
  end
@@ -3,7 +3,7 @@ Factory.define :company do |c|
3
3
  c.domain_name 'acme.com'
4
4
  c.subdomain 'test'
5
5
  c.after_create do |c|
6
- Factory(:home_page, Cms.context_class ? {:context => c} : {})
6
+ Factory(:home_page, :context => c)
7
7
  end
8
8
  c.after_create do |c|
9
9
  Factory(:user, :company => c)
@@ -1,5 +1,4 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
- require File.dirname(__FILE__) + '/../test_helpers/cache_helper'
3
2
 
4
3
  class Cms::PagesTest < ActionController::IntegrationTest
5
4
 
@@ -280,49 +279,4 @@ class Cms::PagesTest < ActionController::IntegrationTest
280
279
  assert_response 404
281
280
  end
282
281
  end
283
-
284
- context "caching" do
285
- setup do
286
- ActionController::Base.perform_caching = true
287
- Rails.cache.clear
288
- @page = Factory(:page, :context => @company)
289
- end
290
-
291
- teardown do
292
- ActionController::Base.perform_caching = false
293
- end
294
-
295
- should "expire the cache when the page is updated" do
296
- assert_cache_empty
297
-
298
- get @page.url
299
- assert_cache_present
300
-
301
- # updating the page will remove the cache
302
- put cms_page_path(@page), :content => 'new content'
303
- assert_cache_empty
304
-
305
- get @page.url
306
- assert_cache_present
307
-
308
- # destroying the page will remove the cache
309
- delete cms_page_path(@page)
310
- assert_cache_empty
311
- end
312
-
313
- should "generate a cache key" do
314
- get '/'
315
- assert_cache_key "views/CONTEXT_PATH_#{@company.id}"
316
-
317
- get @page.url
318
- assert_cache_key "views/CONTEXT_PATH_#{@company.id}/page"
319
-
320
- get @page.url+'?page=1&test=abcde'
321
- assert_cache_key "views/CONTEXT_PATH_#{@company.id}/page/page=1&test=abcde"
322
-
323
- # different order sent via url, but the path params will be sorted in the path
324
- get @page.url+'?test=abcde&page=1'
325
- assert_cache_key "views/CONTEXT_PATH_#{@company.id}/page/page=1&test=abcde"
326
- end
327
- end
328
282
  end
@@ -5,12 +5,6 @@ $:.unshift File.dirname(__FILE__)
5
5
  require "rails_app/config/environment"
6
6
  require 'test_help'
7
7
 
8
- if ENV['NO_CONTEXT'] == 'true'
9
- Cms.setup do |config|
10
- config.context_class = nil
11
- end
12
- end
13
-
14
8
  ActiveRecord::Migration.verbose = false
15
9
  ActiveRecord::Base.logger = Logger.new(nil)
16
10
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
@@ -51,3 +51,4 @@ class ActionController::IntegrationTest
51
51
  end
52
52
  end
53
53
  end
54
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid_cms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 87
4
+ hash: 85
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 0
10
- - 4
11
- version: 0.2.0.4
10
+ - 5
11
+ version: 0.2.0.5
12
12
  platform: ruby
13
13
  authors:
14
14
  - Andrew Kaspick