cerealize 0.8.6 → 0.8.7

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.
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cerealize
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 8
8
+ - 7
9
+ version: 0.8.7
10
+ platform: ruby
11
+ authors:
12
+ - Cardinal Blue
13
+ - "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
14
+ - Jaime Cham
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-10-20 00:00:00 +08:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: activerecord
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - <
29
+ - !ruby/object:Gem::Version
30
+ segments:
31
+ - 3
32
+ version: "3"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: sqlite3-ruby
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 3
46
+ - 1
47
+ version: 1.3.1
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: bones
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 3
60
+ - 5
61
+ - 0
62
+ version: 3.5.0
63
+ type: :development
64
+ version_requirements: *id003
65
+ description: " Serialize out of the Cerealize Box\n - a drop-in replacement for ActiveRecord's serialize\n\n It can auto transcode old encoding (yaml if you're using AR's serialize),\n to new encoding (marshal, json, you name it) without any migration.\n\n Current supported encoding:\n 1. YAML\n 2. Marshal\n 3. JSON (planned)\n\n Current supported ORM:\n 1. ActiveRecord (tested with 2.3.10)\n 2. DataMapper (planned)"
66
+ email: dev (XD) cardinalblue.com
67
+ executables: []
68
+
69
+ extensions: []
70
+
71
+ extra_rdoc_files:
72
+ - CHANGES
73
+ - LICENSE
74
+ - README
75
+ - TODO
76
+ - bench/simple.png
77
+ - cerealize.gemspec
78
+ files:
79
+ - CHANGES
80
+ - LICENSE
81
+ - README
82
+ - README.rdoc
83
+ - Rakefile
84
+ - TODO
85
+ - bench/simple.png
86
+ - bench/simple.rb
87
+ - cerealize.gemspec
88
+ - init.rb
89
+ - lib/cerealize.rb
90
+ - lib/cerealize/attr_hash.rb
91
+ - lib/cerealize/codec/marshal.rb
92
+ - lib/cerealize/codec/text.rb
93
+ - lib/cerealize/codec/yaml.rb
94
+ - lib/cerealize/version.rb
95
+ - test/common.rb
96
+ - test/real.rb
97
+ - test/stub.rb
98
+ - test/test_all_codec.rb
99
+ - test/test_attr_hash.rb
100
+ - test/test_basic.rb
101
+ - test/test_transcode.rb
102
+ has_rdoc: true
103
+ homepage: http://github.com/cardinalblue/cerealize
104
+ licenses: []
105
+
106
+ post_install_message:
107
+ rdoc_options:
108
+ - --main
109
+ - README
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ requirements: []
129
+
130
+ rubyforge_project: cerealize
131
+ rubygems_version: 1.3.7
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Serialize out of the Cerealize Box - a drop-in replacement for ActiveRecord's serialize It can auto transcode old encoding (yaml if you're using AR's serialize), to new encoding (marshal, json, you name it) without any migration
135
+ test_files:
136
+ - test/test_all_codec.rb
137
+ - test/test_attr_hash.rb
138
+ - test/test_basic.rb
139
+ - test/test_transcode.rb
data/CHANGES CHANGED
@@ -1,5 +1,23 @@
1
1
  = cerealize changes history
2
2
 
