jquery-cookie-rails 0.1.1 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,62 +1,79 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inflection-js-rails (0.1.0)
4
+ jquery-cookie-rails (1.3.1)
5
+ jquery-rails (~> 2.0)
5
6
  railties (>= 3.2.0, < 5.0)
6
7
  thor (~> 0.14)
8
+ version (~> 1.0)
7
9
 
8
10
  GEM
9
11
  remote: http://rubygems.org/
10
12
  specs:
11
- actionpack (3.2.3)
12
- activemodel (= 3.2.3)
13
- activesupport (= 3.2.3)
13
+ actionpack (3.2.12)
14
+ activemodel (= 3.2.12)
15
+ activesupport (= 3.2.12)
14
16
  builder (~> 3.0.0)
15
17
  erubis (~> 2.7.0)
16
- journey (~> 1.0.1)
17
- rack (~> 1.4.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
18
20
  rack-cache (~> 1.2)
19
21
  rack-test (~> 0.6.1)
20
- sprockets (~> 2.1.2)
21
- activemodel (3.2.3)
22
- activesupport (= 3.2.3)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.12)
24
+ activesupport (= 3.2.12)
23
25
  builder (~> 3.0.0)
24
- activesupport (3.2.3)
26
+ activesupport (3.2.12)
25
27
  i18n (~> 0.6)
26
28
  multi_json (~> 1.0)
27
- builder (3.0.0)
29
+ builder (3.0.4)
28
30
  erubis (2.7.0)
31
+ fancy_logger (0.1.1)
32
+ outline (~> 0.1.5)
33
+ rainbow (~> 1.1.3)
34
+ version (~> 1.0.0)
29
35
  hike (1.2.1)
30
- i18n (0.6.0)
31
- journey (1.0.3)
32
- json (1.6.6)
33
- multi_json (1.2.0)
34
- rack (1.4.1)
36
+ i18n (0.6.4)
37
+ journey (1.0.4)
38
+ jquery-rails (2.2.1)
39
+ railties (>= 3.0, < 5.0)
40
+ thor (>= 0.14, < 2.0)
41
+ json (1.7.7)
42
+ meta_tools (0.2.7)
43
+ multi_json (1.6.1)
44
+ outline (0.1.5)
45
+ meta_tools (~> 0.2.6)
46
+ rack (1.4.5)
35
47
  rack-cache (1.2)
36
48
  rack (>= 0.4)
37
- rack-ssl (1.3.2)
49
+ rack-ssl (1.3.3)
38
50
  rack
39
- rack-test (0.6.1)
51
+ rack-test (0.6.2)
40
52
  rack (>= 1.0)
41
- railties (3.2.3)
42
- actionpack (= 3.2.3)
43
- activesupport (= 3.2.3)
53
+ railties (3.2.12)
54
+ actionpack (= 3.2.12)
55
+ activesupport (= 3.2.12)
44
56
  rack-ssl (~> 1.3.2)
45
57
  rake (>= 0.8.7)
46
58
  rdoc (~> 3.4)
47
- thor (~> 0.14.6)
48
- rake (0.9.2.2)
49
- rdoc (3.12)
59
+ thor (>= 0.14.6, < 2.0)
60
+ rainbow (1.1.4)
61
+ rake (10.0.3)
62
+ rdoc (3.12.2)
50
63
  json (~> 1.4)
51
- sprockets (2.1.2)
64
+ sprockets (2.2.2)
52
65
  hike (~> 1.2)
66
+ multi_json (~> 1.0)
53
67
  rack (~> 1.0)
54
68
  tilt (~> 1.1, != 1.3.0)
55
- thor (0.14.6)
56
- tilt (1.3.3)
69
+ thor (0.17.0)
70
+ tilt (1.3.5)
71
+ version (1.0.0)
57
72
 
58
73
  PLATFORMS
59
74
  ruby
60
75
 
61
76
  DEPENDENCIES
