js-cookie-rails 2.0.0.pre.beta.1.0

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.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +2 -0
  3. data/LICENSE +21 -0
  4. data/README.md +35 -0
  5. data/Rakefile +71 -0
  6. data/VERSION +1 -0
  7. data/js-cookie-rails.gemspec +31 -0
  8. data/lib/js-cookie-rails.rb +1 -0
  9. data/lib/js-cookie-rails/rails.rb +1 -0
  10. data/lib/js-cookie-rails/rails/engine.rb +6 -0
  11. data/spec/dummy/README.rdoc +261 -0
  12. data/spec/dummy/Rakefile +7 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  16. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  17. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  18. data/spec/dummy/config.ru +4 -0
  19. data/spec/dummy/config/application.rb +65 -0
  20. data/spec/dummy/config/boot.rb +10 -0
  21. data/spec/dummy/config/database.yml +25 -0
  22. data/spec/dummy/config/environment.rb +5 -0
  23. data/spec/dummy/config/environments/development.rb +37 -0
  24. data/spec/dummy/config/environments/production.rb +67 -0
  25. data/spec/dummy/config/environments/test.rb +37 -0
  26. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  27. data/spec/dummy/config/initializers/inflections.rb +15 -0
  28. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  29. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  30. data/spec/dummy/config/initializers/session_store.rb +8 -0
  31. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  32. data/spec/dummy/config/locales/en.yml +5 -0
  33. data/spec/dummy/config/routes.rb +58 -0
  34. data/spec/dummy/db/test.sqlite3 +0 -0
  35. data/spec/dummy/public/404.html +26 -0
  36. data/spec/dummy/public/422.html +26 -0
  37. data/spec/dummy/public/500.html +25 -0
  38. data/spec/dummy/public/favicon.ico +0 -0
  39. data/spec/dummy/script/rails +6 -0
  40. data/spec/js-cookie-rails_spec.rb +12 -0
  41. data/spec/spec_helper.rb +16 -0
  42. data/vendor/assets/javascripts/js.cookie.js +137 -0
  43. metadata +202 -0
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dummy::Application do
4
+
5
+ it 'should find `js.cookie` as an asset' do
6
+ described_class.assets['js.cookie'].should_not be_nil
7
+ end
8
+
9
+ it 'should have the correct body for `js.cookie`' do
10
+ described_class.assets['js.cookie'].body.should include('js-cookie')
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # Configure Rails Envinronment
2
+ ENV['RAILS_ENV'] = 'test'
3
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
+
5
+ require 'rspec/rails'
6
+
7
+ ENGINE_RAILS_ROOT = File.join( File.dirname(__FILE__), '../' )
8
+
9
+ # Requires supporting ruby files with custom matchers and macros, etc,
10
+ # in spec/support/ and its subdirectories.
11
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
12
+
13
+ RSpec.configure do |config|
14
+ config.treat_symbols_as_metadata_keys_with_true_values = true
15
+ config.order = 'random'
16
+ end
@@ -0,0 +1,137 @@
1
+ /*!
2
+ * JavaScript Cookie v2.0.0-beta.1
3
+ * https://github.com/js-cookie/js-cookie
4
+ *
5
+ * Copyright 2006, 2015 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ define(factory);
11
+ } else if (typeof exports === 'object') {
12
+ module.exports = factory();
13
+ } else {
14
+ var _OldCookies = window.Cookies;
15
+ var api = window.Cookies = factory(window.jQuery);
16
+ api.noConflict = function () {
17
+ window.Cookies = _OldCookies;
18
+ return api;
19
+ };
20
+ }
21
+ }(function () {
22
+ function extend () {
23
+ var i = 0;
24
+ var result = {};
25
+ for (; i < arguments.length; i++) {
26
+ var attributes = arguments[ i ];
27
+ for (var key in attributes) {
28
+ result[key] = attributes[key];
29
+ }
30
+ }
31
+ return result;
32
+ }
33
+
34
+ function init (converter) {
35
+ function api (key, value, attributes) {
36
+ var result;
37
+
38
+ // Write
39
+
40
+ if (arguments.length > 1) {
41
+ attributes = extend({
42
+ path: '/'
43
+ }, api.defaults, attributes);
44
+
45
+ if (typeof attributes.expires === 'number') {
46
+ var expires = new Date();
47
+ expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
48
+ attributes.expires = expires;
49
+ }
50
+
51
+ try {
52
+ result = JSON.stringify(value);
53
+ if (/^[\{\[]/.test(result)) {
54
+ value = result;
55
+ }
56
+ } catch (e) {}
57
+
58
+ value = encodeURIComponent(String(value));
59
+ value = value.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
60
+
61
+ key = encodeURIComponent(String(key));
62
+ key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
63
+ key = key.replace(/[\(\)]/g, escape);
64
+
65
+ return (document.cookie = [
66
+ key, '=', value,
67
+ attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
68
+ attributes.path && '; path=' + attributes.path,
69
+ attributes.domain && '; domain=' + attributes.domain,
70
+ attributes.secure && '; secure'
71
+ ].join(''));
72
+ }
73
+
74
+ // Read
75
+
76
+ if (!key) {
77
+ result = {};
78
+ }
79
+
80
+ // To prevent the for loop in the first place assign an empty array
81
+ // in case there are no cookies at all. Also prevents odd result when
82
+ // calling "get()"
83
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
84
+ var rdecode = /(%[0-9A-Z]{2})+/g;
85
+ var i = 0;
86
+
87
+ for (; i < cookies.length; i++) {
88
+ var parts = cookies[i].split('=');
89
+ var name = parts[0].replace(rdecode, decodeURIComponent);
90
+ var cookie = parts.slice(1).join('=');
91
+
92
+ if (cookie.charAt(0) === '"') {
93
+ cookie = cookie.slice(1, -1);
94
+ }
95
+
96
+ cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent);
97
+
98
+ if (this.json) {
99
+ try {
100
+ cookie = JSON.parse(cookie);
101
+ } catch (e) {}
102
+ }
103
+
104
+ if (key === name) {
105
+ result = cookie;
106
+ break;
107
+ }
108
+
109
+ if (!key) {
110
+ result[name] = cookie;
111
+ }
112
+ }
113
+
114
+ return result;
115
+ }
116
+
117
+ api.get = api.set = api;
118
+ api.getJSON = function () {
119
+ return api.apply({
120
+ json: true
121
+ }, [].slice.call(arguments));
122
+ };
123
+ api.defaults = {};
124
+
125
+ api.remove = function (key, attributes) {
126
+ api(key, '', extend(attributes, {
127
+ expires: -1
128
+ }));
129
+ };
130
+
131
+ api.withConverter = init;
132
+
133
+ return api;
134
+ }
135
+
136
+ return init();
137
+ }));
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: js-cookie-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.pre.beta.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Scott Lewis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rails
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.2'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.3'
61
+ - !ruby/object:Gem::Dependency
62
+ name: uglifier
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: sass
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.2'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.2'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rake
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '10.0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '10.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec-rails
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.13'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '2.13'
117
+ - !ruby/object:Gem::Dependency
118
+ name: fuubar
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.1'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.1'
131
+ description: This gem provides js-cookie assets for your Rails 3 application.
132
+ email: ryan@rynet.us
133
+ executables: []
134
+ extensions: []
135
+ extra_rdoc_files: []
136
+ files:
137
+ - Gemfile
138
+ - LICENSE
139
+ - README.md
140
+ - Rakefile
141
+ - VERSION
142
+ - js-cookie-rails.gemspec
143
+ - lib/js-cookie-rails.rb
144
+ - lib/js-cookie-rails/rails.rb
145
+ - lib/js-cookie-rails/rails/engine.rb
146
+ - spec/dummy/README.rdoc
147
+ - spec/dummy/Rakefile
148
+ - spec/dummy/app/assets/javascripts/application.js
149
+ - spec/dummy/app/assets/stylesheets/application.css
150
+ - spec/dummy/app/controllers/application_controller.rb
151
+ - spec/dummy/app/helpers/application_helper.rb
152
+ - spec/dummy/app/views/layouts/application.html.erb
153
+ - spec/dummy/config.ru
154
+ - spec/dummy/config/application.rb
155
+ - spec/dummy/config/boot.rb
156
+ - spec/dummy/config/database.yml
157
+ - spec/dummy/config/environment.rb
158
+ - spec/dummy/config/environments/development.rb
159
+ - spec/dummy/config/environments/production.rb
160
+ - spec/dummy/config/environments/test.rb
161
+ - spec/dummy/config/initializers/backtrace_silencers.rb
162
+ - spec/dummy/config/initializers/inflections.rb
163
+ - spec/dummy/config/initializers/mime_types.rb
164
+ - spec/dummy/config/initializers/secret_token.rb
165
+ - spec/dummy/config/initializers/session_store.rb
166
+ - spec/dummy/config/initializers/wrap_parameters.rb
167
+ - spec/dummy/config/locales/en.yml
168
+ - spec/dummy/config/routes.rb
169
+ - spec/dummy/db/test.sqlite3
170
+ - spec/dummy/public/404.html
171
+ - spec/dummy/public/422.html
172
+ - spec/dummy/public/500.html
173
+ - spec/dummy/public/favicon.ico
174
+ - spec/dummy/script/rails
175
+ - spec/js-cookie-rails_spec.rb
176
+ - spec/spec_helper.rb
177
+ - vendor/assets/javascripts/js.cookie.js
178
+ homepage: http://github.com/RyanScottLewis/js-cookie-rails
179
+ licenses:
180
+ - MIT
181
+ metadata: {}
182
+ post_install_message:
183
+ rdoc_options: []
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">"
194
+ - !ruby/object:Gem::Version
195
+ version: 1.3.1
196
+ requirements: []
197
+ rubyforge_project:
198
+ rubygems_version: 2.4.5
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: Use js-cookie with Rails 3
202
+ test_files: []