sequel_bitemporal 0.10.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d522ca4aed441f88c808ee0af6f54aa18bd873fc4742f11fd0e890b2c611b01
4
- data.tar.gz: eb3f8873178c6db5b69f6c5a2b2cc42582c21777ae92e94bda268b25873ea254
3
+ metadata.gz: 33df8e3ea5762139cd17bc15469b6f4c0535e698191eff1db9feb1387be4eb9b
4
+ data.tar.gz: da3482ad1fa5d018fc50e95c45940beba6013205574f65257be300abbfc119ee
5
5
  SHA512:
6
- metadata.gz: f16ee4864135847b45f8782b5926329dad9a21d150da5c9bd4d4e1ac4f568046595f768bad38a716b4316113e498fffd7eb91ccb94918dceba3724a073281cfb
7
- data.tar.gz: 737bac4d58bca9f678ef95fb0851fc82dc49f33eef19e91beb3c87ff34be2c2f2d5edb0417aac9ac709114e3d3b97bc1dbe32a0017cbf1d9adcc1d6dce81e119
6
+ metadata.gz: 0b6f966365eaf5c42143b5e050c467aaef0b1e479c68fd792cbedc1cf4d3c420962651254ca9dd1344c95e4401f3ee2ba56f6acb54702248a8d4d5684d351265
7
+ data.tar.gz: 176b15f045e9b91b29857f0b5e1ffcbb313d44cd623bd10718cbdabd359ba929b55c231882d639e47499c496307c8b5bbf9c160cacc11569d46c624bca9439d3
@@ -0,0 +1,64 @@
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
+ runs-on: ubuntu-latest
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ ruby:
30
+ - "2.7"
31
+ - "3.0"
32
+ - "3.1"
33
+ - "3.2"
34
+ - "3.3"
35
+ name: Ruby ${{ matrix.ruby }}
36
+
37
+ env:
38
+ SEQUEL: "~> 5.0"
39
+ BUNDLE_GEMFILE: "ci/sequel.gemfile"
40
+ steps:
41
+ - uses: actions/checkout@v3
42
+ - name: Install db dependencies and check connections
43
+ run: |
44
+ env PGPASSWORD=postgres psql -h localhost -p ${{ job.services.postgres.ports[5432] }} -U postgres -l
45
+ - uses: ruby/setup-ruby@v1
46
+ with:
47
+ ruby-version: ${{ matrix.ruby }}
48
+ bundler-cache: true
49
+ - name: Create databases
50
+ run: |
51
+ env PGPASSWORD=postgres psql -c 'create database sequel_bitemporal_test;' -U postgres -h localhost -p ${{ job.services.postgres.ports[5432] }}
52
+ - name: Run PostgreSQL tests
53
+ run: bundle exec rake spec
54
+ env:
55
+ TEST_ADAPTER: postgresql
56
+ TEST_DATABASE: sequel_bitemporal_test
57
+ TEST_DATABASE_HOST: localhost
58
+ TEST_DATABASE_PORT: ${{ job.services.postgres.ports[5432] }}
59
+ TEST_USERNAME: postgres
60
+ TEST_PASSWORD: postgres
61
+ - name: Run SQLite tests
62
+ run: bundle exec rake spec
63
+ env:
64
+ TEST_ADAPTER: sqlite
@@ -332,7 +332,7 @@ module Sequel
332
332
  { master_id: id }
333
333
  end
334
334
 
335
- current_version.keys.each do |key|
335
+ current_version.columns.each do |key|
336
336
  next if excluded_columns.include? key
337
337
  current_attributes[key] = current_version.public_send key
338
338
  end if current_version?
@@ -592,7 +592,7 @@ module Sequel
592
592
 
593
593
  def save_fossil(expired, attributes={})
594
594
  fossil = model.version_class.new
595
- expired_attributes = expired.keys.each_with_object({}) do |key, hash|
595
+ expired_attributes = expired.columns.each_with_object({}) do |key, hash|
596
596
  hash[key] = expired.public_send key
597
597
  end
598
598
  expired_attributes.delete :id
@@ -603,7 +603,7 @@ module Sequel
603
603
 
604
604
  def save_propagated(version, attributes={})
605
605
  propagated = model.version_class.new
606
- version_attributes = version.keys.each_with_object({}) do |key, hash|
606
+ version_attributes = version.columns.each_with_object({}) do |key, hash|
607
607
  hash[key] = version.public_send key
608
608
  end
609
609
  version_attributes.delete :id
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "sequel_bitemporal"
6
- s.version = "0.10.0"
6
+ s.version = "0.11.0"
7
7
  s.authors = ["Joseph HALTER", "Jonathan TRON"]
8
8
  s.email = ["joseph.halter@thetalentbox.com", "jonathan.tron@thetalentbox.com"]
9
9
  s.homepage = "https://github.com/TalentBox/sequel_bitemporal"
@@ -91,10 +91,10 @@ RSpec.describe "Sequel::Plugins::Bitemporal", :skip_jdbc_sqlite do
91
91
  expect(
92
92
  master.update_attributes valid_from: Date.parse("2016-01-01"), price: 10
93
93
  ).to be_truthy
94
- result = master.versions_dataset.order(:expired_at, :valid_from).all.map do |version|
94
+ result = master.versions_dataset.all.map do |version|
95
95
  [!!version.expired_at, version.valid_from.year, version.valid_to.year, version.price, version.length, version.width, version[:name]]
96
96
  end
97
- expect(result).to eql [
97
+ expect(result).to match_array [
98
98
  [false, 2016, 2017, 10, nil, nil, nil],
99
99
  [false, 2017, 2018, 0, 10, nil, "{}"],
100
100
  [false, 2018, 2019, 0, 20, nil, nil],
data/spec/spec_helper.rb CHANGED
@@ -12,11 +12,7 @@ rspec_exclusions = {}
12
12
  DB = if DbHelpers.pg?
13
13
  `createdb sequel_bitemporal_test`
14
14
  Sequel.extension :pg_range, :pg_range_ops
15
- if ::Sequel::Plugins::Bitemporal.jruby?
16
- Sequel.connect "jdbc:postgresql://localhost/sequel_bitemporal_test"
17
- else
18
- Sequel.postgres "sequel_bitemporal_test"
19
- end
15
+ Sequel.connect DbHelpers.pg_ruby_connect_uri
20
16
  else
21
17
  if Sequel::Plugins::Bitemporal.jruby?
22
18
  rspec_exclusions[:skip_jdbc_sqlite] = true
data/spec/support/db.rb CHANGED
@@ -1,13 +1,26 @@
1
1
  module DbHelpers
2
2
 
3
3
  def self.pg?
4
- ENV.has_key? "PG"
4
+ !ENV.has_key?("TEST_ADAPTER") || ENV["TEST_ADAPTER"]=="postgresql"
5
5
  end
6
6
 
7
7
  def self.jruby?
8
8
  (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') || defined?(JRUBY_VERSION)
9
9
  end
10
10
 
11
+ def self.pg_ruby_connect_uri
12
+ username = ENV.fetch("TEST_USERNAME", nil)
13
+ password = ENV.fetch("TEST_PASSWORD", nil)
14
+ auth = [username, password].compact.join(":")
15
+
16
+ uri = "postgresql://#{"#{auth}@" unless auth.empty?}#{ENV.fetch("TEST_DATABASE_HOST", "127.0.0.1")}:#{ENV.fetch("TEST_DATABASE_PORT", "5432")}/#{ENV.fetch("TEST_DATABASE", "sequel_bitemporal_test")}"
17
+ if jruby?
18
+ "jdbc:#{uri}"
19
+ else
20
+ uri
21
+ end
22
+ end
23
+
11
24
  def db_setup(opts={})
12
25
  use_time = opts[:use_time]
13
26
  DB.drop_table(:room_versions) if DB.table_exists?(:room_versions)
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_bitemporal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph HALTER
8
8
  - Jonathan TRON
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-28 00:00:00.000000000 Z
12
+ date: 2024-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
@@ -81,10 +81,10 @@ executables: []
81
81
  extensions: []
82
82
  extra_rdoc_files: []
83
83
  files:
84
+ - ".github/workflows/ci.yml"
84
85
  - ".gitignore"
85
86
  - ".rspec"
86
87
  - ".ruby-version"
87
- - ".travis.yml"
88
88
  - Gemfile
89
89
  - LICENSE
90
90
  - README.md
@@ -106,7 +106,7 @@ homepage: https://github.com/TalentBox/sequel_bitemporal
106
106
  licenses:
107
107
  - MIT
108
108
  metadata: {}
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -121,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.7.6
126
- signing_key:
124
+ rubygems_version: 3.5.3
125
+ signing_key:
127
126
  specification_version: 4
128
127
  summary: Bitemporal versioning for sequel.
129
128
  test_files:
data/.travis.yml DELETED
@@ -1,31 +0,0 @@
1
- language: ruby
2
-
3
- cache:
4
- bundler: true
5
-
6
- rvm:
7
- - 2.3.8
8
- - 2.4.5
9
- - 2.5.3
10
- - 2.6.0
11
- - jruby-9.1.17.0
12
- - jruby-9.2.5.0
13
- before_script:
14
- - psql -c 'create database sequel_bitemporal_test;' -U postgres
15
- env:
16
- - SQLITE=1 SEQUEL='~> 4.0'
17
- - SQLITE=1 SEQUEL='~> 5.0'
18
- - PG=1 SEQUEL='~> 4.0'
19
- - PG=1 SEQUEL='~> 5.0'
20
- gemfile:
21
- - ci/sequel.gemfile
22
- matrix:
23
- allow_failures:
24
- - rvm: jruby-9.1.17.0
25
- env: PG=1 SEQUEL='~> 4.0'
26
- - rvm: jruby-9.1.17.0
27
- env: PG=1 SEQUEL='~> 5.0'
28
- - rvm: jruby-9.2.5.0
29
- env: PG=1 SEQUEL='~> 4.0'
30
- - rvm: jruby-9.2.5.0
31
- env: PG=1 SEQUEL='~> 5.0'