shinq 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +47 -0
- data/README.md +2 -1
- data/lib/shinq/client.rb +1 -1
- data/shinq.gemspec +1 -1
- data/spec/config/database.yml +2 -1
- data/spec/db/{structure.sql.erb → structure.sql} +5 -2
- data/spec/integration_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -6
- metadata +6 -6
- data/.travis.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4ead10d8b4695ee2caa3163fe46c858a3aa39b91c9b4259513103f8eb69f071
|
4
|
+
data.tar.gz: e05ed573b31c277ed87045cba29c847cd500ca2f4953e3aba062b583ce9caee4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 559ffb5cd25d1afee723c5d508cb2c1c83cc7cc37c4716b293d10570fc1aef9a64e6ad12ca953a650cf1adbf6b66fc2fcb2afaa90aeb85a51c7bef98c63a1978
|
7
|
+
data.tar.gz: 701093a1975e29e0030d5512242da512ace75bf38d0db16f6d3d41ed24f2f39484de18f28528cd6bf7c54ec5297dbf3484259d87064804a27bb91410b9fb9a6d
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: test
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches:
|
13
|
+
- master
|
14
|
+
pull_request:
|
15
|
+
branches:
|
16
|
+
- master
|
17
|
+
workflow_dispatch:
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
|
24
|
+
strategy:
|
25
|
+
max-parallel: 4
|
26
|
+
fail-fast: true
|
27
|
+
matrix:
|
28
|
+
ruby: [2.4, 2.5, 2.6, 2.7]
|
29
|
+
services:
|
30
|
+
mysql:
|
31
|
+
image: iwata/centos6-mysql56-q4m-hs
|
32
|
+
ports:
|
33
|
+
- 3306:3306
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- name: Set up Ruby
|
37
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
38
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
39
|
+
# uses: ruby/setup-ruby@v1
|
40
|
+
uses: ruby/setup-ruby@v1
|
41
|
+
with:
|
42
|
+
bundler-cache: true
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
- name: Install dependencies
|
45
|
+
run: bundle install
|
46
|
+
- name: Run tests
|
47
|
+
run: bundle exec rspec
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Shinq
|
2
|
-
|
2
|
+
|
3
|
+
[![CI](https://github.com/ryopeko/shinq/workflows/test/badge.svg?event=push)](https://github.com/ryopeko/shinq/actions?query=workflow%3Atest+event%3Apush)
|
3
4
|
|
4
5
|
Worker and enqueuer for Q4M using the interface of ActiveJob.
|
5
6
|
|
data/lib/shinq/client.rb
CHANGED
@@ -69,7 +69,7 @@ module Shinq
|
|
69
69
|
@column_names_by_table_name[table_name.to_sym] ||= begin
|
70
70
|
quoted = SQL::Maker::Quoting.quote(table_name)
|
71
71
|
column = Shinq.connection.query(<<-EOS).map { |record| record['column_name'] }
|
72
|
-
select column_name from information_schema.columns where table_schema = database() and table_name = #{quoted}
|
72
|
+
select column_name as column_name from information_schema.columns where table_schema = database() and table_name = #{quoted}
|
73
73
|
EOS
|
74
74
|
end
|
75
75
|
end
|
data/shinq.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "shinq"
|
7
|
-
spec.version = '1.0
|
7
|
+
spec.version = '1.1.0'
|
8
8
|
spec.authors = ["Ryoichi SEKIGUCHI"]
|
9
9
|
spec.email = ["ryopeko@gmail.com"]
|
10
10
|
spec.summary = %q{Worker and enqueuer for Q4M using the interface of ActiveJob.}
|
data/spec/config/database.yml
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
CREATE DATABASE IF NOT EXISTS shinq_test;
|
2
|
+
USE shinq_test;
|
3
|
+
|
1
4
|
DROP TABLE IF EXISTS `queue_test`;
|
2
5
|
CREATE TABLE `queue_test` (
|
3
6
|
`job_id` varchar(255) NOT NULL,
|
4
7
|
`title` varchar(255),
|
5
8
|
`scheduled_at` bigint(20) NOT NULL DEFAULT '0',
|
6
9
|
`enqueued_at` datetime NOT NULL
|
7
|
-
) ENGINE
|
10
|
+
) ENGINE=QUEUE;
|
8
11
|
|
9
12
|
DROP TABLE IF EXISTS `queue_test_without_scheduled_at`;
|
10
13
|
|
@@ -12,4 +15,4 @@ CREATE TABLE `queue_test_without_scheduled_at` (
|
|
12
15
|
`job_id` varchar(255) NOT NULL,
|
13
16
|
`title` varchar(255),
|
14
17
|
`enqueued_at` datetime NOT NULL
|
15
|
-
) ENGINE
|
18
|
+
) ENGINE=QUEUE;
|
data/spec/integration_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -10,7 +10,7 @@ require 'mysql2'
|
|
10
10
|
require 'timecop'
|
11
11
|
|
12
12
|
def load_database_config
|
13
|
-
db_config = YAML.load_file(File.expand_path('./config/database.yml', __dir__)).
|
13
|
+
db_config = YAML.load_file(File.expand_path('./config/database.yml', __dir__)).deep_symbolize_keys
|
14
14
|
end
|
15
15
|
|
16
16
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
@@ -31,12 +31,13 @@ RSpec.configure do |config|
|
|
31
31
|
end
|
32
32
|
|
33
33
|
config.before(:suite) do
|
34
|
-
|
35
|
-
# We use QUEUE engine and run Q4M specific spec (integration_spec) only when ENV['TRAVIS'] is nil.
|
36
|
-
engine = ENV['TRAVIS'] ? 'InnoDB' : 'QUEUE' # Travis MySQL does not have Q4M plugins.
|
37
|
-
sql = ERB.new(File.read(File.expand_path('./db/structure.sql.erb', __dir__))).result(binding)
|
34
|
+
sql = Pathname('./db/structure.sql').expand_path(__dir__).read
|
38
35
|
|
39
|
-
|
36
|
+
config_for_setup = load_database_config[:test]
|
37
|
+
.except(:database) # To create database
|
38
|
+
.merge(flags: Mysql2::Client::MULTI_STATEMENTS)
|
39
|
+
|
40
|
+
connection = Mysql2::Client.new(config_for_setup)
|
40
41
|
result = connection.query(sql)
|
41
42
|
|
42
43
|
while connection.next_result
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shinq
|
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
|
- Ryoichi SEKIGUCHI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -218,9 +218,9 @@ executables:
|
|
218
218
|
extensions: []
|
219
219
|
extra_rdoc_files: []
|
220
220
|
files:
|
221
|
+
- ".github/workflows/test.yml"
|
221
222
|
- ".gitignore"
|
222
223
|
- ".rspec"
|
223
|
-
- ".travis.yml"
|
224
224
|
- Gemfile
|
225
225
|
- LICENSE.txt
|
226
226
|
- README.md
|
@@ -240,7 +240,7 @@ files:
|
|
240
240
|
- lib/shinq/statistics.rb
|
241
241
|
- shinq.gemspec
|
242
242
|
- spec/config/database.yml
|
243
|
-
- spec/db/structure.sql
|
243
|
+
- spec/db/structure.sql
|
244
244
|
- spec/helpers/my_worker.rb
|
245
245
|
- spec/integration_spec.rb
|
246
246
|
- spec/shinq/cli_spec.rb
|
@@ -267,13 +267,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
- !ruby/object:Gem::Version
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
|
-
rubygems_version: 3.0
|
270
|
+
rubygems_version: 3.2.0
|
271
271
|
signing_key:
|
272
272
|
specification_version: 4
|
273
273
|
summary: Worker and enqueuer for Q4M using the interface of ActiveJob.
|
274
274
|
test_files:
|
275
275
|
- spec/config/database.yml
|
276
|
-
- spec/db/structure.sql
|
276
|
+
- spec/db/structure.sql
|
277
277
|
- spec/helpers/my_worker.rb
|
278
278
|
- spec/integration_spec.rb
|
279
279
|
- spec/shinq/cli_spec.rb
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.1
|
6
|
-
- 2.2
|
7
|
-
- 2.3
|
8
|
-
- 2.4
|
9
|
-
- 2.6
|
10
|
-
- 2.7
|
11
|
-
gemfile:
|
12
|
-
- Gemfile
|
13
|
-
before_install:
|
14
|
-
- gem update bundler
|
15
|
-
- mysql -e "create database IF NOT EXISTS shinq_test;" -uroot
|
16
|
-
script: bundle exec rspec
|