62
- inflection-js-rails!
77
+ fancy_logger (~> 0.1)
78
+ jquery-cookie-rails!
79
+ rake (~> 10.0)
data/README.md CHANGED
@@ -4,12 +4,10 @@ Adds [jquery-cookie](https://github.com/carhartl/jquery-cookie) to the Rails 3 a
4
4
 
5
5
  ## Installation
6
6
 
7
- In your Gemfile, add the following lines:
7
+ In your Gemfile, add the following line:
8
8
 
9
9
  ```ruby
10
- gem :assets do
11
- gem 'jquery-cookie-rails'
12
- end
10
+ gem 'jquery-cookie-rails'
13
11
  ```
14
12
 
15
13
  Now run `bundle install`.
@@ -27,7 +25,7 @@ For Rails 3.1 and greater, the files will be added to the asset pipeline and ava
27
25
  Simply the following to `app/assets/javascripts/application.js` after jQuery:
28
26
 
29
27
  //= require jquery
30
- //= require jquery.cookie`.
28
+ //= require jquery.cookie
31
29
 
32
30
  ## Props
33
31
 
@@ -0,0 +1,68 @@
1
+ require 'fancy_logger'
2
+ require 'pathname'
3
+
4
+ $logger = FancyLogger.new(STDOUT)
5
+ $project_path = Pathname.new(__FILE__).dirname.expand_path
6
+ $spec = eval( $project_path.join('jquery-cookie-rails.gemspec').read )
7
+
8
+ Rake::TaskManager.record_task_metadata = true
9
+
10
+ def run_command(command)
11
+ result = `#{command}`.chomp.strip
12
+
13
+ message = if result.empty?
14
+ command
15
+ else
16
+ command + "\n" + result.lines.collect { |line| " #{line}" }.join
17
+ end
18
+
19
+ $logger.debug(message)
20
+
21
+ result
22
+ end
23
+
24
+ namespace :jquery_cookie do
25
+ desc 'Update the `jquery-cookie` submodule'
26
+ task :update do
27
+ jquery_cookie_path = $project_path.join('lib', 'jquery-cookie')
28
+ latest_tag = run_command("cd #{jquery_cookie_path} && git describe --abbrev=0 --tags")
29
+
30
+ run_command "cd #{jquery_cookie_path} && git checkout #{latest_tag}"
31
+ end
32
+
33
+ desc 'Copy the `jquery.cookie.js` file to the `vendor/assets/javascripts` folder'
34
+ task :vendor do
35
+ jquery_cookie_path = $project_path.join('lib', 'jquery-cookie', 'jquery.cookie.js')
36
+ vendor_path = $project_path.join('vendor', 'assets', 'javascripts')
37
+ vendor_path.mkpath
38
+
39
+ run_command "cp #{jquery_cookie_path} #{vendor_path}"
40
+ end
41
+ end
42
+
43
+ desc 'Update jquery-cookie and copy `jquery.cookie.js` into vendor'
44
+ task :jquery_cookie => ['jquery_cookie:update', 'jquery_cookie:vendor']
45
+
46
+ desc 'Update jquery-cookie, update jquery-cookie-rails version, tag on git'
47
+ task :update => :jquery_cookie do
48
+ jquery_cookie_path = $project_path.join('lib', 'jquery-cookie')
49
+ latest_tag = run_command("cd #{jquery_cookie_path} && git describe --abbrev=0 --tags")
50
+ version = latest_tag.gsub(/^v/, '')
51
+ version_path = $project_path.join('VERSION')
52
+
53
+ run_command "git add ."
54
+ run_command "git commit -m \"Version bump to #{version}\""
55
+ run_command "git tag #{version}"
56
+ end
57
+
58
+ require 'rubygems/package_task'
59
+ Gem::PackageTask.new($spec) do |t|
60
+ t.need_zip = false
61
+ t.need_tar = false
62
+ end
63
+
64
+ task :default do
65
+ Rake::application.options.show_tasks = :tasks # this solves sidewaysmilk problem
66
+ Rake::application.options.show_task_pattern = //
67
+ Rake::application.display_tasks_and_comments
68
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.3.1
@@ -1,25 +1,31 @@
1
1
  # -*- encoding: utf-8 -*-
2
- APP_NAME = File.basename(__FILE__, '.gemspec')
3
-
4
- require File.expand_path("../lib/#{APP_NAME}/rails/version", __FILE__)
5
-
6
2
  Gem::Specification.new do |s|
7
- s.name = APP_NAME
8
- s.version = JqueryCookie::Rails::VERSION
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ["Ryan Scott Lewis"]
11
- s.email = ["c00lryguy@gmail.com"]
12
- s.homepage = "http://rubygems.org/gems/#{APP_NAME}"
13
- s.summary = "Use jquery-cookie with Rails 3"
14
- s.description = "This gem provides jquery-cookie assets for your Rails 3 application."
15
-
3
+
4
+ # Variables
5
+ s.name = 'jquery-cookie-rails'
6
+ s.author = 'Ryan Scott Lewis'
7
+ s.email = 'ryan@rynet.us'
8
+ s.summary = 'Use jquery-cookie with Rails 3'
9
+ s.description = 'This gem provides jquery-cookie assets for your Rails 3 application.'
10
+ s.license = 'MIT'
11
+
12
+ # Dependencies
13
+ s.add_dependency 'version', '~> 1.0'
14
+ s.add_dependency 'railties', '>= 3.2.0', '< 5.0'
15
+ s.add_dependency 'thor', '~> 0.14'
16
+ s.add_dependency 'jquery-rails', '~> 2.0'
17
+ s.add_development_dependency 'rake', '~> 10.0'
18
+ s.add_development_dependency 'fancy_logger', '~> 0.1'
16
19
  s.required_rubygems_version = ">= 1.3.6"
17
-
18
- s.add_dependency "railties", ">= 3.2.0", "< 5.0"
19
- s.add_dependency "thor", "~> 0.14"
20
- s.add_dependency "jquery-rails", "~> 2.0"
21
-
22
- s.files = `git ls-files`.split("\n")
23
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
24
- s.require_path = 'lib'
25
- end
20
+
21
+ # Pragmatically set variables
22
+ s.homepage = "http://github.com/RyanScottLewis/#{s.name}"
23
+ s.version = Pathname.glob('VERSION*').first.read rescue '0.0.0'
24
+ s.require_paths = ['lib']
25
+ s.files = %w(Gemfile Gemfile.lock jquery-cookie-rails.gemspec LICENSE Rakefile README.md VERSION vendor/assets/javascripts/jquery.cookie.js)
26
+ s.files += Dir.glob('lib/*.rb')
27
+ s.files += Dir.glob('lib/generators/**/*.rb')
28
+ s.files += Dir.glob('lib/jquery-cookie-rails/**/*.rb')
29
+ s.files += Dir.glob('spec/**/*')
30
+
31
+ end
@@ -1,6 +1,6 @@
1
1
  module JqueryCookie
2
2
  module Rails
3
- VERSION = "0.1.1"
4
- JS_VERSION = "1.0.0"
3
+ VERSION = "1.2.0"
4
+ JS_VERSION = "1.2.0"
5
5
  end
6
6
  end
@@ -1,47 +1,90 @@
1
1
  /*!
2
- * jQuery Cookie Plugin
2
+ * jQuery Cookie Plugin v1.3.1
3
3
  * https://github.com/carhartl/jquery-cookie
4
4
  *
5
- * Copyright 2011, Klaus Hartl
6
- * Dual licensed under the MIT or GPL Version 2 licenses.
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.opensource.org/licenses/GPL-2.0
5
+ * Copyright 2013 Klaus Hartl
6
+ * Released under the MIT license
9
7
  */
10
- (function($) {
11
- $.cookie = function(key, value, options) {
12
-
13
- // key and at least value given, set cookie...
14
- if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
15
- options = $.extend({}, options);
16
-
17
- if (value === null || value === undefined) {
18
- options.expires = -1;
19
- }
20
-
21
- if (typeof options.expires === 'number') {
22
- var days = options.expires, t = options.expires = new Date();
23
- t.setDate(t.getDate() + days);
24
- }
25
-
26
- value = String(value);
27
-
28
- return (document.cookie = [
29
- encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
30
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
31
- options.path ? '; path=' + options.path : '',
32
- options.domain ? '; domain=' + options.domain : '',
33
- options.secure ? '; secure' : ''
34
- ].join(''));
35
- }
36
-
37
- // key and possibly options given, get cookie...
38
- options = value || {};
39
- var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
40
-
41
- var pairs = document.cookie.split('; ');
42
- for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
43
- if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
44
- }
45
- return null;
46
- };
47
- })(jQuery);
8
+ (function ($, document, undefined) {
9
+
10
+ var pluses = /\+/g;
11
+
12
+ function raw(s) {
13
+ return s;
14
+ }
15
+
16
+ function decoded(s) {
17
+ return unRfc2068(decodeURIComponent(s.replace(pluses, ' ')));
18
+ }
19
+
20
+ function unRfc2068(value) {
21
+ if (value.indexOf('"') === 0) {
22
+ // This is a quoted cookie as according to RFC2068, unescape
23
+ value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
24
+ }
25
+ return value;
26
+ }
27
+
28
+ function fromJSON(value) {
29
+ return config.json ? JSON.parse(value) : value;
30
+ }
31
+
32
+ var config = $.cookie = function (key, value, options) {
33
+
34
+ // write
35
+ if (value !== undefined) {
36
+ options = $.extend({}, config.defaults, options);
37
+
38
+ if (value === null) {
39
+ options.expires = -1;
40
+ }
41
+
42
+ if (typeof options.expires === 'number') {
43
+ var days = options.expires, t = options.expires = new Date();
44
+ t.setDate(t.getDate() + days);
45
+ }
46
+
47
+ value = config.json ? JSON.stringify(value) : String(value);
48
+
49
+ return (document.cookie = [
50
+ encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
51
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
52
+ options.path ? '; path=' + options.path : '',
53
+ options.domain ? '; domain=' + options.domain : '',
54
+ options.secure ? '; secure' : ''
55
+ ].join(''));
56
+ }
57
+
58
+ // read
59
+ var decode = config.raw ? raw : decoded;
60
+ var cookies = document.cookie.split('; ');
61
+ var result = key ? null : {};
62
+ for (var i = 0, l = cookies.length; i < l; i++) {
63
+ var parts = cookies[i].split('=');
64
+ var name = decode(parts.shift());
65
+ var cookie = decode(parts.join('='));
66
+
67
+ if (key && key === name) {
68
+ result = fromJSON(cookie);
69
+ break;
70
+ }
71
+
72
+ if (!key) {
73
+ result[name] = fromJSON(cookie);
74
+ }
75
+ }
76
+
77
+ return result;
78
+ };
79
+
80
+ config.defaults = {};
81
+
82
+ $.removeCookie = function (key, options) {
83
+ if ($.cookie(key) !== null) {
84
+ $.cookie(key, null, options);
85
+ return true;
86
+ }
87
+ return false;
88
+ };
89
+
90
+ })(jQuery, document);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-cookie-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-21 00:00:00.000000000Z
12
+ date: 2013-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: version
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: railties
16
- requirement: &70264675494560 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
17
33
  none: false
