umbrellio-sequel-plugins 0.18.0 → 0.19.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: 7a801a66fb801ece2e3db9f48a042d34f9a5f857817cd70103b730bb5025d0fd
4
- data.tar.gz: e90f785e58bf727159b83bbb0387351254279412fc2e3e7bbd41f1c33ef4767c
3
+ metadata.gz: f247c8695f1d06e2ada379cf25e1b387871ff0249816099ff9dd9aaebec32fc8
4
+ data.tar.gz: 12cc3acf1bb7106fd70a8e4d89ba243e09c766316e2cdd60297e67f3bfafd887
5
5
  SHA512:
6
- metadata.gz: 949c5b6918b91001653bda2706900c9fec8eba2449425e783ba0a593e6bf938443a5723687e2c58cd887700ebeb8167eac59088105e2d12bc2668ca777246aa5
7
- data.tar.gz: 2635f3b88224877118eb0ffe706e49d32753ab017309b643b661ea9c7e56ad667e9586c4246aa76a7b5d6c8ee49b4a1c9f41768a9e1acef3c96dc9a732ef8de2
6
+ metadata.gz: 90bf1d35960c9464c3a55e045e91952d0722fd189102e3d4f7b2890cc7c5942ed97f98c4c9000c24f4ed30f44cc2f7c05223ca8f43a6af30253baba48bc9ae28
7
+ data.tar.gz: a8f770ea411c1dc6688c0136d67106652f08c836f3fb2622a10200d02cae90345cb013ece33577010a41a08dcf55ca34152ec1522bf147956caf41787cdc981d
@@ -30,7 +30,7 @@ jobs:
30
30
  strategy:
31
31
  fail-fast: false
32
32
  matrix:
33
- ruby: ["3.0", "3.1", "3.2", "3.3"]
33
+ ruby: ["3.3", "3.4"]
34
34
 
35
35
  name: ${{ matrix.ruby }}
36
36
 
@@ -0,0 +1,54 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Extract version
17
+ id: version
18
+ run: |
19
+ version=$(grep -oP '(?<=version = ")[^"]+' umbrellio-sequel-plugins.gemspec)
20
+ echo "tag=v$version" >> "$GITHUB_OUTPUT"
21
+
22
+ - name: Check if release already exists
23
+ id: check
24
+ run: |
25
+ if gh release view "${{ steps.version.outputs.tag }}" &>/dev/null; then
26
+ echo "exists=true" >> "$GITHUB_OUTPUT"
27
+ else
28
+ echo "exists=false" >> "$GITHUB_OUTPUT"
29
+ fi
30
+ env:
31
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32
+
33
+ - uses: ruby/setup-ruby@v1
34
+ if: steps.check.outputs.exists == 'false'
35
+ with:
36
+ ruby-version: "3.4"
37
+ bundler-cache: true
38
+
39
+ - name: Build gem
40
+ if: steps.check.outputs.exists == 'false'
41
+ run: gem build umbrellio-sequel-plugins.gemspec
42
+
43
+ - name: Push gem to RubyGems
44
+ if: steps.check.outputs.exists == 'false'
45
+ run: gem push *.gem
46
+ env:
47
+ GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
48
+
49
+ - uses: softprops/action-gh-release@v3
50
+ if: steps.check.outputs.exists == 'false'
51
+ with:
52
+ tag_name: ${{ steps.version.outputs.tag }}
53
+ files: "*.gem"
54
+ generate_release_notes: true
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 3.0
6
+ TargetRubyVersion: 3.3
7
7
 
8
8
  Naming/FileName:
9
9
  Exclude:
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ gemspec
6
6
 
7
7
  gem "async"
8
8
  gem "money"
9
+ gem "opentelemetry-api"
9
10
  gem "pg"
10
11
  gem "pry"
11
12
  gem "rake"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- umbrellio-sequel-plugins (0.18.0)
4
+ umbrellio-sequel-plugins (0.19.0)
5
5
  concurrent-ruby
6
6
  sequel
7
7
 
@@ -41,12 +41,15 @@ GEM
41
41
  concurrent-ruby (~> 1.0)
42
42
  json (2.7.2)
43
43
  language_server-protocol (3.17.0.3)
44
+ logger (1.7.0)
44
45
  method_source (1.1.0)
