github-ds 0.5.0 → 0.5.3

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: 88208f2b8cc24184dce9a984af467c44d9560196e9832d637ee99aac34082da8
4
- data.tar.gz: 70f8c5e30c4b237e33e0d96ff747c4719bcf300f5a67472fe7d347e6779ff0f7
3
+ metadata.gz: 67fbdfde76841e4bcdc3394cb89a3a153e2f37a40a96f94802fad44044f2930b
4
+ data.tar.gz: 969a49dd12b5014c55e789af20113430016df5210c9c2cecc2987f7352e00327
5
5
  SHA512:
6
- metadata.gz: 5afcb251c8dcbb250db23eb758f67a38baa8933fcf6325f2c9a419ae1dcee5455d7571a0eb0cfed0b401134225e482c74cab421b0bd116931996b5b954710c78
7
- data.tar.gz: bda6aa58192ec5d29d3a909f1d14d939fcb4b069019c7d617ede8f3e580eceedaddb180cf2c266cf9e8d21e262d7752d3d04d20ecfe1e5491cf75f544a611395
6
+ metadata.gz: 28dd029a03c1e1d7c37e9780103edadb28f55ae0c99d3397016ecbcbb9e0dc15254a3e1755890c5d1ecc3d9a202263f901b86d9694f06d66e5c44c1b2611e6b6
7
+ data.tar.gz: 264bbc44d409b3470fcb20eb665cf2620afdd144b22ac0845e13eba94ebb782f198fd654a992b09de6133daaa6141e536b8d7d237b327378cfacb6f63a56e32e
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on:
4
+ push: {}
5
+ pull_request:
6
+ branches: [ master ]
7
+
8
+ jobs:
9
+ test:
10
+ services:
11
+ mysql:
12
+ image: mysql:5.7
13
+ env:
14
+ MYSQL_ALLOW_EMPTY_PASSWORD: yes
15
+ MYSQL_DATABASE: github_ds_test
16
+ MYSQL_ROOT_PASSWORD: ""
17
+ ports:
18
+ - "3306:3306"
19
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
20
+
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ ruby-version: ['2.7', '3.0']
25
+ rails-version: ['7.0.0.alpha2', '6.1.0']
26
+ env:
27
+ RAILS_VERSION: ${{ matrix.rails-version }}
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
32
+ with:
33
+ ruby-version: ${{ matrix.ruby-version }}
34
+ bundler-cache: true
35
+ - name: Run tests
36
+ run: bundle exec rake
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- DEFAULT_RAILS_VERSION = '6.0.3'
4
+ DEFAULT_RAILS_VERSION = '6.0.3.5'
5
5
  ENV['RAILS_VERSION'] ||= DEFAULT_RAILS_VERSION
6
6
 
7
7
  if ENV['RAILS_VERSION'] == '4.2.10'
data/README.md CHANGED
@@ -94,6 +94,8 @@ pp kv.mdel(["foo", "bar"])
94
94
  # nil
95
95
  ```
96
96
 
97
+ Note that due to MySQL's default collation, KV keys are case-insensitive.
98
+
97
99
  ### GitHub::SQL
98
100
 
99
101
  ```ruby
@@ -215,7 +217,7 @@ Nothing currently on our radar other than continued maintenance. Have a big idea
215
217
 
216
218
  | pic | @mention |
217
219
  |---|---|
218
- | ![@charliesome](https://avatars3.githubusercontent.com/u/179065?s=64) | [@charliesome](https://github.com/charliesome) |
220
+ | ![@haileysome](https://avatars3.githubusercontent.com/u/179065?s=64) | [@haileysome](https://github.com/haileysome) |
219
221
  | ![@jnunemaker](https://avatars3.githubusercontent.com/u/235?s=64) | [@jnunemaker](https://github.com/jnunemaker) |
220
222
  | ![@miguelff](https://avatars3.githubusercontent.com/u/210307?s=64) | [@miguelff](https://github.com/miguelff) |
221
223
  | ![@zerowidth](https://avatars3.githubusercontent.com/u/3999?s=64) | [@zerowidth](https://github.com/zerowidth) |
@@ -1,5 +1,5 @@
1
1
  module GitHub
2
2
  module DS
3
- VERSION = "0.5.0"
3
+ VERSION = '0.5.3'
4
4
  end
5
5
  end
data/lib/github/kv.rb CHANGED
@@ -129,7 +129,8 @@ module GitHub
129
129
  SELECT `key`, value FROM #{@table_name} WHERE `key` IN :keys AND (`expires_at` IS NULL OR `expires_at` > :now)
130
130
  SQL
131
131
 
132
- keys.map { |key| kvs[key] }
132
+ kvs.keys.each { |key| kvs[key.downcase] = kvs[key] }
133
+ keys.map { |key| kvs[key.downcase] }
133
134
  }
134
135
  end
135
136
 
@@ -328,7 +329,7 @@ module GitHub
328
329
  `expires_at`=IF(
329
330
  concat('',`value`*1) = `value`,
330
331
  IF(
331
- :touch,
332
+ :touch OR (`expires_at` IS NULL OR `expires_at`<:now),
332
333
  :expires,
333
334
  `expires_at`
334
335
  ),
data/lib/github/sql.rb CHANGED
@@ -381,7 +381,7 @@ module GitHub
381
381
 
382
382
  when DateTime, Time, Date
383
383
  enforce_timezone do
384
- connection.quote value.to_s(:db)
384
+ connection.quote value.to_formatted_s(:db)
385
385
  end
386
386
 
387
387
  when true
@@ -402,15 +402,25 @@ module GitHub
402
402
 
403
403
  # Private: Forces ActiveRecord's default timezone for duration of block.
404
404
  def enforce_timezone(&block)
405
+ on_rails_7 = ActiveRecord.respond_to?(:default_timezone)
405
406
  begin
406
407
  if @force_timezone
407
- zone = ActiveRecord::Base.default_timezone
408
- ActiveRecord::Base.default_timezone = @force_timezone
408
+ if on_rails_7
409
+ zone = ActiveRecord.default_timezone
410
+ ActiveRecord.default_timezone = @force_timezone
411
+ else
412
+ zone = ActiveRecord::Base.default_timezone
413
+ ActiveRecord::Base.default_timezone = @force_timezone
414
+ end
409
415
  end
410
416
 
411
417
  yield if block_given?
412
418
  ensure
413
- ActiveRecord::Base.default_timezone = zone if @force_timezone
419
+ if on_rails_7
420
+ ActiveRecord.default_timezone = zone if @force_timezone
421
+ else
422
+ ActiveRecord::Base.default_timezone = zone if @force_timezone
423
+ end
414
424
  end
415
425
  end
416
426
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-ds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-06-16 00:00:00.000000000 Z
12
+ date: 2023-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -160,8 +160,8 @@ executables: []
160
160
  extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
+ - ".github/workflows/ci.yml"
163
164
  - ".gitignore"
164
- - ".travis.yml"
165
165
  - CHANGELOG.md
166
166
  - CODE_OF_CONDUCT.md
167
167
  - CONTRIBUTING.md
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubygems_version: 3.1.2
217
+ rubygems_version: 3.4.10
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: A collection of libraries for working with SQL on top of ActiveRecord's connection.
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
4
- - gem install bundler -v '<2'
5
- rvm:
6
- - 2.5
7
- - 2.6
8
- - 2.7
9
- script: bundle exec rake
10
- env:
11
- - RAILS_VERSION=6.0.3.1
12
- - RAILS_VERSION=5.2.0
13
- services:
14
- - mysql