18
34
  requirements:
19
35
  - - ! '>='
@@ -24,10 +40,18 @@ dependencies:
24
40
  version: '5.0'
25
41
  type: :runtime
26
42
  prerelease: false
27
- version_requirements: *70264675494560
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 3.2.0
49
+ - - <
50
+ - !ruby/object:Gem::Version
51
+ version: '5.0'
28
52
  - !ruby/object:Gem::Dependency
29
53
  name: thor
30
- requirement: &70264675492140 !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
31
55
  none: false
32
56
  requirements:
33
57
  - - ~>
@@ -35,10 +59,15 @@ dependencies:
35
59
  version: '0.14'
36
60
  type: :runtime
37
61
  prerelease: false
38
- version_requirements: *70264675492140
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '0.14'
39
68
  - !ruby/object:Gem::Dependency
40
69
  name: jquery-rails
41
- requirement: &70264675490560 !ruby/object:Gem::Requirement
70
+ requirement: !ruby/object:Gem::Requirement
42
71
  none: false
43
72
  requirements:
44
73
  - - ~>
@@ -46,28 +75,66 @@ dependencies:
46
75
  version: '2.0'
47
76
  type: :runtime
48
77
  prerelease: false
49
- version_requirements: *70264675490560
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '2.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ version: '10.0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: '10.0'
100
+ - !ruby/object:Gem::Dependency
101
+ name: fancy_logger
102
+ requirement: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ~>
106
+ - !ruby/object:Gem::Version
107
+ version: '0.1'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ~>
114
+ - !ruby/object:Gem::Version
115
+ version: '0.1'
50
116
  description: This gem provides jquery-cookie assets for your Rails 3 application.
