rails_4_session_flash_backport 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a891f45888bdc2ea5e4f3193d2d61c7e76246c0
4
- data.tar.gz: b027627596976b2e99e8a97d31f5a4bfda9c66c7
3
+ metadata.gz: 63cb81e1721af494a2b7ae4f05715d8f7c3d3e2a
4
+ data.tar.gz: b774150f014fb78bf4b0c964ddc3d78c87b155ab
5
5
  SHA512:
6
- metadata.gz: ffc270cf553b3b6763b620b30259035536372cc94678efbf1279b516e7775f8e9d953d77d0e0f5772fad270c9a1f9481dd2e8caafe0fce495cdae4c0d80a1d36
7
- data.tar.gz: d0b9954fb0cc5f68a7fe4053c28cb100bb1b91bf9bde5add4bd0f0d9ac82a5d7531ec2792a4a5563240f9f8c77f6ebd5a2f8b1866572b01db1f5c0b987285b43
6
+ metadata.gz: 01b2eeb5c36ebff671e5521b8905545d97f5956c6f5a52fd2cddacb250336757015417be93cede9cbd838b551cf388003a9a130247ddb8b87c96dd59f1a83d4e
7
+ data.tar.gz: 92f2a7a0e6e711e7a01fb4a6f6255e22b536eac7eca0efd232b76adc0fb441b838bbc41a03483867636b7419fc3b5b01b8353e7b95e8e95ed9c5740f278aa624
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ ��'M�^0�IR9b�fL��{K4��i
2
+ |�j%3��1���8n��ʎ�8����+2�6�Q�����j�CGԐ�f ���!��4�J���N&����������b��G����d�8��}�`��H�؜dF]��c侒p}����IA)����n�P?rƴ�/�c1Yq��t> ��3;�?�RP"Mf�FL߽�R=��{�� �
3
+ ��@~Z�=�Y�xv�Zԕ#9�/��޲�#��7=��5{9kD2Q���_�
data.tar.gz.sig ADDED
Binary file
data/.travis.yml CHANGED
@@ -2,3 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.5
6
+ - 2.2.0
data/Gemfile CHANGED
@@ -1,11 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in rails_4_session_flash_backport.gemspec
4
3
  gemspec
5
-
6
- group :development do
7
- gem 'rake'
8
- gem "rspec"
9
- gem "actionpack", ENV["ACTIONPACK_VERSION"] || "3.2.9"
10
- gem "pry"
11
- end
data/README.md CHANGED
@@ -9,14 +9,15 @@ good ol' `ActionDispatch::Session::SessionRestoreError` making life difficult.
9
9
  This gem was created because we wanted to be able to keep our users Rails 2
10
10
  sessions working on Rails 3, and we figured as long as we're going to be doing
11
11
  crazy stuff we might as well go and use the far more sensible practice from
12
- Rails 4 of storing the flash as basic ruby types.
12
+ Rails 4 of storing the flash as basic ruby types and sweeping the flash before
13
+ persisting into the session.
13
14
 
14
15
  For more details of the how and why, check out our blog post
15
16
  [Happily upgrading Ruby on Rails at production scale](http://webuild.envato.com/blog/upgrading-ruby-on-rails-at-production-scale/)
16
17
 
17
18
  When using this gem on a Rails 2 or 3 app:
18
19
 
19
- - Flash messages are stored as basic objects in the Rails 4 style.
20
+ - Flash messages are stored as basic objects in the Rails 4 style, pre-swept.
20
21
  - Flash messages in the Rails 2 format can be successfully decoded.
21
22
  - Flash messages in the Rails 3 format can be successfully decoded.
22
23
  - Flash messages in the Rails 4 format can be successfully decoded.
@@ -33,8 +34,9 @@ Rails 3 servers concurrently with your Rails 2 cluster to verify everything is
33
34
  fine and performance is acceptable without
34
35
  having to do the all-in switch.
35
36
 
36
- _Please Note_ this gem is not intended to be loaded in Rails 4. If you're using
37
- Rails 4, you've already got all of this gem's functionality!
37
+ This gem also now backports functionality for Rails 2, 3 and 4 which backports
38
+ sweeping the flash before persisting it into the session. This means putting
39
+ large objects into `flash.now` shouldn't cause `CookieOverflow` errors.
38
40
 
39
41
  ## Installation
40
42
 
@@ -53,5 +55,5 @@ Or install it yourself as:
53
55
  Copyright
54
56
  ---------
55
57
 
56
- Copyright (c) 2012 [Envato](http://envato.com), [Lucas Parry](http://github.com/lparry), [chendo](http://github.com/chendo). See LICENSE.txt for further details.
58
+ Copyright (c) 2012 [Envato](http://envato.com), [Lucas Parry](http://github.com/lparry), [chendo](http://github.com/chendo), [sj26](http://github.com/sj26). See LICENSE.txt for further details.
57
59
 
data/Rakefile CHANGED
@@ -1,21 +1,46 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
3
  namespace :spec do
4
+ task :rails2 do
5
+ Bundler.with_clean_env do
6
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../gemfiles/Gemfile.rails2", __FILE__)
7
+
8
+ system "bundle", "check" or
9
+ system "bundle" or
10
+ raise "Couldn't install bundle from gemfiles/Gemfile.rails2"
11
+
12
+ system "bundle", "exec", "rspec", "--color", "spec/rails2" or
13
+ fail
14
+ end
15
+ end
16
+
4
17
  task :rails3 do
5
- system "export ACTIONPACK_VERSION=3.2.9 && bundle check > /dev/null || bundle install"
6
- puts "Running Rails 3 specs"
7
- system "export ACTIONPACK_VERSION=3.2.9 && bundle exec rspec --color spec/rails3"
8
- puts ""
18
+ Bundler.with_clean_env do
19
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../gemfiles/Gemfile.rails3", __FILE__)
20
+
21
+ system "bundle", "check" or
22
+ system "bundle" or
23
+ raise "Couldn't install bundle from gemfiles/Gemfile.rails3"
24
+
25
+ system "bundle", "exec", "rspec", "--color", "spec/rails3" or
26
+ fail
27
+ end
9
28
  end
10
29
 
11
- task :rails2 do
12
- system "export ACTIONPACK_VERSION=2.3.14 && bundle check > /dev/null || bundle install"
13
- puts "Running Rails 2 specs"
14
- system "export ACTIONPACK_VERSION=2.3.14 && bundle exec rspec --color spec/rails2"
15
- puts ""
30
+ task :rails4 do
31
+ Bundler.with_clean_env do
32
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../gemfiles/Gemfile.rails4", __FILE__)
33
+
34
+ system "bundle", "check" or
35
+ system "bundle" or
36
+ raise "Couldn't install bundle from gemfiles/Gemfile.rails4"
37
+
38
+ system "bundle", "exec", "rspec", "--color", "spec/rails4" or
39
+ fail
40
+ end
16
41
  end
17
42
  end
18
43
 
19
- task :spec => ["spec:rails2", "spec:rails3"]
44
+ task :spec => ["spec:rails2", "spec:rails3", "spec:rails4"]
20
45
 
21
46
  task :default => :spec
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => ".."
4
+
5
+ group :development do
6
+ gem "actionpack", "~> 2.3"
7
+ gem "iconv"
8
+ end
@@ -0,0 +1,60 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rails_4_session_flash_backport (0.0.4)
5
+ rails (< 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (2.3.18)
11
+ actionpack (= 2.3.18)
12
+ actionpack (2.3.18)
13
+ activesupport (= 2.3.18)
14
+ rack (~> 1.1.0)
15
+ activerecord (2.3.18)
16
+ activesupport (= 2.3.18)
17
+ activeresource (2.3.18)
18
+ activesupport (= 2.3.18)
19
+ activesupport (2.3.18)
20
+ coderay (1.1.0)
21
+ diff-lcs (1.2.5)
22
+ iconv (1.0.4)
23
+ method_source (0.8.2)
24
+ pry (0.10.1)
25
+ coderay (~> 1.1.0)
26
+ method_source (~> 0.8.1)
27
+ slop (~> 3.4)
28
+ rack (1.1.6)
29
+ rails (2.3.18)
30
+ actionmailer (= 2.3.18)
31
+ actionpack (= 2.3.18)
32
+ activerecord (= 2.3.18)
33
+ activeresource (= 2.3.18)
34
+ activesupport (= 2.3.18)
35
+ rake (>= 0.8.3)
36
+ rake (10.4.2)
37
+ rspec (3.1.0)
38
+ rspec-core (~> 3.1.0)
39
+ rspec-expectations (~> 3.1.0)
40
+ rspec-mocks (~> 3.1.0)
41
+ rspec-core (3.1.7)
42
+ rspec-support (~> 3.1.0)
43
+ rspec-expectations (3.1.2)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.1.0)
46
+ rspec-mocks (3.1.3)
47
+ rspec-support (~> 3.1.0)
48
+ rspec-support (3.1.2)
49
+ slop (3.6.0)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ actionpack (~> 2.3)
56
+ iconv
57
+ pry
58
+ rails_4_session_flash_backport!
59
+ rake
60
+ rspec
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => ".."
4
+
5
+ group :development do
6
+ gem "actionpack", "~> 3.2"
7
+ end
@@ -0,0 +1,115 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rails_4_session_flash_backport (0.0.4)
5
+ rails (< 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.21)
11
+ actionpack (= 3.2.21)
12
+ mail (~> 2.5.4)
13
+ actionpack (3.2.21)
14
+ activemodel (= 3.2.21)
15
+ activesupport (= 3.2.21)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.21)
24
+ activesupport (= 3.2.21)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.21)
27
+ activemodel (= 3.2.21)
28
+ activesupport (= 3.2.21)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.21)
32
+ activemodel (= 3.2.21)
33
+ activesupport (= 3.2.21)
34
+ activesupport (3.2.21)
35
+ i18n (~> 0.6, >= 0.6.4)
36
+ multi_json (~> 1.0)
37
+ arel (3.0.3)
38
+ builder (3.0.4)
39
+ coderay (1.1.0)
40
+ diff-lcs (1.2.5)
41
+ erubis (2.7.0)
42
+ hike (1.2.3)
43
+ i18n (0.7.0)
44
+ journey (1.0.4)
45
+ json (1.8.2)
46
+ mail (2.5.4)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ method_source (0.8.2)
50
+ mime-types (1.25.1)
51
+ multi_json (1.10.1)
52
+ polyglot (0.3.5)
53
+ pry (0.10.1)
54
+ coderay (~> 1.1.0)
55
+ method_source (~> 0.8.1)
56
+ slop (~> 3.4)
57
+ rack (1.4.5)
58
+ rack-cache (1.2)
59
+ rack (>= 0.4)
60
+ rack-ssl (1.3.4)
61
+ rack
62
+ rack-test (0.6.3)
63
+ rack (>= 1.0)
64
+ rails (3.2.21)
65
+ actionmailer (= 3.2.21)
66
+ actionpack (= 3.2.21)
67
+ activerecord (= 3.2.21)
68
+ activeresource (= 3.2.21)
69
+ activesupport (= 3.2.21)
70
+ bundler (~> 1.0)
71
+ railties (= 3.2.21)
72
+ railties (3.2.21)
73
+ actionpack (= 3.2.21)
74
+ activesupport (= 3.2.21)
75
+ rack-ssl (~> 1.3.2)
76
+ rake (>= 0.8.7)
77
+ rdoc (~> 3.4)
78
+ thor (>= 0.14.6, < 2.0)
79
+ rake (10.4.2)
80
+ rdoc (3.12.2)
81
+ json (~> 1.4)
82
+ rspec (3.1.0)
83
+ rspec-core (~> 3.1.0)
84
+ rspec-expectations (~> 3.1.0)
85
+ rspec-mocks (~> 3.1.0)
86
+ rspec-core (3.1.7)
87
+ rspec-support (~> 3.1.0)
88
+ rspec-expectations (3.1.2)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.1.0)
91
+ rspec-mocks (3.1.3)
92
+ rspec-support (~> 3.1.0)
93
+ rspec-support (3.1.2)
94
+ slop (3.6.0)
95
+ sprockets (2.2.3)
96
+ hike (~> 1.2)
97
+ multi_json (~> 1.0)
98
+ rack (~> 1.0)
99
+ tilt (~> 1.1, != 1.3.0)
100
+ thor (0.19.1)
101
+ tilt (1.4.1)
102
+ treetop (1.4.15)
103
+ polyglot
104
+ polyglot (>= 0.3.1)
105
+ tzinfo (0.3.42)
106
+
107
+ PLATFORMS
108
+ ruby
109
+
110
+ DEPENDENCIES
111
+ actionpack (~> 3.2)
112
+ pry
113
+ rails_4_session_flash_backport!
114
+ rake
115
+ rspec
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => ".."
4
+
5
+ group :development do
6
+ gem "actionpack", "~> 4.0"
7
+ end
@@ -0,0 +1,110 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ rails_4_session_flash_backport (0.0.4)
5
+ rails (< 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.0)
11
+ actionpack (= 4.2.0)
12
+ actionview (= 4.2.0)
13
+ activejob (= 4.2.0)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.0)
17
+ actionview (= 4.2.0)
18
+ activesupport (= 4.2.0)
19
+ rack (~> 1.6.0)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
23
+ actionview (4.2.0)
24
+ activesupport (= 4.2.0)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
29
+ activejob (4.2.0)
30
+ activesupport (= 4.2.0)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.0)
33
+ activesupport (= 4.2.0)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.0)
36
+ activemodel (= 4.2.0)
37
+ activesupport (= 4.2.0)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.0)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ arel (6.0.0)
46
+ builder (3.2.2)
47
+ coderay (1.1.0)
48
+ diff-lcs (1.2.5)
49
+ erubis (2.7.0)
50
+ globalid (0.3.0)
51
+ activesupport (>= 4.1.0)
52
+ i18n (0.7.0)
53
+ json (1.8.2)
54
+ loofah (2.0.1)
55
+ nokogiri (>= 1.5.9)
56
+ mail (2.6.3)
57
+ mime-types (>= 1.16, < 3)
58
+ method_source (0.8.2)
59
+ mime-types (2.4.3)
60
+ mini_portile (0.6.2)
61
+ minitest (5.5.1)
62
+ nokogiri (1.6.6.2)
63
+ mini_portile (~> 0.6.0)
64
+ pry (0.10.1)
65
+ coderay (~> 1.1.0)
66
+ method_source (~> 0.8.1)
67
+ slop (~> 3.4)
68
+ rack (1.6.0)
69
+ rack-test (0.6.3)
70
+ rack (>= 1.0)
71
+ rails (0.9.5)
72
+ actionmailer (>= 0.6.1)
73
+ actionpack (>= 1.4.0)
74
+ activerecord (>= 1.6.0)
75
+ rake (>= 0.4.15)
76
+ rails-deprecated_sanitizer (1.0.3)
77
+ activesupport (>= 4.2.0.alpha)
78
+ rails-dom-testing (1.0.5)
79
+ activesupport (>= 4.2.0.beta, < 5.0)
80
+ nokogiri (~> 1.6.0)
81
+ rails-deprecated_sanitizer (>= 1.0.1)
82
+ rails-html-sanitizer (1.0.1)
83
+ loofah (~> 2.0)
84
+ rake (10.4.2)
85
+ rspec (3.1.0)
86
+ rspec-core (~> 3.1.0)
87
+ rspec-expectations (~> 3.1.0)
88
+ rspec-mocks (~> 3.1.0)
89
+ rspec-core (3.1.7)
90
+ rspec-support (~> 3.1.0)
91
+ rspec-expectations (3.1.2)
92
+ diff-lcs (>= 1.2.0, < 2.0)
93
+ rspec-support (~> 3.1.0)
94
+ rspec-mocks (3.1.3)
95
+ rspec-support (~> 3.1.0)
96
+ rspec-support (3.1.2)
97
+ slop (3.6.0)
98
+ thread_safe (0.3.4)
99
+ tzinfo (1.2.2)
100
+ thread_safe (~> 0.1)
101
+
102
+ PLATFORMS
103
+ ruby
104
+
105
+ DEPENDENCIES
106
+ actionpack (~> 4.0)
107
+ pry
108
+ rails_4_session_flash_backport!
109
+ rake
110
+ rspec
@@ -7,6 +7,8 @@ when 2
7
7
  require 'rails_4_session_flash_backport/rails2/session_with_indifferent_access'
8
8
  when 3
9
9
  require 'rails_4_session_flash_backport/rails3/flash_hash'
10
+ when 4
11
+ require 'rails_4_session_flash_backport/rails4/flash_hash'
10
12
  else
11
13
  Rails.logger.warn "rails_4_session_flash_backport doesnt yet do anything on Rails #{Rails.version}"
12
14
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ require 'active_support'
2
3
  require 'action_controller/flash'
3
4
  require 'action_controller/test_process'
4
5
  # Backport Rails 4 style storing the flash as basic ruby types to Rails 2
@@ -6,30 +7,32 @@ module ActionController #:nodoc:
6
7
  module Flash
7
8
  class FlashHash
8
9
  def self.from_session_value(value)
9
- flash = case value
10
- when FlashHash # Rails 2.3
11
- value
12
- when ::ActionDispatch::Flash::FlashHash # Rails 3.2
13
- flashes = value.instance_variable_get(:@flashes) || {}
14
- used_set = value.instance_variable_get(:@used) || []
15
- used = Hash[flashes.keys.map{|k| [k, used_set.include?(k)] }]
16
- new_from_values(flashes, used)
17
- when Hash # Rails 4.0
18
- flashes = value['flashes'] || {}
19
- discard = value['discard']
20
- used = Hash[flashes.keys.map{|k| [k, discard.include?(k)] }]
10
+ case value
11
+ when FlashHash # Rails 2.3
12
+ value.tap(&:sweep)
13
+ when ::ActionDispatch::Flash::FlashHash # Rails 3.2
14
+ flashes = value.instance_variable_get(:@flashes)
15
+ if discard = value.instance_variable_get(:@used).presence
16
+ flashes.except!(*discard)
17
+ end
18
+
19
+ new_from_session(flashes)
20
+ when Hash # Rails 4.0
21
+ flashes = value['flashes'] || {}
22
+ if discard = value['discard'].presence
23
+ flashes.except!(*discard)
24
+ end
21
25
 
22
- new_from_values(flashes, used)
23
- else
24
- new
25
- end
26
- flash
26
+ new_from_session(flashes)
27
+ else
28
+ new
29
+ end
27
30
  end
28
31
 
29
32
  def to_session_value
30
33
  return nil if empty?
31
- rails_3_discard_list = @used.map{|k,v| k if v}.compact
32
- {'discard' => rails_3_discard_list, 'flashes' => Hash[to_a]}
34
+ discard = @used.select { |key, used| used }.keys
35
+ {'flashes' => Hash[to_a].except(*discard)}
33
36
  end
34
37
 
35
38
  def store(session, key = "flash")
@@ -38,12 +41,12 @@ module ActionController #:nodoc:
38
41
 
39
42
  private
40
43
 
41
- def self.new_from_values(flashes, used)
42
- new.tap do |flash_hash|
43
- flashes.each do |k, v|
44
- flash_hash[k] = v
44
+ def self.new_from_session(flashes)
45
+ new.tap do |flash|
46
+ flashes.each do |key, value|
47
+ flash[key] = value
48
+ flash.discard key
45
49
  end
46
- flash_hash.instance_variable_set("@used", used)
47
50
  end
48
51
  end
49
52
  end
@@ -53,7 +56,6 @@ module ActionController #:nodoc:
53
56
  def flash #:doc:
54
57
  if !defined?(@_flash)
55
58
  @_flash = Flash::FlashHash.from_session_value(session["flash"])
56
- @_flash.sweep
57
59
  end
58
60
 
59
61
  @_flash
@@ -61,9 +63,9 @@ module ActionController #:nodoc:
61
63
  end
62
64
  end
63
65
  module TestResponseBehavior #:nodoc:
64
- # A shortcut to the flash. Returns an empty hash if no session flash exists.
66
+ # A shortcut to the flash.
65
67
  def flash
66
- ActionController::Flash::FlashHash.from_session_value(session["flash"]) || {}
68
+ ActionController::Flash::FlashHash.from_session_value(session["flash"])
67
69
  end
68
70
  end
69
71
  end
@@ -1,31 +1,45 @@
1
1
  # encoding: utf-8
2
+ require 'active_support/core_ext/hash/except'
3
+ require 'action_dispatch'
2
4
  require 'action_dispatch/middleware/flash'
5
+
3
6
  # Backport Rails 4 style storing the flash as basic ruby types to Rails 3
4
7
  module ActionDispatch
5
8
  class Request < Rack::Request
6
9
  def flash
7
- @env[Flash::KEY] ||= Flash::FlashHash.from_session_value(session["flash"]).tap(&:sweep)
10
+ @env[Flash::KEY] ||= Flash::FlashHash.from_session_value(session["flash"])
8
11
  end
9
12
  end
13
+
10
14
  class Flash
11
15
  class FlashHash
12
-
13
16
  def self.from_session_value(value)
17
+ flashes = discard = nil
18
+
14
19
  case value
15
20
  when ::ActionController::Flash::FlashHash # Rails 2.x
16
- new(value, value.instance_variable_get(:@used).select{|a,b| b}.keys)
21
+ flashes = Hash.new.update(value)
22
+ discard = value.instance_variable_get(:@used).select{|a,b| b}.keys
17
23
  when ::ActionDispatch::Flash::FlashHash # Rails 3.1, 3.2
18
- new(value.instance_variable_get(:@flashes), value.instance_variable_get(:@used))
24
+ flashes = value.instance_variable_get(:@flashes)
25
+ discard = value.instance_variable_get(:@used)
19
26
  when Hash # Rails 4.0, we backported to 2.3 too
20
- new(value['flashes'], value['discard'])
21
- else
22
- new
27
+ flashes = value['flashes']
28
+ discard = value['discard']
23
29
  end
30
+
31
+ flashes ||= {}
32
+ if discard
33
+ flashes.except!(*discard)
34
+ end
35
+
36
+ new(flashes, flashes.keys)
24
37
  end
25
38
 
26
39
  def to_session_value
27
- return nil if empty?
28
- {'discard' => @used.to_a, 'flashes' => @flashes}
40
+ flashes_to_keep = @flashes.except(*@used)
41
+ return nil if flashes_to_keep.empty?
42
+ {'flashes' => flashes_to_keep}
29
43
  end
30
44
 
31
45
  def initialize(flashes = {}, discard = []) #:nodoc:
@@ -65,7 +79,6 @@ end
65
79
  module ActionController
66
80
  module Flash
67
81
  class FlashHash < Hash
68
-
69
82
  def self._load(args)
70
83
  {}
71
84
  end
@@ -0,0 +1,51 @@
1
+ require 'active_support/core_ext/hash/except'
2
+ require 'action_dispatch'
3
+ require 'action_dispatch/middleware/flash'
4
+
5
+ # Backport discarding before session persist to rails 4
6
+ module ActionDispatch
7
+ class Flash
8
+ class FlashHash
9
+ def self.from_session_value(value)
10
+ flashes = discard = nil
11
+
12
+ case value
13
+ when ::ActionController::Flash::FlashHash # Rails 2.x
14
+ flashes = Hash.new.update(value)
15
+ discard = value.instance_variable_get(:@used).select{|a,b| b}.keys
16
+ when ::ActionDispatch::Flash::FlashHash # Rails 3.1, 3.2
17
+ flashes = value.instance_variable_get(:@flashes)
18
+ discard = value.instance_variable_get(:@used)
19
+ when Hash # Rails 4.0, we backported to 2.3 too
20
+ flashes = value['flashes']
21
+ discard = value['discard']
22
+ end
23
+
24
+ flashes ||= {}
25
+ if discard
26
+ flashes.except!(*discard)
27
+ end
28
+
29
+ new(flashes, flashes.keys)
30
+ end
31
+
32
+ def to_session_value
33
+ flashes_to_keep = @flashes.except(*@discard)
34
+ return nil if flashes_to_keep.empty?
35
+ {'flashes' => flashes_to_keep}
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ # This magic here allows us to unmarshal the old Rails 2.x ActionController::Flash::FlashHash
42
+ module ActionController
43
+ module Flash
44
+ class FlashHash < Hash
45
+ def self._load(args)
46
+ {}
47
+ end
48
+ end
49
+ end
50
+ end
51
+
@@ -1,3 +1,3 @@
1
1
  module Rails4SessionFlashBackport
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -6,10 +6,10 @@ require 'rails_4_session_flash_backport/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "rails_4_session_flash_backport"
8
8
  gem.version = Rails4SessionFlashBackport::VERSION
9
- gem.authors = ["Lucas Parry"]
10
- gem.email = ["lparry@gmail.com"]
11
- gem.description = %q{Store flash in the session in Rails 4 style on Rails 2/3}
12
- gem.summary = %q{Backport of the way Rails 4 stores flash messages in the session to Rails 2 & 3, so you can safely take a session betweens Rails versions without things exploding.}
9
+ gem.authors = ["Lucas Parry", "Samuel Cochran"]
10
+ gem.email = ["lparry@gmail.com", "sj26@sj26.com"]
11
+ gem.description = %q{Store flash in the session in Rails 4 style on Rails 2/3/4}
12
+ gem.summary = %q{Backport of the way Rails 4 stores flash messages in the session to Rails 2/3/4, so you can safely take a session betweens Rails versions without things exploding.}
13
13
  gem.homepage = "https://github.com/envato/rails_4_session_flash_backport"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -17,5 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_runtime_dependency 'rails', '< 4.0.0'
20
+ gem.add_runtime_dependency 'rails', '>= 2.0', '< 4.3'
21
+
22
+ gem.add_development_dependency 'rake'
23
+ gem.add_development_dependency 'rspec'
24
+ gem.add_development_dependency 'pry'
21
25
  end
@@ -1,45 +1,62 @@
1
+ require 'base64'
1
2
  require 'action_controller'
2
3
  require 'rails_4_session_flash_backport/rails2/flash_hash'
3
4
 
4
- describe ActionController::Flash::FlashHash, "hax" do
5
+ describe ActionController::Flash::FlashHash, "backport" do
6
+ context "#from_session_value" do
7
+ subject(:flash) { described_class.from_session_value(value) }
5
8
 
6
- let(:rails_2_marshaled) { "\x04\bIC:'ActionController::Flash::FlashHash{\a:\vnoticeI\"\x11I'm a notice\x06:\x06ET:\nerrorI\"\x11I'm an error\x06;\aT\x06:\n@used{\a;\x06T;\bF" }
7
- let(:rails_3_marshaled) { "\x04\bo:%ActionDispatch::Flash::FlashHash\t:\n@usedo:\bSet\x06:\n@hash{\x06:\vnoticeT:\f@closedF:\r@flashes{\a;\tI\"\x11I'm a notice\x06:\x06EF:\nerrorI\"\x11I'm an error\x06;\fF:\t@now0" }
8
- let(:rails_2_vanilla) { Marshal.load(rails_2_marshaled) }
9
- let(:rails_3_vanilla) { Marshal.load(rails_3_marshaled) }
10
- let(:rails_4_style) { {'flashes' => {:notice => "I'm a notice", :error => "I'm an error"}, 'discard' => [:notice]} }
9
+ context "with rails 4 style session value" do
10
+ context "without discards" do
11
+ let(:value) { {"flashes" => {"greeting" => "Hello"}} }
11
12
 
12
- it "happily unmarshals a Rails 3 session without exploding" do
13
- Marshal.load(rails_3_marshaled).should be_a(ActionDispatch::Flash::FlashHash)
14
- end
13
+ it "is the expected flash" do
14
+ expect(flash).to eq("greeting" => "Hello")
15
+ end
16
+ end
15
17
 
16
- context "#to_session_value" do
17
- it "dumps to basic objects like rails 4" do
18
- rails_2_vanilla.to_session_value.should be_a(Hash)
19
- rails_2_vanilla.to_session_value.should == rails_4_style
20
- end
21
- end
18
+ context "with discards" do
19
+ let(:value) { {"flashes" => {"greeting" => "Hello", "farewell" => "Goodbye"}, "discard" => ["farewell"]} }
22
20
 
23
- context "#from_session_value" do
24
- def this_is_the_flash_hash_were_looking_for(flash_hash)
25
- flash_hash.should be_a(described_class)
26
- flash_hash[:notice].should == "I'm a notice"
27
- flash_hash[:error].should == "I'm an error"
28
- flash_hash.sweep
29
- flash_hash[:notice].should be_nil
30
- flash_hash[:error].should == "I'm an error"
21
+ it "is the expected flash" do
22
+ expect(flash).to eq("greeting" => "Hello")
23
+ end
24
+ end
25
+ end
26
+
27
+ context "with rails 3 style session value" do
28
+ # {"session_id"=>"f8e1b8152ba7609c28bbb17ec9263ba7", "flash"=>#<ActionDispatch::Flash::FlashHash:0x00000000000000 @used=#<Set: {"farewell"}>, @closed=false, @flashes={"greeting"=>"Hello", "farewell"=>"Goodbye"}, @now=nil>}
29
+ let(:cookie) { 'BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWY4ZTFiODE1MmJhNzYwOWMyOGJiYjE3ZWM5MjYzYmE3BjsAVEkiCmZsYXNoBjsARm86JUFjdGlvbkRpc3BhdGNoOjpGbGFzaDo6Rmxhc2hIYXNoCToKQHVzZWRvOghTZXQGOgpAaGFzaHsGSSINZmFyZXdlbGwGOwBUVDoMQGNsb3NlZEY6DUBmbGFzaGVzewdJIg1ncmVldGluZwY7AFRJIgpIZWxsbwY7AFRJIg1mYXJld2VsbAY7AFRJIgxHb29kYnllBjsAVDoJQG5vdzA=' }
30
+ let(:session) { Marshal.load(Base64.decode64(cookie)) }
31
+ let(:value) { session["flash"] }
32
+
33
+ it "is the expected flash" do
34
+ expect(flash).to eq("greeting" => "Hello")
35
+ end
31
36
  end
32
37
 
33
- it "decodes rails 2 style to an empty FlashHash" do
34
- this_is_the_flash_hash_were_looking_for(ActionController::Flash::FlashHash.from_session_value(rails_2_vanilla))
38
+ context "with rails 2 style session value" do
39
+ # {"session_id"=>"f8e1b8152ba7609c28bbb17ec9263ba7", "flash"=>#<ActionController::Flash::FlashHash:0x00000000000000 @used={"farewell"=>true}, {"greeting"=>"Hello", "farewell"=>"Goodbye"}>}
40
+ let(:cookie) { 'BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWY4ZTFiODE1MmJhNzYwOWMyOGJiYjE3ZWM5MjYzYmE3BjsAVEkiCmZsYXNoBjsAVElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewdJIg1mYXJld2VsbAY7AFRJIgxHb29kYnllBjsAVEkiDWdyZWV0aW5nBjsAVEkiCkhlbGxvBjsAVAY6CkB1c2VkewZJIg1mYXJld2VsbAY7AFRU' }
41
+ let(:session) { Marshal.load(Base64.decode64(cookie)) }
42
+ let(:value) { session["flash"] }
43
+
44
+ it "is the expected flash" do
45
+ expect(flash).to eq("greeting" => "Hello")
46
+ end
35
47
  end
48
+ end
49
+
50
+ context "#to_session_value" do
51
+ subject(:flash) { described_class.new }
36
52
 
37
- it "decodes rails 3 style to a FlashHash" do
38
- this_is_the_flash_hash_were_looking_for(ActionController::Flash::FlashHash.from_session_value(rails_3_vanilla))
53
+ before do
54
+ flash["greeting"] = "Hello"
55
+ flash.now["farewell"] = "Goodbye"
39
56
  end
40
57
 
41
- it "decodes rails 4 style to a FlashHash" do
42
- this_is_the_flash_hash_were_looking_for(ActionController::Flash::FlashHash.from_session_value(rails_4_style))
58
+ it "dumps to basic objects like rails 4" do
59
+ expect(flash.to_session_value).to eq("flashes" => {"greeting" => "Hello"})
43
60
  end
44
61
  end
45
62
  end
@@ -1,48 +1,62 @@
1
- require 'action_dispatch'
1
+ require 'base64'
2
+
2
3
  require 'rails_4_session_flash_backport/rails3/flash_hash'
3
4
 
4
- describe ActionDispatch::Flash::FlashHash, "hax" do
5
+ describe ActionDispatch::Flash::FlashHash, "backport" do
6
+ context "#from_session_value" do
7
+ subject(:flash) { described_class.from_session_value(value) }
5
8
 
6
- let(:rails_2_marshaled) { "\x04\bIC:'ActionController::Flash::FlashHash{\a:\vnoticeI\"\x11I'm a notice\x06:\x06ET:\nerrorI\"\x11I'm an error\x06;\aT\x06:\n@used{\a;\x06T;\bF" }
7
- let(:rails_3_marshaled) { "\x04\bo:%ActionDispatch::Flash::FlashHash\t:\n@usedo:\bSet\x06:\n@hash{\x06:\vnoticeT:\f@closedF:\r@flashes{\a;\tI\"\x11I'm a notice\x06:\x06EF:\nerrorI\"\x11I'm an error\x06;\fF:\t@now0" }
8
- let(:rails_2_vanilla) { Marshal.load(rails_2_marshaled) }
9
- let(:rails_3_vanilla) { Marshal.load(rails_3_marshaled) }
10
- let(:rails_4_style) { {'flashes' => {:notice => "I'm a notice", :error => "I'm an error"}, 'discard' => [:notice]} }
11
- let(:rails_2_marshaled) { "\x04\bIC:'ActionController::Flash::FlashHash{\a:\vnoticeI\"\x11I'm a notice\x06:\x06ET:\nerrorI\"\x11I'm an error\x06;\aT\x06:\n@used{\a;\x06T;\bF" }
12
- let(:rails_2_vanilla) { Marshal.load(rails_2_marshaled) }
9
+ context "with rails 4 style session value" do
10
+ context "without discards" do
11
+ let(:value) { {"flashes" => {"greeting" => "Hello"}} }
13
12
 
14
- it "happily unmarshals a Rails 2 session without exploding" do
15
- Marshal.load(rails_2_marshaled).should be_a(ActionController::Flash::FlashHash)
16
- end
13
+ it "is the expected flash" do
14
+ expect(flash.to_hash).to eq("greeting" => "Hello")
15
+ end
16
+ end
17
17
 
18
- context "#from_session_value" do
19
- def this_is_the_flash_hash_were_looking_for(flash_hash)
20
- flash_hash.should be_a(described_class)
21
- flash_hash[:notice].should == "I'm a notice"
22
- flash_hash[:error].should == "I'm an error"
23
- flash_hash.sweep
24
- flash_hash[:notice].should be_nil
25
- flash_hash[:error].should == "I'm an error"
26
- end
18
+ context "with discards" do
19
+ let(:value) { {"flashes" => {"greeting" => "Hello", "farewell" => "Goodbye"}, "discard" => ["farewell"]} }
27
20
 
28
- it "decodes rails 2 style to an empty FlashHash" do
29
- this_is_the_flash_hash_were_looking_for(ActionDispatch::Flash::FlashHash.from_session_value(rails_2_vanilla))
21
+ it "is the expected flash" do
22
+ expect(flash.to_hash).to eq("greeting" => "Hello")
23
+ end
24
+ end
30
25
  end
31
26
 
32
- it "decodes rails 3 style to a FlashHash" do
33
- this_is_the_flash_hash_were_looking_for(ActionDispatch::Flash::FlashHash.from_session_value(rails_3_vanilla))
27
+ context "with rails 3 style session value" do
28
+ # {"session_id"=>"f8e1b8152ba7609c28bbb17ec9263ba7", "flash"=>#<ActionDispatch::Flash::FlashHash:0x00000000000000 @used=#<Set: {"farewell"}>, @closed=false, @flashes={"greeting"=>"Hello", "farewell"=>"Goodbye"}, @now=nil>}
29
+ let(:cookie) { 'BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWY4ZTFiODE1MmJhNzYwOWMyOGJiYjE3ZWM5MjYzYmE3BjsAVEkiCmZsYXNoBjsARm86JUFjdGlvbkRpc3BhdGNoOjpGbGFzaDo6Rmxhc2hIYXNoCToKQHVzZWRvOghTZXQGOgpAaGFzaHsGSSINZmFyZXdlbGwGOwBUVDoMQGNsb3NlZEY6DUBmbGFzaGVzewdJIg1ncmVldGluZwY7AFRJIgpIZWxsbwY7AFRJIg1mYXJld2VsbAY7AFRJIgxHb29kYnllBjsAVDoJQG5vdzA=' }
30
+ let(:session) { Marshal.load(Base64.decode64(cookie)) }
31
+ let(:value) { session["flash"] }
32
+
33
+ it "is the expected flash" do
34
+ expect(flash.to_hash).to eq("greeting" => "Hello")
35
+ end
34
36
  end
35
37
 
36
- it "decodes rails 4 style to a FlashHash" do
37
- this_is_the_flash_hash_were_looking_for(ActionDispatch::Flash::FlashHash.from_session_value(rails_4_style))
38
+ context "with rails 2 style session value" do
39
+ # {"session_id"=>"f8e1b8152ba7609c28bbb17ec9263ba7", "flash"=>#<ActionController::Flash::FlashHash:0x00000000000000 @used={"farewell"=>true}, {"greeting"=>"Hello", "farewell"=>"Goodbye"}>}
40
+ let(:cookie) { 'BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWY4ZTFiODE1MmJhNzYwOWMyOGJiYjE3ZWM5MjYzYmE3BjsAVEkiCmZsYXNoBjsAVElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewdJIg1mYXJld2VsbAY7AFRJIgxHb29kYnllBjsAVEkiDWdyZWV0aW5nBjsAVEkiCkhlbGxvBjsAVAY6CkB1c2VkewZJIg1mYXJld2VsbAY7AFRU' }
41
+ let(:session) { Marshal.load(Base64.decode64(cookie)) }
42
+ let(:value) { session["flash"] }
43
+
44
+ it "is the expected flash" do
45
+ expect(flash.to_hash).to eq("greeting" => "Hello")
46
+ end
38
47
  end
39
48
  end
40
49
 
41
50
  context "#to_session_value" do
51
+ subject(:flash) { described_class.new }
52
+
53
+ before do
54
+ flash["greeting"] = "Hello"
55
+ flash.now["farewell"] = "Goodbye"
56
+ end
57
+
42
58
  it "dumps to basic objects like rails 4" do
43
- rails_3_vanilla.to_session_value.should be_a(Hash)
44
- rails_3_vanilla.to_session_value.should == rails_4_style
59
+ expect(flash.to_session_value).to eq("flashes" => {"greeting" => "Hello"})
45
60
  end
46
61
  end
47
-
48
62
  end
@@ -0,0 +1,62 @@
1
+ require 'base64'
2
+
3
+ require 'rails_4_session_flash_backport/rails4/flash_hash'
4
+
5
+ describe ActionDispatch::Flash::FlashHash, "backport" do
6
+ context "#from_session_value" do
7
+ subject(:flash) { described_class.from_session_value(value) }
8
+
9
+ context "with rails 4 style session value" do
10
+ context "without discards" do
11
+ let(:value) { {"flashes" => {"greeting" => "Hello"}} }
12
+
13
+ it "is the expected flash" do
14
+ expect(flash.to_hash).to eq("greeting" => "Hello")
15
+ end
16
+ end
17
+
18
+ context "with discards" do
19
+ let(:value) { {"flashes" => {"greeting" => "Hello", "farewell" => "Goodbye"}, "discard" => ["farewell"]} }
20
+
21
+ it "is the expected flash" do
22
+ expect(flash.to_hash).to eq("greeting" => "Hello")
23
+ end
24
+ end
25
+ end
26
+
27
+ context "with rails 3 style session value" do
28
+ # {"session_id"=>"f8e1b8152ba7609c28bbb17ec9263ba7", "flash"=>#<ActionDispatch::Flash::FlashHash:0x00000000000000 @used=#<Set: {"farewell"}>, @closed=false, @flashes={"greeting"=>"Hello", "farewell"=>"Goodbye"}, @now=nil>}
29
+ let(:cookie) { 'BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWY4ZTFiODE1MmJhNzYwOWMyOGJiYjE3ZWM5MjYzYmE3BjsAVEkiCmZsYXNoBjsARm86JUFjdGlvbkRpc3BhdGNoOjpGbGFzaDo6Rmxhc2hIYXNoCToKQHVzZWRvOghTZXQGOgpAaGFzaHsGSSINZmFyZXdlbGwGOwBUVDoMQGNsb3NlZEY6DUBmbGFzaGVzewdJIg1ncmVldGluZwY7AFRJIgpIZWxsbwY7AFRJIg1mYXJld2VsbAY7AFRJIgxHb29kYnllBjsAVDoJQG5vdzA=' }
30
+ let(:session) { Marshal.load(Base64.decode64(cookie)) }
31
+ let(:value) { session["flash"] }
32
+
33
+ it "is the expected flash" do
34
+ expect(flash.to_hash).to eq("greeting" => "Hello")
35
+ end
36
+ end
37
+
38
+ context "with rails 2 style session value" do
39
+ # {"session_id"=>"f8e1b8152ba7609c28bbb17ec9263ba7", "flash"=>#<ActionController::Flash::FlashHash:0x00000000000000 @used={"farewell"=>true}, {"greeting"=>"Hello", "farewell"=>"Goodbye"}>}
40
+ let(:cookie) { 'BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWY4ZTFiODE1MmJhNzYwOWMyOGJiYjE3ZWM5MjYzYmE3BjsAVEkiCmZsYXNoBjsAVElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewdJIg1mYXJld2VsbAY7AFRJIgxHb29kYnllBjsAVEkiDWdyZWV0aW5nBjsAVEkiCkhlbGxvBjsAVAY6CkB1c2VkewZJIg1mYXJld2VsbAY7AFRU' }
41
+ let(:session) { Marshal.load(Base64.decode64(cookie)) }
42
+ let(:value) { session["flash"] }
43
+
44
+ it "is the expected flash" do
45
+ expect(flash.to_hash).to eq("greeting" => "Hello")
46
+ end
47
+ end
48
+ end
49
+
50
+ context "#to_session_value" do
51
+ subject(:flash) { described_class.new }
52
+
53
+ before do
54
+ flash["greeting"] = "Hello"
55
+ flash.now["farewell"] = "Goodbye"
56
+ end
57
+
58
+ it "dumps to basic objects like rails 4" do
59
+ expect(flash.to_session_value).to eq("flashes" => {"greeting" => "Hello"})
60
+ end
61
+ end
62
+ end
metadata CHANGED
@@ -1,32 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_4_session_flash_backport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Parry
8
+ - Samuel Cochran
8
9
  autorequire:
9
10
  bindir: bin
10
- cert_chain: []
11
- date: 2015-01-28 00:00:00.000000000 Z
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIDKDCCAhCgAwIBAgIBAjANBgkqhkiG9w0BAQUFADA6MQ0wCwYDVQQDDARzajI2
15
+ MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0x
16
+ NDAzMTUwNDM2MTZaFw0xNTAzMTUwNDM2MTZaMDoxDTALBgNVBAMMBHNqMjYxFDAS
17
+ BgoJkiaJk/IsZAEZFgRzajI2MRMwEQYKCZImiZPyLGQBGRYDY29tMIIBIjANBgkq
18
+ hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr60Eo/ttCk8GMTMFiPr3GoYMIMFvLak
19
+ xSmTk9YGCB6UiEePB4THSSA5w6IPyeaCF/nWkDp3/BAam0eZMWG1IzYQB23TqIM0
20
+ 1xzcNRvFsn0aQoQ00k+sj+G83j3T5OOV5OZIlu8xAChMkQmiPd1NXc6uFv+Iacz7
21
+ kj+CMsI9YUFdNoU09QY0b+u+Rb6wDYdpyvN60YC30h0h1MeYbvYZJx/iZK4XY5zu
22
+ 4O/FL2ChjL2CPCpLZW55ShYyrzphWJwLOJe+FJ/ZBl6YXwrzQM9HKnt4titSNvyU
23
+ KzE3L63A3PZvExzLrN9u09kuWLLJfXB2sGOlw3n9t72rJiuBr3/OQQIDAQABozkw
24
+ NzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU99dfRjEKFyczTeIz
25
+ m3ZsDWrNC80wDQYJKoZIhvcNAQEFBQADggEBAFVYjABGprFHcomF60jQZojPyBVj
26
+ IBUmAKQ2UEserCwV8GbzxKn9/C+cqO109m1KckeGvFDSvUToBUIEzj5xKNMLJCYJ
27
+ xjH30ex7X0LDgqI4z4Z9eXiIR61d9haKEDpqVRKrERMcf4HAyvQoNmYtVTesVNJr
28
+ rWOeOPhl1Is+NdYcm1c99Y1ltcstn762ROxVCFk9c6Xe9mrDgB5oBW+LKOY2YCjD
29
+ HLacq0o6ejD7AFG3HPAVFeYEnrwCYd6siMnzpVrt3pHfZJxsuhbNnteASNcnk9Uk
30
+ YIxHmqJUGGnmqwuBfXe8LZHC5ETJLuZlzO2odzNueQlhukD4wdNa/r4pD1o=
31
+ -----END CERTIFICATE-----
32
+ date: 2015-02-02 00:00:00.000000000 Z
12
33
  dependencies:
13
34
  - !ruby/object:Gem::Dependency
14
35
  name: rails
15
36
  requirement: !ruby/object:Gem::Requirement
16
37
  requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
17
41
  - - "<"
18
42
  - !ruby/object:Gem::Version
19
- version: 4.0.0
43
+ version: '4.3'
20
44
  type: :runtime
21
45
  prerelease: false
22
46
  version_requirements: !ruby/object:Gem::Requirement
23
47
  requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '2.0'
24
51
  - - "<"
25
52
  - !ruby/object:Gem::Version
26
- version: 4.0.0
27
- description: Store flash in the session in Rails 4 style on Rails 2/3
53
+ version: '4.3'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rake
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rspec
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: pry
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ description: Store flash in the session in Rails 4 style on Rails 2/3/4
28
97
  email:
29
98
  - lparry@gmail.com
99
+ - sj26@sj26.com
30
100
  executables: []
31
101
  extensions: []
32
102
  extra_rdoc_files: []
@@ -37,14 +107,22 @@ files:
37
107
  - LICENSE.txt
38
108
  - README.md
39
109
  - Rakefile
110
+ - gemfiles/Gemfile.rails2
111
+ - gemfiles/Gemfile.rails2.lock
112
+ - gemfiles/Gemfile.rails3
113
+ - gemfiles/Gemfile.rails3.lock
114
+ - gemfiles/Gemfile.rails4
115
+ - gemfiles/Gemfile.rails4.lock
40
116
  - lib/rails_4_session_flash_backport.rb
41
117
  - lib/rails_4_session_flash_backport/rails2/flash_hash.rb
42
118
  - lib/rails_4_session_flash_backport/rails2/session_with_indifferent_access.rb
43
119
  - lib/rails_4_session_flash_backport/rails3/flash_hash.rb
120
+ - lib/rails_4_session_flash_backport/rails4/flash_hash.rb
44
121
  - lib/rails_4_session_flash_backport/version.rb
45
122
  - rails_4_session_flash_backport.gemspec
46
123
  - spec/rails2/flash_hash_spec.rb
47
124
  - spec/rails3/flash_hash_spec.rb
125
+ - spec/rails4/flash_hash_spec.rb
48
126
  homepage: https://github.com/envato/rails_4_session_flash_backport
49
127
  licenses: []
50
128
  metadata: {}
@@ -68,7 +146,9 @@ rubygems_version: 2.2.2
68
146
  signing_key:
69
147
  specification_version: 4
70
148
  summary: Backport of the way Rails 4 stores flash messages in the session to Rails
71
- 2 & 3, so you can safely take a session betweens Rails versions without things exploding.
149
+ 2/3/4, so you can safely take a session betweens Rails versions without things exploding.
72
150
  test_files:
73
151
  - spec/rails2/flash_hash_spec.rb
74
152
  - spec/rails3/flash_hash_spec.rb
153
+ - spec/rails4/flash_hash_spec.rb
154
+ has_rdoc:
metadata.gz.sig ADDED
Binary file