i18n-sequel_bitemporal 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74ce18e7919b76481ccbdd441665fc1db28e6906535353fcb9b6947539a734ff
4
- data.tar.gz: fbb27c3efd8c27792c71e7a42d02abe54cd8a909c3bb9ead3da396b1e1e0ebd6
3
+ metadata.gz: 51c7ecf260b7f3a053b84865028e583ec85555735d4b1198f643ac32628f4db8
4
+ data.tar.gz: 72ebf745d1c757327e594bf7963881ea9a77e1ccee8146a7ff1681debc8ed399
5
5
  SHA512:
6
- metadata.gz: feedc4b5e08a1919cd71c91a34318459e0d1756c2cdadc081bb3f82d4aa77b9b0ce07f66882d76bbfceb5de2c4ec13afb1077a7228ec0c7ed176c067d053eb3d
7
- data.tar.gz: b52f213f7b460187f64fefd09f297a2f5178caa99f045da493dca7c0b37945c85c0ccd01c65919b80d963aee95d9adcf3d6d46a2898e3398c20b913a50fff3ff
6
+ metadata.gz: fdeb0f48ba7610088e730c37e7366e5824e2244f8df1e7bef809c8ae2d7b6ed3adb1cd5b12c8b2d4f4b4f0cc9aefd7dbe1ffb44f13e92a4f35250727a31a4619
7
+ data.tar.gz: 8bd09dc1e24f6e0a97d1856dd56f1532e914a9b6ef221747f6467d8442acb082e56421723ac4c324a8563f5746bfcd2e9cbcb0c4ac770e1af0414a1b13d2a67b
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/TalentBox/i18n-sequel_bitemporal.svg?branch=master)](https://travis-ci.org/TalentBox/i18n-sequel_bitemporal)
1
+ [![Build Status](https://github.com/TalentBox/i18n-sequel_bitemporal/workflows/CI/badge.svg)](https://github.com/TalentBox/i18n-sequel_bitemporal/actions)
2
2
 
3
3
  # I18n::Backend::SequelBitemporal
4
4
 
@@ -122,16 +122,52 @@ database.
122
122
 
123
123
  ## Runnning tests
124
124
 
125
- gem install bundler
126
- BUNDLE_GEMFILE=ci/Gemfile.rails-5.x bundle
127
- BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 bundle
128
- BUNDLE_GEMFILE=ci/Gemfile.rails-5.x rake
129
- BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 rake
130
-
131
- If you want to see what queries are executed:
132
-
133
- DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-5.x rake
134
- DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 rake
125
+ ```shell
126
+ # Create db for mysql tests
127
+ mysql -e 'create database i18n_sequel_bitemporal;' --host 127.0.0.1
128
+ # Create db for postgresql tests
129
+ createdb i18n_sequel_bitemporal
130
+
131
+ ##
132
+ # Run tests for a specific Rails version
133
+ ##
134
+ BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" bundle install
135
+ # MySQL
136
+ BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=mysql2 TEST_DATABASE=i18n_sequel_bitemporal TEST_ENCODING="utf8" bundle exec rake test
137
+ # PG
138
+ BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=postgresql TEST_DATABASE=i18n_sequel_bitemporal bundle exec rake test
139
+ # Sqlite
140
+ BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=sqlite3 TEST_DATABASE=test/database.sqlite3 bundle exec rake test
141
+
142
+ ##
143
+ # Run tests for a specific Rails version, logging all queries to stdout
144
+ ##
145
+ BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" bundle install
146
+ # MySQL
147
+ DEBUG=1 BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=mysql2 TEST_DATABASE=i18n_sequel_bitemporal TEST_ENCODING="utf8" bundle exec rake test
148
+ # PG
149
+ DEBUG=1 BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=postgresql TEST_DATABASE=i18n_sequel_bitemporal bundle exec rake test
150
+ # Sqlite
151
+ DEBUG=1 BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=sqlite3 TEST_DATABASE=test/database.sqlite3 bundle exec rake test
152
+
153
+ ##
154
+ # Example to run tests for every supported Rails version.
155
+ # !! Some Rails versions are not compatible with all Ruby versions !!
156
+ ##
157
+ for gemfile in (ls ci/Gemfile.rails-* | grep -v lock);
158
+ echo $gemfile
159
+ BUNDLE_GEMFILE=$gemfile bundle install
160
+
161
+ # MySQL
162
+ BUNDLE_GEMFILE=$gemfile TEST_ADAPTER=mysql2 TEST_DATABASE=i18n_sequel_bitemporal TEST_ENCODING="utf8" bundle exec rake test
163
+
164
+ # PG
165
+ BUNDLE_GEMFILE=$gemfile TEST_ADAPTER=postgresql TEST_DATABASE=i18n_sequel_bitemporal bundle exec rake test
166
+
167
+ # Sqlite
168
+ BUNDLE_GEMFILE=$gemfile TEST_ADAPTER=sqlite3 TEST_DATABASE=test/database.sqlite3 bundle exec rake test
169
+ end
170
+ ```
135
171
 
136
172
  ## Maintainers
137
173
 
@@ -73,9 +73,10 @@ module I18n
73
73
  @translations.keys.each{|loc| clear loc, options }
74
74
  else
75
75
  last_update = options[:last_update]
76
- cache_time = @cache_times[locale]
76
+ cache_key = cache_key_of locale
77
+ cache_time = @cache_times[cache_key]
77
78
  return if last_update && cache_time && last_update < cache_time
78
- @translations[locale] = nil
79
+ @translations[cache_key] = nil
79
80
  end
80
81
  end
81
82
 
@@ -83,11 +84,12 @@ module I18n
83
84
 
84
85
  def fetch_all_translations(locale)
85
86
  @translations ||= {}
86
- @translations[locale] ||= begin
87
- @cache_times[locale] = Time.now
87
+ cache_key = cache_key_of locale
88
+ @translations[cache_key] ||= begin
89
+ @cache_times[cache_key] = Time.now
88
90
  Translation.all_for_locale(locale).group_by(&:key)
89
91
  end
90
- @translations[locale]
92
+ @translations[cache_key]
91
93
  end
92
94
 
93
95
  def lookup(locale, key, scope = [], options = {})
@@ -118,6 +120,10 @@ module I18n
118
120
  keys << [keys.last, key].compact.join(FLATTEN_SEPARATOR)
119
121
  end
120
122
  end
123
+
124
+ def cache_key_of(locale)
125
+ locale
126
+ end
121
127
  end
122
128
 
123
129
  include Implementation
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module SequelBitemporal
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-sequel_bitemporal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Tron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-05 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n