45
46
  minitest (5.25.1)
46
47
  money (6.19.0)
47
48
  i18n (>= 0.6.4, <= 2)
48
49
  mutex_m (0.2.0)
49
50
  nio4r (2.7.3)
51
+ opentelemetry-api (1.10.0)
52
+ logger
50
53
  parallel (1.26.3)
51
54
  parser (3.3.5.0)
52
55
  ast (~> 2.4.1)
@@ -140,6 +143,7 @@ PLATFORMS
140
143
  DEPENDENCIES
141
144
  async
142
145
  money
146
+ opentelemetry-api
143
147
  pg
144
148
  pry
145
149
  rake
@@ -18,13 +18,13 @@ module Clickhouse
18
18
  migrator(target: target.to_i).run
19
19
  end
20
20
 
21
- def migrator(**opts)
21
+ def migrator(**)
22
22
  Sequel::TimestampMigrator.new(
23
23
  DB,
24
24
  Rails.root.join("db/migrate/clickhouse"),
25
25
  table: :clickhouse_migrations,
26
26
  use_transactions: false,
27
- **opts,
27
+ **,
28
28
  )
29
29
  end
30
30
  end
@@ -11,8 +11,8 @@ module Sequel
11
11
  __value.public_send(...)
12
12
  end
13
13
 
14
- def respond_to_missing?(*args)
15
- __value.respond_to?(*args)
14
+ def respond_to_missing?(*)
15
+ __value.respond_to?(*)
16
16
  end
17
17
 
18
18
  [:!, :==, :!=, :instance_eval, :instance_exec].each do |method|
@@ -24,10 +24,10 @@ module Sequel
24
24
 
25
25
  # Default proxy: schedules block via Concurrent::Future, blocks on first access.
26
26
  class Proxy < BaseProxy
27
- def initialize(executor, &block)
27
+ def initialize(executor, &)
28
28
  super()
29
29
 
30
- @future = Concurrent::Promises.future_on(executor, &block)
30
+ @future = Concurrent::Promises.future_on(executor, &)
31
31
  end
32
32
 
33
33
  def __value
@@ -119,8 +119,16 @@ module Sequel
119
119
  end
120
120
  end
121
121
 
122
- def async_run(&block)
123
- async_job_class.new(async_thread_executor, &block)
122
+ def async_run(&)
123
+ otel_context = OpenTelemetry::Context.current if defined?(OpenTelemetry::Context)
124
+
125
+ if otel_context && !otel_context.equal?(OpenTelemetry::Context::ROOT)
126
+ async_job_class.new(async_thread_executor) do
127
+ OpenTelemetry::Context.with_current(otel_context, &)
128
+ end
129
+ else
130
+ async_job_class.new(async_thread_executor, &)
131
+ end
124
132
  end
125
133
  end
126
134
 
@@ -11,9 +11,9 @@ module SimpleMigrationExtension
11
11
  end
12
12
 
13
13
  module MigratorExtension
14
- def checked_transaction(migration, &block)
14
+ def checked_transaction(migration, &)
15
15
  if _use_transaction?(migration)
16
- _transaction(migration, &block)
16
+ _transaction(migration, &)
17
17
  else
18
18
  yield
19
19
  end
@@ -38,11 +38,11 @@ module MigratorExtension
38
38
  end
39
39
  end
40
40
 
41
- def _transaction(migration, &block)
41
+ def _transaction(migration, &)
42
42
  if migration.transaction_opts.nil?
43
- db.transaction(&block)
43
+ db.transaction(&)
44
44
  else
45
- db.transaction(migration.transaction_opts, &block)
45
+ db.transaction(migration.transaction_opts, &)
46
46
  end
47
47
  end
48
48
  end
@@ -24,9 +24,9 @@ module Sequel
24
24
  def synchronize_with(*args, timeout: 10, savepoint: false, skip_if_locked: false)
25
25
  key = lock_key_for(args)
26
26
 
27
- transaction(savepoint: savepoint) do
27
+ transaction(savepoint:) do
28
28
  hash = key_hash(key)
29
- if get_lock(key, hash, timeout: timeout, skip_if_locked: skip_if_locked)
29
+ if get_lock(key, hash, timeout:, skip_if_locked:)
30
30
  log_info("locked with #{key} (#{hash})")
31
31
  yield