51
- email:
52
- - c00lryguy@gmail.com
117
+ email: ryan@rynet.us
53
118
  executables: []
54
119
  extensions: []
55
120
  extra_rdoc_files: []
56
121
  files:
57
- - .gitignore
58
122
  - Gemfile
59
123
  - Gemfile.lock
124
+ - jquery-cookie-rails.gemspec
60
125
  - LICENSE
126
+ - Rakefile
61
127
  - README.md
62
- - jquery-cookie-rails.gemspec
63
- - lib/generators/jquery-cookie-rails/install/install_generator.rb
128
+ - VERSION
129
+ - vendor/assets/javascripts/jquery.cookie.js
64
130
  - lib/jquery-cookie-rails.rb
65
- - lib/jquery-cookie-rails/rails.rb
131
+ - lib/generators/jquery-cookie-rails/install/install_generator.rb
66
132
  - lib/jquery-cookie-rails/rails/engine.rb
67
133
  - lib/jquery-cookie-rails/rails/version.rb
68
- - vendor/assets/javascripts/jquery.cookie.js
69
- homepage: http://rubygems.org/gems/jquery-cookie-rails
70
- licenses: []
134
+ - lib/jquery-cookie-rails/rails.rb
135
+ homepage: http://github.com/RyanScottLewis/jquery-cookie-rails
136
+ licenses:
137
+ - MIT
71
138
  post_install_message:
72
139
  rdoc_options: []
73
140
  require_paths:
@@ -78,6 +145,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
145
  - - ! '>='
79
146
  - !ruby/object:Gem::Version
80
147
  version: '0'
148
+ segments:
149
+ - 0
150
+ hash: 1519022587936653727
81
151
  required_rubygems_version: !ruby/object:Gem::Requirement
82
152
  none: false
83
153
  requirements:
@@ -86,9 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
156
  version: 1.3.6
87
157
  requirements: []
88
158
  rubyforge_project:
89
- rubygems_version: 1.8.10
159
+ rubygems_version: 1.8.25
90
160
  signing_key:
91
161
  specification_version: 3
92
162
  summary: Use jquery-cookie with Rails 3
93
163
  test_files: []
94
- has_rdoc:
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- .DS_Store
2
- pkg/
3
-