cacheable_flash 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/spec_helper.rb CHANGED
@@ -1,20 +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
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
@@ -1,10 +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
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
@@ -1,4 +1,4 @@
1
- # desc "Explaining what the task does"
2
- # task :cacheable_flash do
3
- # # Task goes here
1
+ # desc "Explaining what the task does"
2
+ # task :cacheable_flash do
3
+ # # Task goes here
4
4
  # end
@@ -1,21 +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
- };
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
+ };
@@ -1,91 +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
- };
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 CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cacheable_flash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,33 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-10 00:00:00.000000000Z
13
+ date: 2012-01-14 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: activesupport
17
- requirement: &70264552596200 !ruby/object:Gem::Requirement
16
+ name: rails
17
+ requirement: &70352603957860 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: *70264552596200
26
- - !ruby/object:Gem::Dependency
27
- name: actionpack
28
- requirement: &70264552595700 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ! '>='
20
+ - - ! '>'
32
21
  - !ruby/object:Gem::Version
33
- version: '0'
22
+ version: '3.0'
34
23
  type: :runtime
35
24
  prerelease: false
36
- version_requirements: *70264552595700
25
+ version_requirements: *70352603957860
37
26
  - !ruby/object:Gem::Dependency
38
27
  name: json
39
- requirement: &70264552595160 !ruby/object:Gem::Requirement
28
+ requirement: &70352603957380 !ruby/object:Gem::Requirement
40
29
  none: false
41
30
  requirements:
42
31
  - - ! '>='
@@ -44,43 +33,43 @@ dependencies:
44
33
  version: '0'
45
34
  type: :runtime
46
35
  prerelease: false
47
- version_requirements: *70264552595160
36
+ version_requirements: *70352603957380
48
37
  - !ruby/object:Gem::Dependency
49
38
  name: rspec
50
- requirement: &70264552594640 !ruby/object:Gem::Requirement
39
+ requirement: &70352603956900 !ruby/object:Gem::Requirement
51
40
  none: false
52
41
  requirements:
53
42
  - - ~>
54
43
  - !ruby/object:Gem::Version
55
- version: 2.3.0
44
+ version: 2.8.0
56
45
  type: :development
57
46
  prerelease: false
58
- version_requirements: *70264552594640
47
+ version_requirements: *70352603956900
59
48
  - !ruby/object:Gem::Dependency
60
49
  name: yard
61
- requirement: &70264552594020 !ruby/object:Gem::Requirement
50
+ requirement: &70352603956340 !ruby/object:Gem::Requirement
62
51
  none: false
63
52
  requirements:
64
53
  - - ~>
65
54
  - !ruby/object:Gem::Version
66
- version: 0.6.0
55
+ version: 0.7.4
67
56
  type: :development
68
57
  prerelease: false
69
- version_requirements: *70264552594020
58
+ version_requirements: *70352603956340
70
59
  - !ruby/object:Gem::Dependency
71
60
  name: bundler
72
- requirement: &70264552541140 !ruby/object:Gem::Requirement
61
+ requirement: &70352603955860 !ruby/object:Gem::Requirement
73
62
  none: false
74
63
  requirements:
75
64
  - - ~>
76
65
  - !ruby/object:Gem::Version
77
- version: 1.0.0
66
+ version: 1.0.21
78
67
  type: :development
79
68
  prerelease: false
80
- version_requirements: *70264552541140
69
+ version_requirements: *70352603955860
81
70
  - !ruby/object:Gem::Dependency
82
71
  name: jeweler
83
- requirement: &70264552540540 !ruby/object:Gem::Requirement
72
+ requirement: &70352603955380 !ruby/object:Gem::Requirement
84
73
  none: false
85
74
  requirements:
86
75
  - - ~>
@@ -88,10 +77,10 @@ dependencies:
88
77
  version: 1.6.4
89
78
  type: :development
90
79
  prerelease: false
91
- version_requirements: *70264552540540
80
+ version_requirements: *70352603955380
92
81
  - !ruby/object:Gem::Dependency
93
82
  name: reek
94
- requirement: &70264552539940 !ruby/object:Gem::Requirement
83
+ requirement: &70352603954900 !ruby/object:Gem::Requirement
95
84
  none: false
96
85
  requirements:
97
86
  - - ~>
@@ -99,10 +88,10 @@ dependencies:
99
88
  version: 1.2.8
100
89
  type: :development
101
90
  prerelease: false
102
- version_requirements: *70264552539940
91
+ version_requirements: *70352603954900
103
92
  - !ruby/object:Gem::Dependency
104
93
  name: roodi
105
- requirement: &70264552539320 !ruby/object:Gem::Requirement
94
+ requirement: &70352603954420 !ruby/object:Gem::Requirement
106
95
  none: false
107
96
  requirements:
108
97
  - - ~>
@@ -110,7 +99,7 @@ dependencies:
110
99
  version: 2.1.0
111
100
  type: :development
112
101
  prerelease: false
113
- version_requirements: *70264552539320
102
+ version_requirements: *70352603954420
114
103
  description: ! 'This plugin enables greater levels of page caching by rendering flash
115
104
 
116
105
  messages from a cookie using JavaScript, instead of in your Rails
@@ -150,7 +139,7 @@ files:
150
139
  - tasks/cacheable_flash_tasks.rake
151
140
  - vendor/assets/javascripts/flash.js
152
141
  - vendor/assets/javascripts/jquery.cookie.js
153
- homepage: http://github.com/pboling/cacheable-flash
142
+ homepage: http://github.com/pivotal/cacheable-flash
154
143
  licenses:
155
144
  - MIT
156
145
  post_install_message:
@@ -165,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
154
  version: '0'
166
155
  segments:
167
156
  - 0
168
- hash: 952371363782069645
157
+ hash: -1043884967847836776
169
158
  required_rubygems_version: !ruby/object:Gem::Requirement
170
159
  none: false
171
160
  requirements: