cacheable_flash 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/CHANGES ADDED
@@ -0,0 +1,29 @@
1
+ 0.2.0 by Peter Boling
2
+ - Converted to a gem
3
+ - Updated to improved, patched jquery.cookie from https://github.com/pboling/jquery-cookie
4
+ - Merged a few other forks of cacheable-flash
5
+ - Added Engine to hook into Rails 3.1 asset pipeline
6
+ - Added Railtie to improve usability with Rails 3.0
7
+ - Added Generator to improve usability with Rails < 3
8
+
9
+ Unreleased
10
+ - Implicitly adding js files to Rails include defaults (Patch from Michael Erb)
11
+
12
+ 0.1.5
13
+ - Requiring version >= 1.1.2 of the json gem
14
+ - Converted tests into specs
15
+
16
+ 0.1.4
17
+ - Added TestHelpers
18
+ - Added flash_cookie method for tests
19
+
20
+ 0.1.3
21
+ - Require json in init.rb
22
+
23
+ 0.1.2
24
+ - Flash on the Rails side is cleared when written to the cookie
25
+ - Uses existing cookie flash value
26
+ - Using Scriptaculous cookie.js library
27
+
28
+ 0.1.1
29
+ - Added cookies.js
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+
3
+ #gem "rails"
4
+ #We don't really need all of rails... so:
5
+ gem "activesupport"
6
+ gem "actionpack"
7
+ gem "json"
8
+
9
+ # Develop dependencies (everything needed to run rake, tests, features, etc.)
10
+ group :development do
11
+ gem "rspec", "~> 2.3.0"
12
+ gem "yard", "~> 0.6.0"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.6.4"
15
+ gem "reek", "~> 1.2.8"
16
+ gem "roodi", "~> 2.1.0"
17
+ end
@@ -0,0 +1,82 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionpack (3.1.0)
5
+ activemodel (= 3.1.0)
6
+ activesupport (= 3.1.0)
7
+ builder (~> 3.0.0)
8
+ erubis (~> 2.7.0)
9
+ i18n (~> 0.6)
10
+ rack (~> 1.3.2)
11
+ rack-cache (~> 1.0.3)
12
+ rack-mount (~> 0.8.2)
13
+ rack-test (~> 0.6.1)
14
+ sprockets (~> 2.0.0)
15
+ activemodel (3.1.0)
16
+ activesupport (= 3.1.0)
17
+ bcrypt-ruby (~> 3.0.0)
18
+ builder (~> 3.0.0)
19
+ i18n (~> 0.6)
20
+ activesupport (3.1.0)
21
+ multi_json (~> 1.0)
22
+ bcrypt-ruby (3.0.0)
23
+ builder (3.0.0)
24
+ diff-lcs (1.1.3)
25
+ erubis (2.7.0)
26
+ git (1.2.5)
27
+ hike (1.2.1)
28
+ i18n (0.6.0)
29
+ jeweler (1.6.4)
30
+ bundler (~> 1.0)
31
+ git (>= 1.2.5)
32
+ rake
33
+ json (1.5.4)
34
+ multi_json (1.0.3)
35
+ rack (1.3.2)
36
+ rack-cache (1.0.3)
37
+ rack (>= 0.4)
38
+ rack-mount (0.8.3)
39
+ rack (>= 1.0.0)
40
+ rack-test (0.6.1)
41
+ rack (>= 1.0)
42
+ rake (0.9.2)
43
+ reek (1.2.8)
44
+ ruby2ruby (~> 1.2)
45
+ ruby_parser (~> 2.0)
46
+ sexp_processor (~> 3.0)
47
+ roodi (2.1.0)
48
+ ruby_parser
49
+ rspec (2.3.0)
50
+ rspec-core (~> 2.3.0)
51
+ rspec-expectations (~> 2.3.0)
52
+ rspec-mocks (~> 2.3.0)
53
+ rspec-core (2.3.1)
54
+ rspec-expectations (2.3.0)
55
+ diff-lcs (~> 1.1.2)
56
+ rspec-mocks (2.3.0)
57
+ ruby2ruby (1.3.0)
58
+ ruby_parser (~> 2.0)
59
+ sexp_processor (~> 3.0)
60
+ ruby_parser (2.3.0)
61
+ sexp_processor (~> 3.0)
62
+ sexp_processor (3.0.6)
63
+ sprockets (2.0.0)
64
+ hike (~> 1.2)
65
+ rack (~> 1.0)
66
+ tilt (!= 1.3.0, ~> 1.1)
67
+ tilt (1.3.3)
68
+ yard (0.6.8)
69
+
70
+ PLATFORMS
71
+ ruby
72
+
73
+ DEPENDENCIES
74
+ actionpack
75
+ activesupport
76
+ bundler (~> 1.0.0)
77
+ jeweler (~> 1.6.4)
78
+ json
79
+ reek (~> 1.2.8)
80
+ roodi (~> 2.1.0)
81
+ rspec (~> 2.3.0)
82
+ yard (~> 0.6.0)
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2007-2010 Pivotal Labs
2
+ Copyright (c) 2011 Peter H. Boling (http://peterboling.com)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,150 @@
1
+ CacheableFlash
2
+ ==============
3
+
4
+ Note: This fork (http://github.com/pboling/cacheable-flash/tree/master) of
5
+ cacheable-flash aims to be a drop-in replacement for the original cacheable-flash
6
+ (by Pivotal) but uses JQuery instead of Prototype, and merged several of the forks
7
+ of the project to collect the best features and improvements. It has also been made
8
+ compatible with Rails 3, hooked into the asset pipeline for rails 3.1, and turned into a gem.
9
+
10
+ == Installation as plugin
11
+
12
+ ruby script/plugin install git://github.com/pboling/cacheable-flash.git
13
+
14
+ == Installation as gem
15
+
16
+ gem install 'cacheable_flash'
17
+
18
+ add to your Gemfile:
19
+ gem 'cacheable_flash'
20
+
21
+ == Setup
22
+
23
+ CacheableFlash adds its javascript dependencies as a Rails 3 javascript 'expansion',
24
+ which are only used is you are Note using the asset pipeline (apparently?).
25
+
26
+ So if you have config.assets.enabled = false in application.rb then in your layout:
27
+ javascript_include_tag :cacheable_flash
28
+
29
+ Otherwise, the asset pipeline should have access to the assets in this gem in your app/assets/application.js:
30
+
31
+ //= require flash
32
+ //= require jquery.cookie
33
+
34
+ == Description
35
+
36
+ This plugin enables greater levels of page caching by rendering flash
37
+ messages from a cookie using JavaScript, instead of in your Rails
38
+ view template. Flash contents are converted to JSON and placed in
39
+ a cookie by an after_filter in a controller.
40
+
41
+ == Mailing List
42
+
43
+ http://groups.google.com/group/PivotalLabsOpenSource
44
+ *This mailing list is for the original CacheableFlash, and may not be able to help with issues with this gem.
45
+
46
+ == Bug/Feature Tracker
47
+
48
+ https://github.com/pboling/cacheable-flash/issues
49
+
50
+ == Wiki
51
+
52
+ Please help document!
53
+
54
+ https://github.com/pboling/cacheable-flash/wiki
55
+
56
+ === Usage
57
+
58
+ To use, include the CacheableFlash module in your controller.
59
+ It's all or none on the actions in your controller, so you can't
60
+ mix JS and HTML display of your flash message in a controller.
61
+ No other modifications to the controller are needed. You will need
62
+ to add divs and some javascript to your view or layout templates
63
+ to render the flash in the browser.
64
+
65
+ Note that the cookie holding the flash messages is removed as the
66
+ page is displayed, so a refresh will clear the flash message (just
67
+ as happens normally).
68
+
69
+ === Example Controller
70
+
71
+ class MyController < ActionController::Base
72
+ include CacheableFlash
73
+ # ...
74
+ end
75
+
76
+ === Example Template Markup
77
+
78
+ <div id="error_div_id" class="flash flash_error"></div>
79
+ <div id="notice_div_id" class="flash flash_notice"></div>
80
+ <script type="text/javascript">
81
+ Flash.transferFromCookies();
82
+ Flash.writeDataTo('error', $('#error_div_id'));
83
+ Flash.writeDataTo('notice', $('#notice_div_id'));
84
+ </script>
85
+
86
+ == Testing
87
+ You can test your flash cookies by making assertions on the json of the "flash" cookie.
88
+ Cacheable Flash provides test helpers which includes the flash_cookie method.
89
+
90
+ === Test::Unit Example
91
+ require "cacheable_flash/test_helpers"
92
+
93
+ class TestController < ActionController::Base
94
+ def index
95
+ flash["notice"] = "In index"
96
+ end
97
+ end
98
+
99
+ class ControllerTest < Test::Unit::TestCase
100
+ include CacheableFlash::TestHelpers
101
+
102
+ def setup
103
+ @controller = TestController.new
104
+ @request = ActionController::TestRequest.new
105
+ @response = ActionController::TestResponse.new
106
+ end
107
+
108
+ def test_cacheable_flash_action
109
+ get :index
110
+ asset_equal "In index", flash_cookie["notice"]
111
+ end
112
+ end
113
+
114
+ === Rspec Example
115
+ require "cacheable_flash/test_helpers"
116
+
117
+ class TestController < ActionController::Base
118
+ def index
119
+ flash["notice"] = "In index"
120
+ end
121
+ end
122
+
123
+ describe TestController, "#index" do
124
+ include CacheableFlash::TestHelpers
125
+
126
+ it "writes to the flash cookie" do
127
+ get :index
128
+ flash_cookie["notice"].should == "In index"
129
+ end
130
+ end
131
+
132
+ == Contributing to cacheable-flash
133
+
134
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
135
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
136
+ * Fork the project
137
+ * Start a feature/bugfix branch
138
+ * Commit and push until you are happy with your contribution
139
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
140
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
141
+
142
+ == Copyright
143
+
144
+ Licensed under the MIT License.
145
+
146
+ Copyright (c) 2011 Peter H. Boling (http://peterboling.com). See LICENSE.txt for further details.
147
+ Copyright (c) 2007-2010 Pivotal Labs
148
+
149
+
150
+
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "cacheable_flash"
18
+ gem.homepage = "http://github.com/pboling/cacheable-flash"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Render flash messages from a cookie using JavaScript, instead of in your Rails
21
+ view template}
22
+ gem.description = %Q{This plugin enables greater levels of page caching by rendering flash
23
+ messages from a cookie using JavaScript, instead of in your Rails
24
+ view template. Flash contents are converted to JSON and placed in
25
+ a cookie by an after_filter in a controller.}
26
+ gem.email = "peter.boling@gmail.com"
27
+ gem.authors = ["Peter H. Boling","Brian Takita"]
28
+ # dependencies defined in Gemfile
29
+ end
30
+ Jeweler::RubygemsDotOrgTasks.new
31
+
32
+ require 'rspec/core'
33
+ require 'rspec/core/rake_task'
34
+ RSpec::Core::RakeTask.new(:spec) do |spec|
35
+ spec.pattern = FileList['spec/**/*_spec.rb']
36
+ end
37
+
38
+ require 'reek/rake/task'
39
+ Reek::Rake::Task.new do |t|
40
+ t.fail_on_error = true
41
+ t.verbose = false
42
+ t.source_files = 'lib/**/*.rb'
43
+ end
44
+
45
+ require 'roodi'
46
+ require 'roodi_task'
47
+ RoodiTask.new do |t|
48
+ t.verbose = false
49
+ end
50
+
51
+ task :default => :spec
52
+
53
+ require 'yard'
54
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -0,0 +1,88 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "cacheable_flash"
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Peter H. Boling", "Brian Takita"]
12
+ s.date = "2011-09-10"
13
+ s.description = "This plugin enables greater levels of page caching by rendering flash\nmessages from a cookie using JavaScript, instead of in your Rails\nview template. Flash contents are converted to JSON and placed in\na cookie by an after_filter in a controller."
14
+ s.email = "peter.boling@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "CHANGES",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "cacheable_flash.gemspec",
29
+ "init.rb",
30
+ "install.rb",
31
+ "lib/cacheable_flash.rb",
32
+ "lib/cacheable_flash/rails/engine.rb",
33
+ "lib/cacheable_flash/rails/railtie.rb",
34
+ "lib/generators/cacheable_flash/install/install_generator.rb",
35
+ "spec/cacheable_flash/cacheable_flash_spec.rb",
36
+ "spec/cacheable_flash/install_spec.rb",
37
+ "spec/cacheable_flash/test_helpers_spec.rb",
38
+ "spec/js_unit/cookie_test.html",
39
+ "spec/js_unit/flash_test.html",
40
+ "spec/spec_helper.rb",
41
+ "spec/support/test_helpers.rb",
42
+ "tasks/cacheable_flash_tasks.rake",
43
+ "vendor/assets/javascripts/flash.js",
44
+ "vendor/assets/javascripts/jquery.cookie.js"
45
+ ]
46
+ s.homepage = "http://github.com/pboling/cacheable-flash"
47
+ s.licenses = ["MIT"]
48
+ s.require_paths = ["lib"]
49
+ s.rubygems_version = "1.8.10"
50
+ s.summary = "Render flash messages from a cookie using JavaScript, instead of in your Rails view template"
51
+
52
+ if s.respond_to? :specification_version then
53
+ s.specification_version = 3
54
+
55
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
57
+ s.add_runtime_dependency(%q<actionpack>, [">= 0"])
58
+ s.add_runtime_dependency(%q<json>, [">= 0"])
59
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
60
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
61
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
62
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
63
+ s.add_development_dependency(%q<reek>, ["~> 1.2.8"])
64
+ s.add_development_dependency(%q<roodi>, ["~> 2.1.0"])
65
+ else
66
+ s.add_dependency(%q<activesupport>, [">= 0"])
67
+ s.add_dependency(%q<actionpack>, [">= 0"])
68
+ s.add_dependency(%q<json>, [">= 0"])
69
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
70
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
71
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
72
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
73
+ s.add_dependency(%q<reek>, ["~> 1.2.8"])
74
+ s.add_dependency(%q<roodi>, ["~> 2.1.0"])
75
+ end
76
+ else
77
+ s.add_dependency(%q<activesupport>, [">= 0"])
78
+ s.add_dependency(%q<actionpack>, [">= 0"])
79
+ s.add_dependency(%q<json>, [">= 0"])
80
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
81
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
82
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
83
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
84
+ s.add_dependency(%q<reek>, ["~> 1.2.8"])
85
+ s.add_dependency(%q<roodi>, ["~> 2.1.0"])
86
+ end
87
+ end
88
+
data/init.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "json"
2
+ require "cacheable_flash"
3
+ #use Rails::VERSION::STRING for rails < 1 somehow -- or perhaps, who cares??
4
+ if ::Rails::VERSION::MAJOR == 2
5
+ ActionView::Helpers::AssetTagHelper.register_javascript_include_default('jquery.cookie','flash')
6
+ end
@@ -0,0 +1,18 @@
1
+ # Only executed when installed as plugin.
2
+ # When installed as a gem must use the generator, unless using Rails >= 3.1,
3
+ # in which case the asset pipeline takes care of everything
4
+ require 'fileutils'
5
+ include FileUtils
6
+
7
+ dir = "#{File.dirname(__FILE__)}/vendor/assets/javascripts"
8
+ rails_javascripts_dir = "#{Rails.root}/public/javascripts"
9
+
10
+ puts "copying flash.js to #{rails_javascripts_dir}"
11
+ cp "#{dir}/flash.js", rails_javascripts_dir
12
+
13
+ if File.exists?("#{rails_javascripts_dir}/jquery.cookie.js")
14
+ puts "#{rails_javascripts_dir}/jquery.cookie.js already exists"
15
+ else
16
+ puts "copying jquery.cookie.js to #{rails_javascripts_dir}"
17
+ cp "#{dir}/jquery.cookie.js", rails_javascripts_dir
18
+ end
@@ -0,0 +1,37 @@
1
+ module CacheableFlash
2
+ if ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0
3
+ require 'cacheable_flash/rails/railtie'
4
+ elsif ::Rails.version >= "3.1"
5
+ require 'cacheable_flash/rails/engine'
6
+ else
7
+ # For older rails use generator
8
+ end
9
+
10
+ def self.included(base)
11
+ base.around_filter :write_flash_to_cookie
12
+ end
13
+
14
+ def write_flash_to_cookie
15
+ yield if block_given?
16
+ cookie_flash = if cookies['flash']
17
+ begin
18
+ ActiveSupport::JSON.decode(cookies['flash'])
19
+ rescue
20
+ {}
21
+ end
22
+ else
23
+ {}
24
+ end
25
+
26
+ flash.each do |key, value|
27
+ if cookie_flash[key.to_s].blank?
28
+ cookie_flash[key.to_s] = value.kind_of?(Numeric) ? value.to_s : value
29
+ else
30
+ cookie_flash[key.to_s] << "<br/>#{value}"
31
+ end
32
+ end
33
+
34
+ cookies['flash'] = cookie_flash.to_json.gsub("+", "%2B")
35
+ flash.clear
36
+ end
37
+ end
@@ -0,0 +1,13 @@
1
+ # Configure Rails 3.1:
2
+ # This gem contains this empty engine class which inherits from Rails::Engine.
3
+ # By doing this, Rails is informed that the directory for this gem may contain assets and the
4
+ # app/assets, lib/assets and vendor/assets directories of this engine are added to the search path of Sprockets.
5
+ module Jquery
6
+ module Rails
7
+
8
+ class Engine < ::Rails::Engine
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # Add cacheable flash JS to defaults for Rails < 3.1 (not needed with asset pipeline)
2
+ module Jquery
3
+ module Rails
4
+
5
+ class Railtie < ::Rails::Railtie
6
+ if ::Rails::VERSION::MAJOR == 3
7
+ config.before_configuration do
8
+ config.action_view.javascript_expansions[:cacheable_flash] = %w(flash jquery.cookie)
9
+ end
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ module CacheableFlash
4
+ # Copies javascript libraries flash.js and jquery.cookie.js to public/javascripts/ (Rails 3.0.X only, Rails 3.1 has asset pipeline)
5
+ #
6
+ # @example
7
+ # $ rails generate cacheable_flash:install
8
+ #
9
+ # @todo Test with Rails 3.0
10
+ class InstallGenerator < Rails::Generators::Base
11
+ source_root File.expand_path('../../../../vendor/assets/javascripts', __FILE__)
12
+ class_option :template_engine
13
+
14
+ # Rails 3.1 has the asset pipeline, no need to copy javascript files anymore
15
+ # Rails 3.0 doesn't have an asset pipeline, so we copy in javascript files
16
+ if ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0
17
+ desc "Copies some JS files to public/javascripts/"
18
+ def copy_files
19
+ template 'flash.js', 'public/javascripts/flash.js'
20
+ template 'jquery.cookie.js', 'public/javascripts/jquery.cookie.js'
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'CacheableFlash' do
4
+ attr_reader :controller_class, :controller, :cookies
5
+ before do
6
+ @controller_class = Struct.new(:cookies, :flash)
7
+ stub(@controller_class).around_filter
8
+ @controller_class.send(:include, CacheableFlash)
9
+ @controller = @controller_class.new({}, {})
10
+ @cookies = {}
11
+ stub(@controller).cookies {@cookies}
12
+ end
13
+
14
+ describe "#write_flash_to_cookie" do
15
+ context "when there is not an existing flash cookie" do
16
+ it "sets the flash cookie with a JSON representation of the Hash" do
17
+ expected_flash = {
18
+ 'errors' => "This is an Error",
19
+ 'notice' => "This is a Notice"
20
+ }
21
+ controller.flash = expected_flash.dup
22
+ controller.write_flash_to_cookie
23
+
24
+ JSON.parse(@controller.cookies['flash']).should == expected_flash
25
+ end
26
+ end
27
+
28
+ context "when there is an existing flash cookie" do
29
+ context "when the flash cookie is valid json" do
30
+ it "appends new data to existing flash cookie" do
31
+ @cookies['flash'] = {
32
+ 'notice' => "Existing notice",
33
+ 'errors' => "Existing errors",
34
+ }.to_json
35
+
36
+ @controller.flash = {
37
+ 'notice' => 'New notice',
38
+ 'errors' => 'New errors',
39
+ }
40
+
41
+ @controller.write_flash_to_cookie
42
+
43
+ expected_flash = {
44
+ 'notice' => "Existing notice<br/>New notice",
45
+ 'errors' => "Existing errors<br/>New errors",
46
+ }
47
+ JSON.parse(@controller.cookies['flash']).should == expected_flash
48
+ end
49
+ end
50
+
51
+ context "when the flash cookie is 'invalid' json" do
52
+ it "does not have an error and starts with an empty Hash" do
53
+ @cookies['flash'] = ""
54
+ lambda do
55
+ JSON.parse(@cookies['flash'])
56
+ end.should raise_error(JSON::ParserError)
57
+
58
+ @controller.write_flash_to_cookie
59
+
60
+ JSON.parse(@cookies['flash']).should == {}
61
+ end
62
+ end
63
+ end
64
+
65
+ it "converts flash value to string before storing in cookie if value is a number" do
66
+ @controller.flash = { 'quantity' => 5 }
67
+ @controller.write_flash_to_cookie
68
+ JSON.parse(@controller.cookies['flash']).should == { 'quantity' => "5" }
69
+ end
70
+
71
+ it "does not convert flash value to string before storing in cookie if value is anything other than a number" do
72
+ @controller.flash = { 'foo' => { 'bar' => 'baz' } }
73
+ @controller.write_flash_to_cookie
74
+ JSON.parse(@controller.cookies['flash']).should == { 'foo' => { 'bar' => 'baz' } }
75
+ end
76
+
77
+ it "encodes plus signs in generated JSON before storing in cookie" do
78
+ @controller.flash = { 'notice' => 'Life, Love + Liberty' }
79
+ @controller.write_flash_to_cookie
80
+ @controller.cookies['flash'].should == "{\"notice\": \"Life, Love %2B Liberty\"}"
81
+ end
82
+
83
+ it "clears the controller.flash hash provided by Rails" do
84
+ flash = {
85
+ 'errors' => "This is an Error",
86
+ 'notice' => "This is a Notice"
87
+ }
88
+ @controller.flash = flash
89
+ @controller.write_flash_to_cookie
90
+
91
+ @controller.flash.should == {}
92
+ end
93
+ end
94
+
95
+ describe ".included" do
96
+ it "sets the around_filter on the controller to call #write_flash_to_cookie" do
97
+ mock(@controller_class).around_filter(:write_flash_to_cookie)
98
+ @controller_class.send(:include, CacheableFlash)
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,68 @@
1
+ #This should only be tested for older rails when the generator is used, so commenting out for now.
2
+
3
+ #require 'spec_helper'
4
+ #
5
+ #describe "install.rb" do
6
+ # include FileUtils
7
+ #
8
+ # before do
9
+ # @rails_root = "#{Dir.tmpdir}/cachable_flash_#{Time.now.to_f}"
10
+ # Object.send(:remove_const, :RAILS_ROOT) if Object.const_defined?(:RAILS_ROOT)
11
+ # Object.const_set(:RAILS_ROOT, @rails_root)
12
+ #
13
+ # @stdout = StringIO.new("")
14
+ # $stdout = @stdout
15
+ #
16
+ # @js_dir = "#{@rails_root}/public/javascripts"
17
+ # FileUtils.mkdir_p(@js_dir)
18
+ # @install_path = "#{File.dirname(__FILE__)}/../../install.rb"
19
+ # end
20
+ #
21
+ # after do
22
+ # $stdout = STDOUT
23
+ # end
24
+ #
25
+ # describe "when project does not have json.js" do
26
+ # it "installs javascript files including json.js" do
27
+ # File.exists?("#{@js_dir}/flash.js").should be_false
28
+ # File.exists?("#{@js_dir}/json.js").should be_false
29
+ # File.exists?("#{@js_dir}/cookie.js").should be_false
30
+ # load(@install_path)
31
+ # File.exists?("#{@js_dir}/flash.js").should be_true
32
+ # File.exists?("#{@js_dir}/json.js").should be_true
33
+ # File.exists?("#{@js_dir}/cookie.js").should be_true
34
+ # end
35
+ # end
36
+ #
37
+ # describe "when project has json.js" do
38
+ # it "does not overwrite the existing json.js and installs other javascript files" do
39
+ # File.open("#{@js_dir}/json.js", "w") do |f|
40
+ # f.write "Original json.js"
41
+ # end
42
+ # File.exists?("#{@js_dir}/json.js").should be_true
43
+ # File.exists?("#{@js_dir}/flash.js").should be_false
44
+ # File.exists?("#{@js_dir}/cookie.js").should be_false
45
+ # load(@install_path)
46
+ # File.exists?("#{@js_dir}/flash.js").should be_true
47
+ # File.exists?("#{@js_dir}/cookie.js").should be_true
48
+ # File.exists?("#{@js_dir}/json.js").should be_true
49
+ # File.read("#{@js_dir}/json.js").should == "Original json.js"
50
+ # end
51
+ # end
52
+ #
53
+ # describe "when project has cookie.js" do
54
+ # it "does not overwrite the existing cookie.js" do
55
+ # File.open("#{@js_dir}/cookie.js", "w") do |f|
56
+ # f.write "Original cookie.js"
57
+ # end
58
+ # File.exists?("#{@js_dir}/json.js").should be_false
59
+ # File.exists?("#{@js_dir}/flash.js").should be_false
60
+ # File.exists?("#{@js_dir}/cookie.js").should be_true
61
+ # load(@install_path)
62
+ # File.exists?("#{@js_dir}/flash.js").should be_true
63
+ # File.exists?("#{@js_dir}/json.js").should be_true
64
+ # File.exists?("#{@js_dir}/cookie.js").should be_true
65
+ # File.read("#{@js_dir}/cookie.js").should == "Original cookie.js"
66
+ # end
67
+ # end
68
+ #end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ module CacheableFlash
4
+ describe TestHelpers do
5
+ attr_reader :controller, :request, :response, :flash, :cookies
6
+ include TestHelpers
7
+ before do
8
+ @controller = ActionController::Base.new
9
+ @request = ActionController::TestRequest.new
10
+ @response = ActionController::TestResponse.new
11
+ controller.send(:initialize_template_class, response)
12
+ controller.send(:assign_shortcuts, request, response)
13
+
14
+ @flash = controller.send(:flash)
15
+ class << controller
16
+ include CacheableFlash
17
+ end
18
+ end
19
+
20
+ describe "#flash_cookie" do
21
+ it "returns the flash hash send as a cookie" do
22
+ expected_flash = {
23
+ 'errors' => "This is an Error",
24
+ 'notice' => "This is a Notice"
25
+ }
26
+ flash['errors'] = expected_flash['errors']
27
+ flash['notice'] = expected_flash['notice']
28
+
29
+ controller.write_flash_to_cookie
30
+ @cookies = response.cookies # simulate setting the cookie instance variable in rails tests
31
+
32
+ flash_cookie.should == expected_flash
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,60 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <!-- You will need to change this to point to your jsUnitCore.js -->
6
+ <script src="http://localhost:3000/jsunit/app/jsUnitCore.js" type="text/javascript"></script>
7
+
8
+ <script src="../../javascripts/jquery.js" type="text/javascript"></script>
9
+ <script src="../../javascripts/cookie.js" type="text/javascript"></script>
10
+
11
+ <script language="javascript" type="text/javascript">
12
+ var content;
13
+ function setUp() {
14
+ content = $('#content');
15
+ Cookie.eraseAll();
16
+ }
17
+
18
+ function tearDown() {
19
+ Cookie.eraseAll();
20
+ }
21
+
22
+ function test_read() {
23
+ var expires = new Date();
24
+ expires.setYear(expires.getFullYear() + 1);
25
+ document.cookie = "foobar=baz; path=/; expires=" + expires.toGMTString();
26
+
27
+ assertEquals('baz', Cookie.get('foobar'));
28
+ }
29
+
30
+ function test_write() {
31
+ Cookie.set('foobar', 'baz');
32
+ assertEquals("baz", Cookie.get('foobar'));
33
+ }
34
+
35
+ function test_expire() {
36
+ Cookie.set('foobar', 'baz');
37
+ Cookie.erase('foobar');
38
+ assertNull(Cookie.get('foobar'));
39
+ }
40
+
41
+ function test_expireAll() {
42
+ Cookie.set('foobar', 'baz');
43
+ Cookie.set('another', 'cookie');
44
+
45
+ Cookie.eraseAll();
46
+
47
+ assertNull(Cookie.get('foobar'));
48
+ assertNull(Cookie.get('another'));
49
+ }
50
+
51
+ </script>
52
+
53
+ </head>
54
+
55
+ <body>
56
+ <div id="fixture">
57
+ <div id="content"></div>
58
+ </div>
59
+ </body>
60
+ </html>
@@ -0,0 +1,112 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <!-- You will need to change this to point to your jsUnitCore.js -->
6
+ <script src="http://localhost:3000/jsunit/app/jsUnitCore.js" type="text/javascript"></script>
7
+
8
+ <script src="../../javascripts/jquery.js" type="text/javascript"></script>
9
+ <script src="../../javascripts/cookie.js" type="text/javascript"></script>
10
+ <script src="../../javascripts/json.js" type="text/javascript"></script>
11
+ <script src="../../vendor/assets/javascripts/flash.js" type="text/javascript"></script>
12
+ <script type="text/javascript">
13
+ Include.jsUnitCore();
14
+ Include.allProduction();
15
+ Include.allCommonTest();
16
+ Include.testHelper();
17
+ </script>
18
+
19
+ <script language="javascript" type="text/javascript">
20
+ var content;
21
+ function setUp() {
22
+ content = $('#content');
23
+ content.html("");
24
+ Cookie.eraseAll();
25
+ }
26
+
27
+ function tearDown() {
28
+ Cookie.eraseAll();
29
+ }
30
+
31
+ function test_transferFromCookies_setsFlashData_whenCookieExists() {
32
+ var expectedData = {
33
+ 'error': "The Error",
34
+ 'notice': "The Notice"
35
+ };
36
+ setUpCookieWithData(expectedData);
37
+ Flash.transferFromCookies();
38
+ assertHashEquals(expectedData, Flash.data);
39
+ }
40
+
41
+ function test_transferFromCookies_setsFlashDataToEmptyHash_whenCookieDoesNotExist() {
42
+ Flash.transferFromCookies();
43
+ assertHashEquals({}, Flash.data);
44
+ }
45
+
46
+ function test_transferFromCookies_setsFlashDataToEmptyHash_whenCookieIsEmpty() {
47
+ setUpCookieWithData("");
48
+ Flash.transferFromCookies();
49
+ assertHashEquals({}, Flash.data);
50
+ }
51
+
52
+ function test_transferFromCookies_removeFlashCookie() {
53
+ setUpCookieWithData({
54
+ 'error': "The Error",
55
+ 'notice': "The Notice"
56
+ });
57
+ Flash.transferFromCookies();
58
+ assertNull(Cookie.get("flash"));
59
+ }
60
+
61
+ // how do I test this??
62
+ function test_transferFromCookies_whenValueContainsAPlusSign() {
63
+ setUpCookieWithData({
64
+ 'notice': "Book+%2B+Gift+Box"
65
+ });
66
+ Flash.transferFromCookies();
67
+ assertEquals("Book + Gift Box", Cookie.get("notice"));
68
+ }
69
+
70
+ function test_writeDataTo_whenThereIsACookieValue() {
71
+ setUpCookieWithData({
72
+ 'error': "This+is%20An+Error"
73
+ });
74
+ Flash.transferFromCookies();
75
+ Flash.writeDataTo('error', content);
76
+
77
+ assertEquals("This is An Error", content.html());
78
+ }
79
+
80
+ function test_writeDataTo_whenThereIsNoCookieValue() {
81
+ setUpCookieWithData({});
82
+ Flash.transferFromCookies();
83
+ Flash.writeDataTo('notice', content);
84
+
85
+ assertEquals("", content.html());
86
+ }
87
+
88
+ function test_writeDataTo_whenPassedAnElementId() {
89
+ setUpCookieWithData({
90
+ 'error': "This+is%20An+Error"
91
+ });
92
+
93
+ Flash.transferFromCookies();
94
+ Flash.writeDataTo('error', '#content');
95
+
96
+ assertEquals("This is An Error", content.html());
97
+ }
98
+
99
+ function setUpCookieWithData(values) {
100
+ Cookie.set('flash', JSON.stringify(values));
101
+ }
102
+
103
+ </script>
104
+
105
+ </head>
106
+
107
+ <body>
108
+ <div id="fixture">
109
+ <div id="content"></div>
110
+ </div>
111
+ </body>
112
+ </html>
@@ -0,0 +1,20 @@
1
+ #TODO: Specs will need a 'test' rails app to run within, or to mock things like ::Rails.root
2
+
3
+ require 'rspec'
4
+ require "json"
5
+ require "active_support"
6
+ require "action_controller"
7
+
8
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
10
+
11
+ require 'cacheable_flash'
12
+ require "support/test_helpers"
13
+
14
+ # Requires supporting files with custom matchers and macros, etc,
15
+ # in ./support/ and its subdirectories.
16
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
17
+
18
+ RSpec.configure do |config|
19
+
20
+ end
@@ -0,0 +1,10 @@
1
+ module CacheableFlash
2
+ module TestHelpers
3
+ def flash_cookie
4
+ return {} unless cookies['flash']
5
+ ActiveSupport::JSON.decode(cookies['flash'])
6
+ rescue JSON::ParserError
7
+ {}
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :cacheable_flash do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,21 @@
1
+ // refactoring from https://github.com/leonid-shevtsov/cacheable-flash-jquery
2
+ var Flash = new Object();
3
+
4
+ Flash.data = {};
5
+
6
+ Flash.transferFromCookies = function() {
7
+ var data = JSON.parse(unescape($.cookie("flash")));
8
+ if(!data) data = {};
9
+ Flash.data = data;
10
+ $.cookie('flash',null, {path: '/'});
11
+ };
12
+
13
+ Flash.writeDataTo = function(name, element) {
14
+ element = $(element);
15
+ var content = "";
16
+ if (Flash.data[name]) {
17
+ message = Flash.data[name].toString().replace(/\+/g, ' ');
18
+ element.html(message);
19
+ element.show();
20
+ }
21
+ };
@@ -0,0 +1,91 @@
1
+ /*jslint browser: true */ /*global jQuery: true */
2
+
3
+ /**
4
+ * jQuery Cookie plugin
5
+ *
6
+ * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
7
+ * Dual licensed under the MIT and GPL licenses:
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ * http://www.gnu.org/licenses/gpl.html
10
+ *
11
+ */
12
+
13
+ // TODO JsDoc
14
+
15
+ /**
16
+ * Create a cookie with the given key and value and other optional parameters.
17
+ *
18
+ * @example $.cookie('the_cookie', 'the_value');
19
+ * @desc Set the value of a cookie.
20
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
21
+ * @desc Create a cookie with all available options.
22
+ * @example $.cookie('the_cookie', 'the_value');
23
+ * @desc Create a session cookie.
24
+ * @example $.cookie('the_cookie', null);
25
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
26
+ * used when the cookie was set.
27
+ *
28
+ * @param String key The key of the cookie.
29
+ * @param String value The value of the cookie.
30
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
31
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
32
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
33
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
34
+ * when the the browser exits.
35
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
36
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
37
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
38
+ * require a secure protocol (like HTTPS).
39
+ * @type undefined
40
+ *
41
+ * @name $.cookie
42
+ * @cat Plugins/Cookie
43
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
44
+ */
45
+
46
+ /**
47
+ * Get the value of a cookie with the given key.
48
+ *
49
+ * @example $.cookie('the_cookie');
50
+ * @desc Get the value of a cookie.
51
+ *
52
+ * @param String key The key of the cookie.
53
+ * @return The value of the cookie.
54
+ * @type String
55
+ *
56
+ * @name $.cookie
57
+ * @cat Plugins/Cookie
58
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
59
+ */
60
+ jQuery.cookie = function (key, value, options) {
61
+
62
+ // key and at least value given, set cookie...
63
+ if (arguments.length > 1 && String(value) !== "[object Object]") {
64
+ options = jQuery.extend({}, options);
65
+
66
+ if (value === null || value === undefined) {
67
+ options.expires = -1;
68
+ }
69
+
70
+ if (typeof options.expires === 'number') {
71
+ var days = options.expires, t = options.expires = new Date();
72
+ options.expires.setDate(t.getDate() + days);
73
+ }
74
+
75
+ value = String(value);
76
+
77
+ return (document.cookie = [
78
+ encodeURIComponent(key), '=',
79
+ options.raw ? value : encodeURIComponent(value),
80
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
81
+ options.path ? '; path=' + options.path : '',
82
+ options.domain ? '; domain=' + options.domain : '',
83
+ options.secure ? '; secure' : ''
84
+ ].join(''));
85
+ }
86
+
87
+ // key and possibly options given, get cookie...
88
+ options = value || {};
89
+ var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
90
+ return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
91
+ };
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cacheable_flash
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Peter H. Boling
9
+ - Brian Takita
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-09-10 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ requirement: &70270132209960 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70270132209960
26
+ - !ruby/object:Gem::Dependency
27
+ name: actionpack
28
+ requirement: &70270132209460 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *70270132209460
37
+ - !ruby/object:Gem::Dependency
38
+ name: json
39
+ requirement: &70270132208960 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70270132208960
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: &70270132208460 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 2.3.0
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *70270132208460
59
+ - !ruby/object:Gem::Dependency
60
+ name: yard
61
+ requirement: &70270132207920 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 0.6.0
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *70270132207920
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: &70270132207420 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.0.0
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *70270132207420
81
+ - !ruby/object:Gem::Dependency
82
+ name: jeweler
83
+ requirement: &70270132206920 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 1.6.4
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *70270132206920
92
+ - !ruby/object:Gem::Dependency
93
+ name: reek
94
+ requirement: &70270132206360 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 1.2.8
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *70270132206360
103
+ - !ruby/object:Gem::Dependency
104
+ name: roodi
105
+ requirement: &70270132205880 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 2.1.0
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: *70270132205880
114
+ description: ! 'This plugin enables greater levels of page caching by rendering flash
115
+
116
+ messages from a cookie using JavaScript, instead of in your Rails
117
+
118
+ view template. Flash contents are converted to JSON and placed in
119
+
120
+ a cookie by an after_filter in a controller.'
121
+ email: peter.boling@gmail.com
122
+ executables: []
123
+ extensions: []
124
+ extra_rdoc_files:
125
+ - LICENSE.txt
126
+ - README.rdoc
127
+ files:
128
+ - .document
129
+ - CHANGES
130
+ - Gemfile
131
+ - Gemfile.lock
132
+ - LICENSE.txt
133
+ - README.rdoc
134
+ - Rakefile
135
+ - VERSION
136
+ - cacheable_flash.gemspec
137
+ - init.rb
138
+ - install.rb
139
+ - lib/cacheable_flash.rb
140
+ - lib/cacheable_flash/rails/engine.rb
141
+ - lib/cacheable_flash/rails/railtie.rb
142
+ - lib/generators/cacheable_flash/install/install_generator.rb
143
+ - spec/cacheable_flash/cacheable_flash_spec.rb
144
+ - spec/cacheable_flash/install_spec.rb
145
+ - spec/cacheable_flash/test_helpers_spec.rb
146
+ - spec/js_unit/cookie_test.html
147
+ - spec/js_unit/flash_test.html
148
+ - spec/spec_helper.rb
149
+ - spec/support/test_helpers.rb
150
+ - tasks/cacheable_flash_tasks.rake
151
+ - vendor/assets/javascripts/flash.js
152
+ - vendor/assets/javascripts/jquery.cookie.js
153
+ homepage: http://github.com/pboling/cacheable-flash
154
+ licenses:
155
+ - MIT
156
+ post_install_message:
157
+ rdoc_options: []
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ segments:
167
+ - 0
168
+ hash: -1173852377275099503
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 1.8.10
178
+ signing_key:
179
+ specification_version: 3
180
+ summary: Render flash messages from a cookie using JavaScript, instead of in your
181
+ Rails view template
182
+ test_files: []