globalize 3.1.0 → 4.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -4
- data/Gemfile.lock +74 -241
- data/lib/globalize.rb +2 -5
- data/lib/globalize/active_record.rb +1 -1
- data/lib/globalize/active_record/act_macro.rb +10 -10
- data/lib/globalize/active_record/adapter.rb +14 -30
- data/lib/globalize/active_record/attributes.rb +0 -1
- data/lib/globalize/active_record/class_methods.rb +23 -52
- data/lib/globalize/active_record/instance_methods.rb +42 -74
- data/lib/globalize/active_record/migration.rb +2 -2
- data/lib/globalize/active_record/relation.rb +63 -0
- data/lib/globalize/active_record/translation.rb +0 -1
- data/lib/globalize/versioning.rb +5 -0
- data/lib/globalize/versioning/paper_trail.rb +39 -0
- data/lib/patches/active_record/relation.rb +20 -0
- metadata +56 -126
- data/CHANGELOG.md +0 -73
- data/CONTRIBUTING.md +0 -37
- data/lib/globalize/active_record/query_methods.rb +0 -13
- data/lib/globalize/version.rb +0 -3
- data/lib/patches/i18n/interpolate.rb +0 -37
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.0.alpha.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sven Fuchs
|
@@ -15,256 +14,187 @@ authors:
|
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
|
-
date:
|
17
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
19
18
|
dependencies:
|
20
19
|
- !ruby/object:Gem::Dependency
|
21
20
|
name: activerecord
|
22
21
|
requirement: !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
22
|
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 3.1.0
|
28
|
-
- - <
|
23
|
+
- - '>='
|
29
24
|
- !ruby/object:Gem::Version
|
30
25
|
version: 4.0.0
|
31
26
|
type: :runtime
|
32
27
|
prerelease: false
|
33
28
|
version_requirements: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
29
|
requirements:
|
36
|
-
- -
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 3.1.0
|
39
|
-
- - <
|
30
|
+
- - '>='
|
40
31
|
- !ruby/object:Gem::Version
|
41
32
|
version: 4.0.0
|
42
33
|
- !ruby/object:Gem::Dependency
|
43
34
|
name: activemodel
|
44
35
|
requirement: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
36
|
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 3.1.0
|
50
|
-
- - <
|
37
|
+
- - '>='
|
51
38
|
- !ruby/object:Gem::Version
|
52
39
|
version: 4.0.0
|
53
40
|
type: :runtime
|
54
41
|
prerelease: false
|
55
42
|
version_requirements: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
43
|
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 3.1.0
|
61
|
-
- - <
|
44
|
+
- - '>='
|
62
45
|
- !ruby/object:Gem::Version
|
63
46
|
version: 4.0.0
|
64
47
|
- !ruby/object:Gem::Dependency
|
65
|
-
name:
|
48
|
+
name: paper_trail
|
66
49
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
50
|
requirements:
|
69
51
|
- - ~>
|
70
52
|
- !ruby/object:Gem::Version
|
71
|
-
version: 0.
|
72
|
-
type: :
|
53
|
+
version: 3.0.0.beta
|
54
|
+
type: :runtime
|
73
55
|
prerelease: false
|
74
56
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
57
|
requirements:
|
77
58
|
- - ~>
|
78
59
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
60
|
+
version: 3.0.0.beta
|
80
61
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- - ! '>='
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
|
-
requirements:
|
93
|
-
- - ! '>='
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: pathname_local
|
62
|
+
name: database_cleaner
|
98
63
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
64
|
requirements:
|
101
|
-
- -
|
65
|
+
- - '>='
|
102
66
|
- !ruby/object:Gem::Version
|
103
67
|
version: '0'
|
104
68
|
type: :development
|
105
69
|
prerelease: false
|
106
70
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
71
|
requirements:
|
109
|
-
- -
|
72
|
+
- - '>='
|
110
73
|
- !ruby/object:Gem::Version
|
111
74
|
version: '0'
|
112
75
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
76
|
+
name: minitest
|
114
77
|
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
78
|
requirements:
|
117
|
-
- -
|
79
|
+
- - '>='
|
118
80
|
- !ruby/object:Gem::Version
|
119
81
|
version: '0'
|
120
82
|
type: :development
|
121
83
|
prerelease: false
|
122
84
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
85
|
requirements:
|
125
|
-
- -
|
86
|
+
- - '>='
|
126
87
|
- !ruby/object:Gem::Version
|
127
88
|
version: '0'
|
128
89
|
- !ruby/object:Gem::Dependency
|
129
|
-
name:
|
90
|
+
name: minitest-colorize
|
130
91
|
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
92
|
requirements:
|
133
|
-
- -
|
93
|
+
- - '>='
|
134
94
|
- !ruby/object:Gem::Version
|
135
95
|
version: '0'
|
136
96
|
type: :development
|
137
97
|
prerelease: false
|
138
98
|
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
99
|
requirements:
|
141
|
-
- -
|
100
|
+
- - '>='
|
142
101
|
- !ruby/object:Gem::Version
|
143
102
|
version: '0'
|
144
103
|
- !ruby/object:Gem::Dependency
|
145
104
|
name: sqlite3
|
146
105
|
requirement: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
106
|
requirements:
|
149
|
-
- -
|
107
|
+
- - '>='
|
150
108
|
- !ruby/object:Gem::Version
|
151
109
|
version: '0'
|
152
110
|
type: :development
|
153
111
|
prerelease: false
|
154
112
|
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
113
|
requirements:
|
157
|
-
- -
|
114
|
+
- - '>='
|
158
115
|
- !ruby/object:Gem::Version
|
159
116
|
version: '0'
|
160
117
|
- !ruby/object:Gem::Dependency
|
161
|
-
name:
|
118
|
+
name: rdoc
|
162
119
|
requirement: !ruby/object:Gem::Requirement
|
163
|
-
none: false
|
164
120
|
requirements:
|
165
|
-
- -
|
121
|
+
- - '>='
|
166
122
|
- !ruby/object:Gem::Version
|
167
123
|
version: '0'
|
168
124
|
type: :development
|
169
125
|
prerelease: false
|
170
126
|
version_requirements: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
127
|
requirements:
|
173
|
-
- -
|
128
|
+
- - '>='
|
174
129
|
- !ruby/object:Gem::Version
|
175
130
|
version: '0'
|
176
131
|
- !ruby/object:Gem::Dependency
|
177
|
-
name:
|
132
|
+
name: rake
|
178
133
|
requirement: !ruby/object:Gem::Requirement
|
179
|
-
none: false
|
180
134
|
requirements:
|
181
|
-
- -
|
135
|
+
- - '>='
|
182
136
|
- !ruby/object:Gem::Version
|
183
137
|
version: '0'
|
184
138
|
type: :development
|
185
139
|
prerelease: false
|
186
140
|
version_requirements: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
141
|
requirements:
|
189
|
-
- -
|
142
|
+
- - '>='
|
190
143
|
- !ruby/object:Gem::Version
|
191
144
|
version: '0'
|
192
|
-
description: Rails I18n de-facto standard library for ActiveRecord model/data translation.
|
145
|
+
description: Rails I18n de-facto standard library for ActiveRecord 3 model/data translation.
|
193
146
|
email: nobody@globalize-rails.org
|
194
147
|
executables: []
|
195
148
|
extensions: []
|
196
149
|
extra_rdoc_files: []
|
197
150
|
files:
|
198
|
-
- lib/globalize.rb
|
199
|
-
- lib/patches/active_record/xml_attribute_serializer.rb
|
200
|
-
- lib/patches/active_record/uniqueness_validator.rb
|
201
|
-
- lib/patches/active_record/query_method.rb
|
202
|
-
- lib/patches/i18n/interpolate.rb
|
203
|
-
- lib/globalize/active_record.rb
|
204
|
-
- lib/globalize/active_record/adapter.rb
|
205
|
-
- lib/globalize/active_record/query_methods.rb
|
206
|
-
- lib/globalize/active_record/migration.rb
|
207
151
|
- lib/globalize/active_record/act_macro.rb
|
208
|
-
- lib/globalize/active_record/
|
209
|
-
- lib/globalize/active_record/
|
152
|
+
- lib/globalize/active_record/adapter.rb
|
153
|
+
- lib/globalize/active_record/attributes.rb
|
210
154
|
- lib/globalize/active_record/class_methods.rb
|
211
155
|
- lib/globalize/active_record/exceptions.rb
|
212
|
-
- lib/globalize/active_record/
|
213
|
-
- lib/globalize/
|
156
|
+
- lib/globalize/active_record/instance_methods.rb
|
157
|
+
- lib/globalize/active_record/migration.rb
|
158
|
+
- lib/globalize/active_record/relation.rb
|
159
|
+
- lib/globalize/active_record/translation.rb
|
160
|
+
- lib/globalize/active_record.rb
|
214
161
|
- lib/globalize/interpolation.rb
|
215
|
-
- lib/
|
162
|
+
- lib/globalize/versioning/paper_trail.rb
|
163
|
+
- lib/globalize/versioning.rb
|
164
|
+
- lib/globalize.rb
|
216
165
|
- lib/i18n/missing_translations_log_handler.rb
|
217
|
-
-
|
218
|
-
-
|
219
|
-
-
|
220
|
-
-
|
166
|
+
- lib/i18n/missing_translations_raise_handler.rb
|
167
|
+
- lib/patches/active_record/query_method.rb
|
168
|
+
- lib/patches/active_record/relation.rb
|
169
|
+
- lib/patches/active_record/uniqueness_validator.rb
|
170
|
+
- lib/patches/active_record/xml_attribute_serializer.rb
|
221
171
|
- Gemfile
|
222
172
|
- Gemfile.lock
|
223
|
-
|
173
|
+
- LICENSE
|
174
|
+
- Rakefile
|
175
|
+
homepage: http://github.com/svenfuchs/globalize3
|
224
176
|
licenses:
|
225
177
|
- MIT
|
226
|
-
|
227
|
-
|
228
|
-
Globalize has extracted versioning support to a separate gem named
|
229
|
-
|
230
|
-
globalize-versioning. If you are using versioning (with paper_trail
|
231
|
-
|
232
|
-
or any other versioning gem), please add the line
|
233
|
-
|
234
|
-
"gem ''globalize-versioning''" to your Gemfile and go to the github
|
235
|
-
|
236
|
-
page at globalize/globalize-versioning if you encounter any problems.
|
237
|
-
|
238
|
-
|
239
|
-
Note that the globalize-versioning gem does not delegate versions to
|
240
|
-
|
241
|
-
the translation table, so you will have to update your syntax to
|
242
|
-
|
243
|
-
the form: `post.translation.versions`. See the globalize-versioning
|
244
|
-
|
245
|
-
readme for details.
|
246
|
-
|
247
|
-
|
248
|
-
'
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
249
180
|
rdoc_options: []
|
250
181
|
require_paths:
|
251
182
|
- lib
|
252
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
253
|
-
none: false
|
254
184
|
requirements:
|
255
|
-
- -
|
185
|
+
- - '>='
|
256
186
|
- !ruby/object:Gem::Version
|
257
187
|
version: '0'
|
258
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
|
-
none: false
|
260
189
|
requirements:
|
261
|
-
- -
|
190
|
+
- - '>'
|
262
191
|
- !ruby/object:Gem::Version
|
263
|
-
version:
|
192
|
+
version: 1.3.1
|
264
193
|
requirements: []
|
265
|
-
rubyforge_project:
|
266
|
-
rubygems_version: 1.
|
194
|
+
rubyforge_project: '[none]'
|
195
|
+
rubygems_version: 2.1.0
|
267
196
|
signing_key:
|
268
|
-
specification_version:
|
269
|
-
summary: Rails I18n de-facto standard library for ActiveRecord model/data translation
|
197
|
+
specification_version: 4
|
198
|
+
summary: Rails I18n de-facto standard library for ActiveRecord 3 model/data translation
|
270
199
|
test_files: []
|
200
|
+
has_rdoc:
|
data/CHANGELOG.md
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# Globalize Changelog
|
2
|
-
|
3
|
-
## 4.0.0 (2014-1-4)
|
4
|
-
* Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
|
5
|
-
|
6
|
-
## 4.0.0.alpha.5 (2014-1-4)
|
7
|
-
* Fix issue where globalize breaks has_many through when model called with `where` (thanks [Paul McMahon](https://github.com/pwim)).
|
8
|
-
* Modify dup so that translations are copied, and remove custom clone code to conform to Rails/AR semantics (thanks [Paul McMahon](https://github.com/pwim)).
|
9
|
-
|
10
|
-
## 4.0.0.alpha.4 (2013-12-30)
|
11
|
-
* Add this changelog.
|
12
|
-
* Add contributing guidelines.
|
13
|
-
* Group options into more structured methods in act_macro.rb.
|
14
|
-
* Remove dynamic finder code from globalize3, no longer used in AR4.
|
15
|
-
* Get hash of translated attributes by calling attribute on model, not translation.
|
16
|
-
* Define translation readers/writers in separate methods.
|
17
|
-
* Test against AR 4.1 and AR 4.0.
|
18
|
-
* Switch to minitest-reporters for colouring output from minitest.
|
19
|
-
* Remove find_or_instantiator_by_attributes which is no longer used in AR4.
|
20
|
-
* Set I18n.available_locales in tests to avoid deprecation message.
|
21
|
-
* Reorganize specs into describe blocks to clarify object of specs.
|
22
|
-
|
23
|
-
## 4.0.0.alpha.3 (2013-12-18)
|
24
|
-
|
25
|
-
* Move ActiveRecord::Relation#where_values_hash patch into globalize relation class to avoid monkeypatching.
|
26
|
-
* Add Code Climate Score (thanks [BrandonMathis](https://github.com/BrandonMathis)).
|
27
|
-
* Query using Globalize.fallbacks rather than locale only when fetching a record (thanks [@huoxito](https://github.com/huoxito)).
|
28
|
-
* Use a module (QueryMethods) rather than a class for overriding functionality of ActiveRecord::Relation.
|
29
|
-
* Use ActiveRecord::Relation#extending! to extend ActiveRecord::Base#relation with QueryMethods, works with associations as well.
|
30
|
-
|
31
|
-
## 4.0.0.alpha.2 (2013-10-24)
|
32
|
-
|
33
|
-
* Add license to gemspec.
|
34
|
-
* Update references to ActiveRecord 3 -> ActiveRecord.
|
35
|
-
* Replace references to globalize3 with globalize and remove references to ActiveRecord 3.x.
|
36
|
-
* Document `3-0-stable` branch in readme.
|
37
|
-
* Convert test syntax to MiniTest::Spec.
|
38
|
-
* Extract easy accessors functionality, moved to new [globalize-accessors](https://github.com/globalize/globalize-accessors) gem.
|
39
|
-
* Check that `first` is not nil before reloading translations, fixes [#282](https://github.com/globalize/globalize/issues/282).
|
40
|
-
* Duplicate arguments in query finders before modifying them, fixes [#284](https://github.com/globalize/globalize/issues/284).
|
41
|
-
* Add test for `find_or_create_by` with translated attribute.
|
42
|
-
|
43
|
-
## 4.0.0.alpha.1 (2013-10-9)
|
44
|
-
|
45
|
-
* Initial release of Rails 4-compatible gem.
|
46
|
-
|
47
|
-
## 3.1.0 (2014-1-25)
|
48
|
-
|
49
|
-
* Backport scope support on uniqueness validation from 4.0, drop support for ActiveRecord < 3.1, fixes ([https://github.com/globalize/globalize/issues/324](#324)).
|
50
|
-
|
51
|
-
## 3.0.4 (2014-1-8)
|
52
|
-
* Extract all versioning-related code to separate [globalize-versioning](https://github.com/globalize/globalize-versioning) gem.
|
53
|
-
|
54
|
-
## 3.0.3 (2013-12-26)
|
55
|
-
|
56
|
-
* Ensure that foreign key is always set when saving translations (thanks [Andrew Feng](https://github.com/mingliangfeng)).
|
57
|
-
* Patch I18n to add back I18n.interpolate after it was removed (accidentally?) in v0.5.2 (see [svenfuchs/i18n#232](https://github.com/svenfuchs/i18n/issues/232). Hopefully this patch will be temporary.
|
58
|
-
* Explicitly test compatibility with FriendlyId to avoid issues like [#306](https://github.com/globalize/globalize/issues/306).
|
59
|
-
* Only override ActiveRecord::Base#relation to patch where_values_hash if using AR >= 3.2.1.
|
60
|
-
|
61
|
-
## 3.0.2 (2013-12-07)
|
62
|
-
|
63
|
-
* Alias `ActiveRecord::Base#relation` and include query method overrides as module, fixes [#306](https://github.com/globalize/globalize/issues/306) and [norman/friendly_id#485](https://github.com/norman/friendly_id/issues/485).
|
64
|
-
|
65
|
-
## 3.0.1 (2013-11-07)
|
66
|
-
|
67
|
-
* Move `ActiveRecord::Relation#where_values_hash` patch to Globalize-specific Relation class that inherits from `ActiveRecord::Relation` to fix compatibility issue with Squeel ([#288](https://github.com/globalize/globalize/issues/288)).
|
68
|
-
* Use FriendlyId pattern for overriding `ActiveRecord::Base#relation` to avoid conflict.
|
69
|
-
* Remove `:null => false` condition on reference to parent model in translation table migration, partial fix for [refinery/refinerycms#2450](https://github.com/refinery/refinerycms/issues/2450).
|
70
|
-
|
71
|
-
## 3.0.0 (2013-10-24)
|
72
|
-
|
73
|
-
* Initial release with new version numbering.
|
data/CONTRIBUTING.md
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# Contributing to Globalize
|
2
|
-
|
3
|
-
Globalize is a community project, and would not be here today if it were not for the support of the community of [contributors](https://github.com/globalize/globalize/graphs/contributors) that have kept it alive and running. Thank you for your support!
|
4
|
-
|
5
|
-
## Bugs
|
6
|
-
|
7
|
-
If you find a bug or something is not working as expected, please search through the [github issues](https://github.com/globalize/globalize/issues) and on [stackoverflow](http://stackoverflow.com/questions/tagged/globalize) first. If you cannot find any answers related to your issue, post a new one and we will try to address it as soon as we can. Note that we prioritize Rails 4 issues (`master` branch) over Rails 3 issues (`3-0-stable` branch).
|
8
|
-
|
9
|
-
If you also have some idea how to fix the bug, then by all means post a pull request (see below).
|
10
|
-
|
11
|
-
## Features
|
12
|
-
|
13
|
-
Have an idea for a new feature? Great! Keep in mind though that we are trying to cut down on non-core functionality in the Globalize core and push it to separate extensions, such as [globalize-accessors](https://github.com/globalize/globalize-accessors). If you are proposing something like this, we would prefer you to create a separate repository and gem for it.
|
14
|
-
|
15
|
-
If however your feature would improve the core functionality of Globalize, please do submit a PR, preferably to the `master` branch.
|
16
|
-
|
17
|
-
## Refactoring
|
18
|
-
|
19
|
-
Have some free time? Help us improve our [code climate score](https://codeclimate.com/github/globalize/globalize) by refactoring the codebase. If the tests still pass and the changes seem reasonable, we will happily merge them. As elsewhere, priority always goes to the Rails/AR 4 series (`master` branch).
|
20
|
-
|
21
|
-
## Documentation
|
22
|
-
|
23
|
-
Globalize needs better documentation. That includes more inline comments explaining clearly what code is doing, as well as reference documentation beyond the [readme](readme.md) -- possibly in the github wiki. Please contact us if you would like to help with documentation.
|
24
|
-
|
25
|
-
## Pull Requests
|
26
|
-
|
27
|
-
Have a bug fix, code improvement or proposed feature? Do the following:
|
28
|
-
|
29
|
-
1. Fork the repository.
|
30
|
-
2. Create your feature branch: `git checkout -b my_new_feature`
|
31
|
-
3. Commit your changes: `git commit -am 'Add some new feature'`
|
32
|
-
4. Push to the branch: `git push origin my_new_feature`
|
33
|
-
5. Submit a pull request.
|
34
|
-
|
35
|
-
For pull requests to Rails/ActiveRecord 4 version of Globalize (v3.x), post to the `master` branch. For pull requests to the Rails/ActiveRecord 3.x version of Globalize (3.x), post to the `3-0-stable` branch.
|
36
|
-
|
37
|
-
When you submit the pull request, Travis CI will run the [test suite](https://travis-ci.org/globalize/globalize) against your branch and will highlight any failures. Unless there is a good reason for it, we do not generally accept pull requests that take Globalize from green to red.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Globalize
|
2
|
-
module ActiveRecord
|
3
|
-
module QueryMethods
|
4
|
-
def where_values_hash
|
5
|
-
equalities = with_default_scope.where_values.grep(Arel::Nodes::Equality).find_all { |node|
|
6
|
-
node.left.relation.name == translations_table_name
|
7
|
-
}
|
8
|
-
|
9
|
-
super.merge(Hash[equalities.map { |where| [where.left.name, where.right] }]).with_indifferent_access
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/globalize/version.rb
DELETED