32
32
  end
@@ -16,7 +16,7 @@ module Sequel::Plugins::Upsert
16
16
  where_spec = cols.map { |x| Sequel::Plugins::Upsert.distinct_expr(table_name, x) }.reduce(:|)
17
17
 
18
18
  dataset.insert_conflict(
19
- target: target,
19
+ target:,
20
20
  update: update_spec,
21
21
  update_where: where_spec,
22
22
  )
@@ -25,21 +25,21 @@ module Sequel::Plugins::Upsert
25
25
  # Executes the upsert request
26
26
  #
27
27
  # @param row [Hash] values
28
- # @param options [Hash] options
28
+ # @param target [Symbol] target column
29
29
  #
30
30
  # @example
31
- # User.upsert(name: "John", email: "jd@test.com", target: :email)
31
+ # User.upsert({name: "John", email: "jd@test.com"}, target: :email)
32
32
  # @return [Sequel::Model]
33
- def upsert(row, **options)
34
- upsert_dataset(**options).insert(sequel_values(row))
33
+ def upsert(row, **)
34
+ upsert_dataset(**).insert(sequel_values(row))
35
35
  end
36
36
 
37
37
  # Executes the upsert request for multiple rows
38
38
  # @see #upsert
39
39
  # @see #upsert_dataset
40
- def multi_upsert(rows, **options)
40
+ def multi_upsert(rows, **)
41
41
  rows = rows.map { |row| sequel_values(row) }
42
- upsert_dataset(**options).multi_insert(rows)
42
+ upsert_dataset(**).multi_insert(rows)
43
43
  end
44
44
 
45
45
  # Returns formatted row values
@@ -10,7 +10,7 @@ module Sequel::Plugins::WithLock
10
10
  @__locked = true
11
11
 
12
12
  begin
13
- db.transaction(savepoint: savepoint) do
13
+ db.transaction(savepoint:) do
14
14
  lock!(mode)
15
15
  yield
16
16
  end
@@ -15,7 +15,7 @@ namespace :sequel do
15
15
 
16
16
  migrations = Rails.root.glob(migrations_path).map do |file|
17
17
  filename = file.basename.to_s
18
- { version: filename.to_i, filename: filename, source: file.read }
18
+ { version: filename.to_i, filename:, source: file.read }
19
19
  end
20
20
 
21
21
  conflict_options = {
@@ -21,7 +21,7 @@ namespace :sequel do
21
21
 
22
22
  migrator_args = {
23
23
  table: args[:migration_table],
24
- use_transactions: use_transactions,
24
+ use_transactions:,
25
25
  allow_missing_migration_files: false,
26
26
  }.compact
27
27
  migrator = Sequel::TimestampMigrator.new(DB, tmpdir, migrator_args)
@@ -23,7 +23,7 @@ namespace :sequel do
23
23
  path = Rails.root.join("db/migrate")
24
24
  migrator_args = {
25
25
  table: args[:table],
26
- use_transactions: use_transactions,
26
+ use_transactions:,
27
27
  allow_missing_migration_files: false,
28
28
  }.compact
29
29
  migrator = Sequel::TimestampMigrator.new(DB, path, migrator_args)
@@ -5,8 +5,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "umbrellio-sequel-plugins"
8
- spec.version = "0.18.0"
9
- spec.required_ruby_version = ">= 3.0"
8
+ spec.version = "0.19.0"
9
+ spec.required_ruby_version = ">= 3.3"
10
10
 
11
11
  spec.authors = ["Team Umbrellio"]
12
12
  spec.email = ["oss@umbrellio.biz"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-sequel-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Umbrellio
@@ -45,6 +45,7 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - ".github/workflows/ci.yml"
48
+ - ".github/workflows/release.yml"
48
49
  - ".gitignore"
49
50
  - ".rspec"
50
51
  - ".rubocop.yml"
@@ -99,14 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
100
  requirements:
100
101
  - - ">="
101
102
  - !ruby/object:Gem::Version
102
- version: '3.0'
103
+ version: '3.3'
103
104
  required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  requirements:
105
106
  - - ">="
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []
109
- rubygems_version: 4.0.6
110
+ rubygems_version: 3.6.9
110
111
  specification_version: 4
111
112
  summary: Sequel plugins
112
113
  test_files: []