3
+ == cerealize 0.8.7 -- 2010-10-20
4
+
5
+ * Added a special encoding: "text". The purpose of this encoding is to
6
+ let you migrate from a plain/text database column into an encoded one.
7
+ Since Ruby 1.8's YAML engine, Sych, has some problems dumping some kinds
8
+ of data, producing improperly formatted YAML. This causes an issue in
9
+ delayed_job, which uses YAML to serialize ActiveRecord object, and cannot
10
+ properly restore that object due to the bad YAML format.
11
+
12
+ So we need to encode the column, preventing from Sych dumping bad YAML.
13
+ This special text encoding is only used for decoding, not encoding.
14
+ (Thus don't use it for encoding! It actually uses YAML to encode.)
15
+ Since cerealize has the ability to detect the encoding, it will fall back
16
+ to text encoding if it's not any of the supported encoding. Thus reading
17
+ text from the column, then storing back to Marshal or YAML. In this case,
18
+ we need Marshal because all the problem comes from YAML, which delayed_job
19
+ uses anyway.
20
+
3
21
  == cerealize 0.8.6 -- 2010-09-29
4
22
 
5
23
  * Make sure attr_hash didn't get saved setting the same value.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = cerealize 0.8.6
1
+ = cerealize 0.8.7
2
2
  by Cardinal Blue ( http://cardinalblue.com )
3
3
 
4
4
  == LINKS:
@@ -21,7 +21,7 @@ by Cardinal Blue ( http://cardinalblue.com )
21
21
  3. JSON (planned)
22
22
 
23
23
  Current supported ORM:
24
- 1. ActiveRecord (tested with 2.3.5)
24
+ 1. ActiveRecord (tested with 2.3.10)
25
25
  2. DataMapper (planned)
26
26
 
27
27
  == SYNOPSIS:
@@ -1,4 +1,4 @@
1
- = cerealize 0.8.6
1
+ = cerealize 0.8.7
2
2
  by Cardinal Blue ( http://cardinalblue.com )
3
3
 
4
4
  == LINKS:
@@ -21,7 +21,7 @@ by Cardinal Blue ( http://cardinalblue.com )
21
21
  3. JSON (planned)
22
22
 
23
23
  Current supported ORM:
24
- 1. ActiveRecord (tested with 2.3.5)
24
+ 1. ActiveRecord (tested with 2.3.10)
25
25
  2. DataMapper (planned)
26
26
 
27
27
  == SYNOPSIS:
@@ -1,53 +1,139 @@
1
- # -*- encoding: utf-8 -*-
1
+ --- !ruby/object:Gem::Specification
2
+ name: cerealize
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 8
8
+ - 7
9
+ version: 0.8.7
10
+ platform: ruby
11
+ authors:
12
+ - Cardinal Blue
13
+ - "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
14
+ - Jaime Cham
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
2
18
 
3
- Gem::Specification.new do |s|
4
- s.name = %q{cerealize}
5
- s.version = "0.8.6"
19
+ date: 2010-10-20 00:00:00 +08:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: activerecord
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - <
29
+ - !ruby/object:Gem::Version
30
+ segments:
31
+ - 3
32
+ version: "3"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: sqlite3-ruby
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 3
46
+ - 1
47
+ version: 1.3.1
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: bones
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 3
60
+ - 5
61
+ - 0
62
+ version: 3.5.0
63
+ type: :development
64
+ version_requirements: *id003
65
+ description: " Serialize out of the Cerealize Box\n - a drop-in replacement for ActiveRecord's serialize\n\n It can auto transcode old encoding (yaml if you're using AR's serialize),\n to new encoding (marshal, json, you name it) without any migration.\n\n Current supported encoding:\n 1. YAML\n 2. Marshal\n 3. JSON (planned)\n\n Current supported ORM:\n 1. ActiveRecord (tested with 2.3.10)\n 2. DataMapper (planned)"
66
+ email: dev (XD) cardinalblue.com
67
+ executables: []
6
68
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Cardinal Blue", "Lin Jen-Shin (aka godfat 真常)", "Jaime Cham"]
9
- s.date = %q{2010-09-29}
10
- s.description = %q{ Serialize out of the Cerealize Box
11
- - a drop-in replacement for ActiveRecord's serialize
69
+ extensions: []
12
70
 
13
- It can auto transcode old encoding (yaml if you're using AR's serialize),
14
- to new encoding (marshal, json, you name it) without any migration.
71
+ extra_rdoc_files:
72
+ - CHANGES
73
+ - LICENSE
74
+ - README
75
+ - TODO
76
+ - bench/simple.png
77
+ - cerealize.gemspec
78
+ files:
79
+ - CHANGES
80
+ - LICENSE
81
+ - README
82
+ - README.rdoc
83
+ - Rakefile
84
+ - TODO
85
+ - bench/simple.png
86
+ - bench/simple.rb
87
+ - cerealize.gemspec
88
+ - init.rb
89
+ - lib/cerealize.rb
90
+ - lib/cerealize/attr_hash.rb
91
+ - lib/cerealize/codec/marshal.rb
92
+ - lib/cerealize/codec/text.rb
93
+ - lib/cerealize/codec/yaml.rb
94
+ - lib/cerealize/version.rb
95
+ - test/common.rb
96
+ - test/real.rb
97
+ - test/stub.rb
98
+ - test/test_all_codec.rb
99
+ - test/test_attr_hash.rb
100
+ - test/test_basic.rb
101
+ - test/test_transcode.rb
102
+ has_rdoc: true
103
+ homepage: http://github.com/cardinalblue/cerealize
104
+ licenses: []
15
105
 
16
- Current supported encoding:
17
- 1. YAML
18
- 2. Marshal
19
- 3. JSON (planned)
106
+ post_install_message:
107
+ rdoc_options:
108
+ - --main
109
+ - README
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ requirements: []
20
129
 
21
- Current supported ORM:
22
- 1. ActiveRecord (tested with 2.3.5)
23
- 2. DataMapper (planned)}
24
- s.email = %q{dev (XD) cardinalblue.com}
25
- s.extra_rdoc_files = ["CHANGES", "LICENSE", "README", "TODO", "bench/simple.png", "cerealize.gemspec"]
26
- s.files = ["CHANGES", "LICENSE", "README", "README.rdoc", "Rakefile", "TODO", "bench/simple.png", "bench/simple.rb", "cerealize.gemspec", "init.rb", "lib/cerealize.rb", "lib/cerealize/attr_hash.rb", "lib/cerealize/codec/marshal.rb", "lib/cerealize/codec/yaml.rb", "lib/cerealize/version.rb", "test/common.rb", "test/real.rb", "test/stub.rb", "test/test_all_codec.rb", "test/test_attr_hash.rb", "test/test_basic.rb", "test/test_transcode.rb"]
27
- s.homepage = %q{http://github.com/cardinalblue/cerealize}
28
- s.rdoc_options = ["--main", "README"]
29
- s.require_paths = ["lib"]
30
- s.rubyforge_project = %q{cerealize}
31
- s.rubygems_version = %q{1.3.7}
32
- s.summary = %q{Serialize out of the Cerealize Box - a drop-in replacement for ActiveRecord's serialize It can auto transcode old encoding (yaml if you're using AR's serialize), to new encoding (marshal, json, you name it) without any migration}
33
- s.test_files = ["test/test_all_codec.rb", "test/test_attr_hash.rb", "test/test_basic.rb", "test/test_transcode.rb"]
34
-
35
- if s.respond_to? :specification_version then
36
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
37
- s.specification_version = 3
38
-
39
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
- s.add_runtime_dependency(%q<activerecord>, ["< 3"])
41
- s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.3.1"])
42
- s.add_development_dependency(%q<bones>, [">= 3.4.7"])
43
- else
44
- s.add_dependency(%q<activerecord>, ["< 3"])
45
- s.add_dependency(%q<sqlite3-ruby>, [">= 1.3.1"])
46
- s.add_dependency(%q<bones>, [">= 3.4.7"])
47
- end
48
- else
49
- s.add_dependency(%q<activerecord>, ["< 3"])
50
- s.add_dependency(%q<sqlite3-ruby>, [">= 1.3.1"])
51
- s.add_dependency(%q<bones>, [">= 3.4.7"])
52
- end
53
- end
130
+ rubyforge_project: cerealize
131
+ rubygems_version: 1.3.7
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Serialize out of the Cerealize Box - a drop-in replacement for ActiveRecord's serialize It can auto transcode old encoding (yaml if you're using AR's serialize), to new encoding (marshal, json, you name it) without any migration
135
+ test_files:
136
+ - test/test_all_codec.rb
137
+ - test/test_attr_hash.rb
138
+ - test/test_basic.rb
139
+ - test/test_transcode.rb
@@ -10,8 +10,9 @@ module Cerealize
10
10
  InternalName = 'CerealizeMethods'
11
11
 
12
12
  module Codec
13
- autoload 'Yaml', 'cerealize/codec/yaml'
13
+ autoload 'Yaml' , 'cerealize/codec/yaml'
14
14
  autoload 'Marshal', 'cerealize/codec/marshal'
15
+ autoload 'Text' , 'cerealize/codec/text'
15
16
  end
16
17
  class NoSuchCodec < ArgumentError; end
17
18
  class NoSuitableCodec < RuntimeError ; end
@@ -36,7 +37,7 @@ module Cerealize
36
37
  end
37
38
 
38
39
  def codec_names
39
- @codec_names ||= [:yaml, :marshal]
40
+ @codec_names ||= [:yaml, :marshal, :text]
40
41
  end
41
42
 
42
43
  def codec_detect(str)
@@ -0,0 +1,19 @@
1
+
2
+ module Cerealize
3
+ module Codec; end
4
+ module Codec::Text
5
+ module_function
6
+
7
+ def yours?(str)
8
+ true
9
+ end
10
+
11
+ def encode(obj)
12
+ YAML.dump(obj)
13
+ end
14
+
15
+ def decode(str)
16
+ str
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Cerealize
3
- VERSION = '0.8.6'
3
+ VERSION = '0.8.7'
4
4
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 6
9
- version: 0.8.6
8
+ - 7
9
+ version: 0.8.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Cardinal Blue
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-29 00:00:00 +08:00
19
+ date: 2010-10-20 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -57,18 +57,19 @@ dependencies:
57
57
  - !ruby/object:Gem::Version
58
58
  segments:
59
59
  - 3
60
- - 4
61
- - 7
62
- version: 3.4.7
60
+ - 5
61
+ - 0
62
+ version: 3.5.0
63
63
  type: :development
64
64
  version_requirements: *id003
65
- description: " Serialize out of the Cerealize Box\n - a drop-in replacement for ActiveRecord's serialize\n\n It can auto transcode old encoding (yaml if you're using AR's serialize),\n to new encoding (marshal, json, you name it) without any migration.\n\n Current supported encoding:\n 1. YAML\n 2. Marshal\n 3. JSON (planned)\n\n Current supported ORM:\n 1. ActiveRecord (tested with 2.3.5)\n 2. DataMapper (planned)"
65
+ description: " Serialize out of the Cerealize Box\n - a drop-in replacement for ActiveRecord's serialize\n\n It can auto transcode old encoding (yaml if you're using AR's serialize),\n to new encoding (marshal, json, you name it) without any migration.\n\n Current supported encoding:\n 1. YAML\n 2. Marshal\n 3. JSON (planned)\n\n Current supported ORM:\n 1. ActiveRecord (tested with 2.3.10)\n 2. DataMapper (planned)"
66
66
  email: dev (XD) cardinalblue.com
67
67
  executables: []
68
68
 
69
69
  extensions: []
70
70
 
71
71
  extra_rdoc_files:
72
+ - .specification
72
73
  - CHANGES
73
74
  - LICENSE
74
75
  - README
@@ -76,6 +77,7 @@ extra_rdoc_files:
76
77
  - bench/simple.png
77
78
  - cerealize.gemspec
78
79
  files:
80
+ - .specification
79
81
  - CHANGES
80
82
  - LICENSE
81
83
  - README
@@ -89,6 +91,7 @@ files:
89
91
  - lib/cerealize.rb
90
92
  - lib/cerealize/attr_hash.rb
91
93
  - lib/cerealize/codec/marshal.rb
94
+ - lib/cerealize/codec/text.rb
92
95
  - lib/cerealize/codec/yaml.rb
93
96
  - lib/cerealize/version.rb
94
97
  - test/common.rb