i18n-sequel_bitemporal 1.0.3 → 1.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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +125 -0
- data/.gitignore +1 -1
- data/Gemfile +2 -0
- data/ci/Gemfile.rails-5.0 +2 -0
- data/ci/Gemfile.rails-5.1 +2 -0
- data/ci/Gemfile.rails-5.2 +2 -0
- data/ci/Gemfile.rails-6.0 +23 -0
- data/ci/Gemfile.rails-6.1 +23 -0
- data/ci/Gemfile.rails-7.0 +23 -0
- data/ci/Gemfile.rails-7.1 +23 -0
- data/lib/i18n/backend/sequel_bitemporal/translation.rb +7 -1
- data/lib/i18n/sequel_bitemporal/version.rb +1 -1
- data/test/database.sqlite3 +0 -0
- data/test/sequel_test.rb +7 -3
- data/test/test_setup.rb +46 -37
- metadata +10 -5
- data/.ruby-version +0 -1
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74ce18e7919b76481ccbdd441665fc1db28e6906535353fcb9b6947539a734ff
|
4
|
+
data.tar.gz: fbb27c3efd8c27792c71e7a42d02abe54cd8a909c3bb9ead3da396b1e1e0ebd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feedc4b5e08a1919cd71c91a34318459e0d1756c2cdadc081bb3f82d4aa77b9b0ce07f66882d76bbfceb5de2c4ec13afb1077a7228ec0c7ed176c067d053eb3d
|
7
|
+
data.tar.gz: b52f213f7b460187f64fefd09f297a2f5178caa99f045da493dca7c0b37945c85c0ccd01c65919b80d963aee95d9adcf3d6d46a2898e3398c20b913a50fff3ff
|
@@ -0,0 +1,125 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: ['**']
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
tests:
|
11
|
+
services:
|
12
|
+
postgres:
|
13
|
+
image: postgres:13
|
14
|
+
env:
|
15
|
+
POSTGRES_USER: postgres
|
16
|
+
POSTGRES_PASSWORD: postgres
|
17
|
+
ports:
|
18
|
+
- 5432
|
19
|
+
options: >-
|
20
|
+
--health-cmd pg_isready
|
21
|
+
--health-interval 10s
|
22
|
+
--health-timeout 5s
|
23
|
+
--health-retries 5
|
24
|
+
|
25
|
+
mysql:
|
26
|
+
image: mysql:8.0
|
27
|
+
env:
|
28
|
+
MYSQL_ROOT_PASSWORD: root
|
29
|
+
ports:
|
30
|
+
- 3306
|
31
|
+
options: >-
|
32
|
+
--health-cmd="mysqladmin ping"
|
33
|
+
--health-interval=10s
|
34
|
+
--health-timeout=5s
|
35
|
+
--health-retries=3
|
36
|
+
|
37
|
+
runs-on: ubuntu-latest
|
38
|
+
strategy:
|
39
|
+
fail-fast: false
|
40
|
+
matrix:
|
41
|
+
rails:
|
42
|
+
- "5.0"
|
43
|
+
- "5.1"
|
44
|
+
- "5.2"
|
45
|
+
- "6.0"
|
46
|
+
- "6.1"
|
47
|
+
- "7.0"
|
48
|
+
- "7.1"
|
49
|
+
ruby:
|
50
|
+
- "2.6"
|
51
|
+
- "2.7"
|
52
|
+
- "3.0"
|
53
|
+
- "3.1"
|
54
|
+
- "3.2"
|
55
|
+
- "3.3"
|
56
|
+
# - "jruby"
|
57
|
+
include:
|
58
|
+
- ruby: "2.6"
|
59
|
+
rails: "5.2"
|
60
|
+
- ruby: "2.6"
|
61
|
+
rails: "6.0"
|
62
|
+
- ruby: "2.7"
|
63
|
+
rails: "6.0"
|
64
|
+
exclude:
|
65
|
+
- ruby: "3.1"
|
66
|
+
rails: "6.1"
|
67
|
+
- ruby: "3.2"
|
68
|
+
rails: "6.1"
|
69
|
+
- ruby: "3.3"
|
70
|
+
rails: "6.1"
|
71
|
+
- ruby: "2.6"
|
72
|
+
rails: "7.0"
|
73
|
+
- ruby: "jruby"
|
74
|
+
rails: "7.0"
|
75
|
+
- ruby: "2.6"
|
76
|
+
rails: "7.1"
|
77
|
+
- ruby: "jruby"
|
78
|
+
rails: "7.1"
|
79
|
+
name: Rails ${{ matrix.rails }}, Ruby ${{ matrix.ruby }}
|
80
|
+
|
81
|
+
env:
|
82
|
+
BUNDLE_GEMFILE: "ci/Gemfile.rails-${{ matrix.rails }}"
|
83
|
+
steps:
|
84
|
+
- uses: actions/checkout@v3
|
85
|
+
- name: Install db dependencies and check connections
|
86
|
+
run: |
|
87
|
+
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -yqq mysql-client libmysqlclient-dev postgresql-client libpq-dev
|
88
|
+
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot -e "SHOW GRANTS FOR 'root'@'localhost'"
|
89
|
+
env PGPASSWORD=postgres psql -h localhost -p ${{ job.services.postgres.ports[5432] }} -U postgres -l
|
90
|
+
- uses: ruby/setup-ruby@v1
|
91
|
+
with:
|
92
|
+
ruby-version: ${{ matrix.ruby }}
|
93
|
+
bundler-cache: true
|
94
|
+
- name: Create databases
|
95
|
+
run: |
|
96
|
+
mysql -e 'create database i18n_sequel_bitemporal;' --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot
|
97
|
+
env PGPASSWORD=postgres psql -c 'create database i18n_sequel_bitemporal;' -U postgres -h localhost -p ${{ job.services.postgres.ports[5432] }}
|
98
|
+
- name: Run PostgreSQL tests
|
99
|
+
run: bundle exec rake test
|
100
|
+
env:
|
101
|
+
TEST_ADAPTER: postgresql
|
102
|
+
TEST_DATABASE: i18n_sequel_bitemporal
|
103
|
+
TEST_DATABASE_HOST: localhost
|
104
|
+
TEST_DATABASE_PORT: ${{ job.services.postgres.ports[5432] }}
|
105
|
+
TEST_OWNER: postgres
|
106
|
+
TEST_USERNAME: postgres
|
107
|
+
TEST_PASSWORD: postgres
|
108
|
+
- name: Run MySQL2 tests
|
109
|
+
run: bundle exec rake test
|
110
|
+
if: matrix.ruby != 'jruby'
|
111
|
+
env:
|
112
|
+
TEST_ADAPTER: mysql2
|
113
|
+
TEST_DATABASE: i18n_sequel_bitemporal
|
114
|
+
TEST_DATABASE_HOST: 127.0.0.1
|
115
|
+
TEST_DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
|
116
|
+
TEST_USERNAME: root
|
117
|
+
TEST_PASSWORD: root
|
118
|
+
TEST_ENCODING: "utf8"
|
119
|
+
- name: Run SQLite tests
|
120
|
+
run: bundle exec rake test
|
121
|
+
env:
|
122
|
+
TEST_ADAPTER: "sqlite"
|
123
|
+
TEST_DATABASE: "test/database.sqlite3"
|
124
|
+
# - name: Lint
|
125
|
+
# run: bundle exec rubocop
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/ci/Gemfile.rails-5.0
CHANGED
data/ci/Gemfile.rails-5.1
CHANGED
data/ci/Gemfile.rails-5.2
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec :path => "../"
|
4
|
+
|
5
|
+
gem 'railties', '~> 6.0.0'
|
6
|
+
|
7
|
+
gem "test-unit"
|
8
|
+
gem "test_declarative"
|
9
|
+
gem "mocha"
|
10
|
+
gem "rake"
|
11
|
+
gem "timecop"
|
12
|
+
|
13
|
+
platforms :ruby do
|
14
|
+
gem "pg"
|
15
|
+
gem "mysql2"
|
16
|
+
gem "sqlite3"
|
17
|
+
end
|
18
|
+
|
19
|
+
platforms :jruby do
|
20
|
+
gem "jdbc-postgres"
|
21
|
+
gem "jdbc-mysql"
|
22
|
+
gem "jdbc-sqlite3"
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec :path => "../"
|
4
|
+
|
5
|
+
gem 'railties', '~> 6.1.0'
|
6
|
+
|
7
|
+
gem "test-unit"
|
8
|
+
gem "test_declarative"
|
9
|
+
gem "mocha"
|
10
|
+
gem "rake"
|
11
|
+
gem "timecop"
|
12
|
+
|
13
|
+
platforms :ruby do
|
14
|
+
gem "pg"
|
15
|
+
gem "mysql2"
|
16
|
+
gem "sqlite3"
|
17
|
+
end
|
18
|
+
|
19
|
+
platforms :jruby do
|
20
|
+
gem "jdbc-postgres"
|
21
|
+
gem "jdbc-mysql"
|
22
|
+
gem "jdbc-sqlite3"
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec :path => "../"
|
4
|
+
|
5
|
+
gem 'railties', '~> 7.0.0'
|
6
|
+
|
7
|
+
gem "test-unit"
|
8
|
+
gem "test_declarative"
|
9
|
+
gem "mocha"
|
10
|
+
gem "rake"
|
11
|
+
gem "timecop"
|
12
|
+
|
13
|
+
platforms :ruby do
|
14
|
+
gem "pg"
|
15
|
+
gem "mysql2"
|
16
|
+
gem "sqlite3"
|
17
|
+
end
|
18
|
+
|
19
|
+
platforms :jruby do
|
20
|
+
gem "jdbc-postgres"
|
21
|
+
gem "jdbc-mysql"
|
22
|
+
gem "jdbc-sqlite3"
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec :path => "../"
|
4
|
+
|
5
|
+
gem 'railties', '~> 7.1.0'
|
6
|
+
|
7
|
+
gem "test-unit"
|
8
|
+
gem "test_declarative"
|
9
|
+
gem "mocha"
|
10
|
+
gem "rake"
|
11
|
+
gem "timecop"
|
12
|
+
|
13
|
+
platforms :ruby do
|
14
|
+
gem "pg"
|
15
|
+
gem "mysql2"
|
16
|
+
gem "sqlite3"
|
17
|
+
end
|
18
|
+
|
19
|
+
platforms :jruby do
|
20
|
+
gem "jdbc-postgres"
|
21
|
+
gem "jdbc-mysql"
|
22
|
+
gem "jdbc-sqlite3"
|
23
|
+
end
|
@@ -102,6 +102,7 @@ module I18n
|
|
102
102
|
|
103
103
|
class Translation < ::Sequel::Model(::I18n::Backend::SequelBitemporal.master_table_name)
|
104
104
|
extend Forwardable
|
105
|
+
plugin :def_dataset_method
|
105
106
|
plugin :bitemporal, version_class: TranslationVersion
|
106
107
|
|
107
108
|
delegate [:value, :interpolations, :interpolates?] => :pending_or_current_version
|
@@ -143,7 +144,12 @@ module I18n
|
|
143
144
|
end
|
144
145
|
|
145
146
|
def all_for_locale(locale)
|
146
|
-
self.locale(locale).with_current_version.
|
147
|
+
self.locale(locale).with_current_version.select(
|
148
|
+
:locale,
|
149
|
+
:key,
|
150
|
+
:value,
|
151
|
+
:is_proc
|
152
|
+
).all
|
147
153
|
end
|
148
154
|
end
|
149
155
|
end
|
Binary file
|
data/test/sequel_test.rb
CHANGED
@@ -97,7 +97,7 @@ class I18nBackendSequelBitemporalTest < I18nBitemporalTest
|
|
97
97
|
end
|
98
98
|
|
99
99
|
test "allows to override the table names" do
|
100
|
-
::Sequel::Model.db.transaction :rollback => :always do
|
100
|
+
::Sequel::Model.db.transaction :rollback => :always, savepoint: :only do
|
101
101
|
begin
|
102
102
|
::Sequel.migration do
|
103
103
|
change do
|
@@ -143,8 +143,12 @@ class I18nBackendSequelBitemporalTest < I18nBitemporalTest
|
|
143
143
|
def change_table_names(master_name, version_name)
|
144
144
|
::I18n::Backend::SequelBitemporal.master_table_name = master_name
|
145
145
|
::I18n::Backend::SequelBitemporal.version_table_name = version_name
|
146
|
-
::I18n::Backend::SequelBitemporal.
|
147
|
-
|
146
|
+
if ::I18n::Backend::SequelBitemporal.const_defined?(:Translation)
|
147
|
+
::I18n::Backend::SequelBitemporal.send :remove_const, :Translation
|
148
|
+
end
|
149
|
+
if ::I18n::Backend::SequelBitemporal.const_defined?(:TranslationVersion)
|
150
|
+
::I18n::Backend::SequelBitemporal.send :remove_const, :TranslationVersion
|
151
|
+
end
|
148
152
|
load File.expand_path(
|
149
153
|
"../../lib/i18n/backend/sequel_bitemporal/translation.rb",
|
150
154
|
__FILE__
|
data/test/test_setup.rb
CHANGED
@@ -5,18 +5,14 @@ require "optparse"
|
|
5
5
|
module I18n
|
6
6
|
module Tests
|
7
7
|
class << self
|
8
|
-
def options
|
9
|
-
@options ||= { :with => [], :adapter => "sqlite3" }
|
10
|
-
end
|
11
|
-
|
12
8
|
def parse_options!
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
options[:
|
9
|
+
options[:adapter] = ENV.fetch "TEST_ADAPTER", "sqlite"
|
10
|
+
options[:database] = ENV.fetch "TEST_DATABASE", ":memory:"
|
11
|
+
options[:host] = ENV.fetch "TEST_DATABASE_HOST", nil
|
12
|
+
options[:port] = ENV.fetch "TEST_DATABASE_PORT", nil
|
13
|
+
options[:user] = ENV.fetch "TEST_USERNAME", nil
|
14
|
+
options[:password] = ENV.fetch "TEST_PASSWORD", nil
|
15
|
+
options[:encoding] = ENV.fetch "TEST_ENCODING", nil
|
20
16
|
end
|
21
17
|
|
22
18
|
def setup_sequel
|
@@ -38,9 +34,11 @@ module I18n
|
|
38
34
|
connect_adapter
|
39
35
|
::Sequel.extension :migration
|
40
36
|
opts = {}
|
41
|
-
opts[:cascade] = true if
|
42
|
-
::Sequel::Model.db.drop_table? :
|
37
|
+
opts[:cascade] = true if postgresql?
|
38
|
+
::Sequel::Model.db.drop_table? :another_i18n_translation_versions, opts
|
39
|
+
::Sequel::Model.db.drop_table? :another_i18n_translations, opts
|
43
40
|
::Sequel::Model.db.drop_table? :i18n_translation_versions, opts
|
41
|
+
::Sequel::Model.db.drop_table? :i18n_translations, opts
|
44
42
|
::Sequel.migration do
|
45
43
|
change do
|
46
44
|
create_table :i18n_translations do
|
@@ -66,33 +64,44 @@ module I18n
|
|
66
64
|
end
|
67
65
|
|
68
66
|
def connect_adapter
|
69
|
-
|
67
|
+
connect_options = options.dup
|
70
68
|
if ENV["DEBUG"]
|
71
69
|
require "logger"
|
72
|
-
logger
|
70
|
+
connect_options = options.merge! :logger => Logger.new(STDOUT)
|
73
71
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
72
|
+
::Sequel.connect(connect_options.merge(:adapter => adapter))
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def options
|
78
|
+
@options ||= {}
|
79
|
+
end
|
80
|
+
|
81
|
+
def jruby?
|
82
|
+
(defined?(RUBY_ENGINE) && RUBY_ENGINE=="jruby") || defined?(JRUBY_VERSION)
|
83
|
+
end
|
84
|
+
|
85
|
+
def postgresql?
|
86
|
+
options[:adapter] == "postgresql"
|
87
|
+
end
|
88
|
+
|
89
|
+
def sqlite?
|
90
|
+
options[:adapter] == "sqlite"
|
91
|
+
end
|
92
|
+
|
93
|
+
def mysql?
|
94
|
+
options[:adapter] == "mysql2"
|
95
|
+
end
|
96
|
+
|
97
|
+
def adapter
|
98
|
+
case options[:adapter]
|
99
|
+
when "sqlite", "sqlite3"
|
100
|
+
jruby? ? "jdbc:sqlite:" : "sqlite"
|
101
|
+
when "postgresql", "postgres"
|
102
|
+
jruby? ? "jdbc:postgresql" : "postgresql"
|
103
|
+
when "mysql", "mysql2"
|
104
|
+
jruby? ? "jdbc:mysql" : "mysql2"
|
96
105
|
end
|
97
106
|
end
|
98
107
|
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.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Tron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -61,9 +61,8 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- ".github/workflows/ci.yml"
|
64
65
|
- ".gitignore"
|
65
|
-
- ".ruby-version"
|
66
|
-
- ".travis.yml"
|
67
66
|
- Gemfile
|
68
67
|
- MIT-LICENSE
|
69
68
|
- README.md
|
@@ -71,6 +70,10 @@ files:
|
|
71
70
|
- ci/Gemfile.rails-5.0
|
72
71
|
- ci/Gemfile.rails-5.1
|
73
72
|
- ci/Gemfile.rails-5.2
|
73
|
+
- ci/Gemfile.rails-6.0
|
74
|
+
- ci/Gemfile.rails-6.1
|
75
|
+
- ci/Gemfile.rails-7.0
|
76
|
+
- ci/Gemfile.rails-7.1
|
74
77
|
- i18n-sequel_bitemporal.gemspec
|
75
78
|
- lib/i18n/backend/sequel_bitemporal.rb
|
76
79
|
- lib/i18n/backend/sequel_bitemporal/missing.rb
|
@@ -80,6 +83,7 @@ files:
|
|
80
83
|
- lib/i18n/sequel_bitemporal/version.rb
|
81
84
|
- test/all.rb
|
82
85
|
- test/api_test.rb
|
86
|
+
- test/database.sqlite3
|
83
87
|
- test/missing_test.rb
|
84
88
|
- test/sequel_cache_test.rb
|
85
89
|
- test/sequel_test.rb
|
@@ -103,13 +107,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
107
|
- !ruby/object:Gem::Version
|
104
108
|
version: '0'
|
105
109
|
requirements: []
|
106
|
-
rubygems_version: 3.3
|
110
|
+
rubygems_version: 3.5.3
|
107
111
|
signing_key:
|
108
112
|
specification_version: 4
|
109
113
|
summary: I18n Bitemporal Sequel backend
|
110
114
|
test_files:
|
111
115
|
- test/all.rb
|
112
116
|
- test/api_test.rb
|
117
|
+
- test/database.sqlite3
|
113
118
|
- test/missing_test.rb
|
114
119
|
- test/sequel_cache_test.rb
|
115
120
|
- test/sequel_test.rb
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.6.3
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
before_script:
|
5
|
-
- psql -c 'create database i18n_sequel_bitemporal;' -U postgres
|
6
|
-
rvm:
|
7
|
-
- 2.3.8
|
8
|
-
- 2.4.6
|
9
|
-
- 2.5.5
|
10
|
-
- 2.6.3
|
11
|
-
env:
|
12
|
-
- ADAPTER=sqlite3
|
13
|
-
- ADAPTER=postgres
|
14
|
-
gemfile:
|
15
|
-
- ci/Gemfile.rails-5.0
|
16
|
-
- ci/Gemfile.rails-5.1
|
17
|
-
- ci/Gemfile.rails-5.2
|